vcl/qt5/QtInstanceBuilder.cxx    |    2 ++
 vcl/qt5/QtInstanceMenuButton.cxx |    9 +++++++++
 2 files changed, 11 insertions(+)

New commits:
commit 3a9dd7f3d5ad0d8220f44536dc18874095a75292
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Thu May 29 18:38:46 2025 +0200
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Fri May 30 07:47:00 2025 +0200

    tdf#130857 qt weld: Position popup below menu button
    
    When showing the popup for a QtInstanceMenuButton,
    position it below the button, and horizontally centered.
    
    This makes the calendar popup in the dialog newly
    supported since
    
        Change-Id: I57f4a864651e32a1cfc30f2778d86cb1e89f3349
        Author: Michael Weghorn <m.wegh...@posteo.de>
        Date:   Thu May 29 16:39:43 2025 +0200
    
            tdf#130857 qt weld: Support sc dialog to group by date
    
    show up in a proper position instead of a "random" place
    with SAL_VCL_QT_USE_WELDED_WIDGETS=1.
    
    Change-Id: I6749d8db3c9939063acc0f4c789c9e01ed58aa18
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/186020
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>

diff --git a/vcl/qt5/QtInstanceMenuButton.cxx b/vcl/qt5/QtInstanceMenuButton.cxx
index 6bbcd9cdcc9b..02f53531e5a6 100644
--- a/vcl/qt5/QtInstanceMenuButton.cxx
+++ b/vcl/qt5/QtInstanceMenuButton.cxx
@@ -176,9 +176,18 @@ void QtInstanceMenuButton::insertAction(QAction* pAction, 
int nPos)
 void QtInstanceMenuButton::handleButtonClicked()
 {
     if (m_pPopover)
+    {
+        // show popup horizontally centered below the button
+        m_pPopover->adjustSize();
+        QPoint aPos = m_pToolButton->mapToGlobal(QPoint(0, 
m_pToolButton->height()));
+        aPos.setX(aPos.x() + (m_pToolButton->width() - m_pPopover->width() / 
2));
+        m_pPopover->move(aPos);
         m_pPopover->show();
+    }
     else
+    {
         m_pToolButton->showMenu();
+    }
 }
 
 void QtInstanceMenuButton::handleMenuItemTriggered(QAction* pAction)
commit 9218387aef2a1b9d33cf6b40d774dfb0cb2882ea
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Thu May 29 16:39:43 2025 +0200
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Fri May 30 07:46:54 2025 +0200

    tdf#130857 qt weld: Support sc dialog to group by date
    
    Declare support for the Calc "Grouping" dialog to group
    by date.
    This means that native Qt widgets are used for that dialog
    now when using the qt5 or qt6 VCL plugin and starting LO with
    environment variable SAL_VCL_QT_USE_WELDED_WIDGETS=1 set.
    
    The dialog can be triggered as follows:
    
    1) Open attachment 184921 from tdf#153217 in Calc
    2) switch to "Pivot_Table_Sheet1_1" spreadsheet
    3) select cells A1:A13 (i.e. the month names)
    4) "Tools" -> "Group and Outline" -> "Group"
    
    This makes use of QtInstanceCalender introduced
    in previous commit
    
        Change-Id: I8a65701a1aa477a04dcf66f63df7864db0b0cdf4
        Author: Michael Weghorn <m.wegh...@posteo.de>
        Date:   Thu May 29 15:32:54 2025 +0200
    
            tdf#130857 qt weld: Introduce QtInstanceCalendar
    
    and the conditional support for .ui files from
    
        Change-Id: I0174d306187ed65f49f165b9eff7f2f2ea05a3a5
        Author: Michael Weghorn <m.wegh...@posteo.de>
        Date:   Thu May 29 15:43:15 2025 +0200
    
            tdf#130857 qt weld: Prepare for more conditional UI file support
    
    Support for svt/ui/datewindow.ui which contains the
    the popup that contains the "GtkCalendar" is conditional
    on the parent being a native QWidget.
    
    This makes it possible for this to be used for the
    newly supported dialog without breaking dialogs
    that are not native Qt dialogs (yet), e.g. in
    "File" -> "Properties", the "Custom Properties"
    tab still uses the vcl::Window based weld::Calendar.
    Sample use:
    
    * "File" -> "Properties"
    * switch to "Custom Properties" tab
    * press "Add Property"
    * for the newly created entry, select type "Date"
    * click on the menu button in the "Value" column
      to open the calendar popup
    
    (This wouldn't work with the native Qt
    version as of now, because the SalInstanceMenuButton
    expects to also have a vcl popup.)
    
    Change-Id: I57f4a864651e32a1cfc30f2778d86cb1e89f3349
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/186019
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>

diff --git a/vcl/qt5/QtInstanceBuilder.cxx b/vcl/qt5/QtInstanceBuilder.cxx
index 802eb0fc1ca8..d0507c00b4ba 100644
--- a/vcl/qt5/QtInstanceBuilder.cxx
+++ b/vcl/qt5/QtInstanceBuilder.cxx
@@ -103,6 +103,7 @@ bool QtInstanceBuilder::IsUIFileSupported(const OUString& 
rUIFile, const weld::W
         u"filter/ui/xmlfiltersettings.ui"_ustr,
         u"filter/ui/xsltfilterdialog.ui"_ustr,
         u"modules/BasicIDE/ui/gotolinedialog.ui"_ustr,
+        u"modules/scalc/ui/groupbydate.ui"_ustr,
         u"modules/scalc/ui/inputstringdialog.ui"_ustr,
         u"modules/scalc/ui/insertcells.ui"_ustr,
         u"modules/scalc/ui/movecopysheet.ui"_ustr,
@@ -166,6 +167,7 @@ bool QtInstanceBuilder::IsUIFileSupported(const OUString& 
rUIFile, const weld::W
     // native Qt dialogs/widgets
     static std::unordered_set<OUString> aSupportedWithQtParent = {
         u"cui/ui/appearance.ui"_ustr,
+        u"svt/ui/datewindow.ui"_ustr,
     };
 
     if (aSupportedUIFiles.contains(rUIFile))

Reply via email to