starmath/source/dialog.cxx                  |    4 +
 starmath/uiconfig/smath/ui/spacingdialog.ui |   86 ++++++++++++++--------------
 vcl/qt5/QtBuilder.cxx                       |    4 -
 3 files changed, 50 insertions(+), 44 deletions(-)

New commits:
commit e481fefbf612fc16f6a533d1253243108df78b72
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Fri Apr 11 13:00:45 2025 +0200
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Fri Apr 11 19:44:09 2025 +0200

    tdf#130857 qt weld: Make scroll area child resizable
    
    As the QScrollArea doc [1] says:
    
    > The child widget must be specified with setWidget().
    
    This was implemented in
    
        commit 89b00d3e34c93b4ea0701a321a3cecf57aa0e378
        Author: Michael Weghorn <m.wegh...@posteo.de>
        Date:   Sat Dec 14 19:45:51 2024 +0100
    
            tdf#130857 qt weld: Drop scroll area parent if redundant
    
    However, that commit had the side-effect that
    the info text inside the scroll area in the
    "View" -> "User Interface" dialog was no longer
    completely displayed, but looked cropped.
    
    This is because the label still had the size needed
    to display only the initial "Information:" text
    specified in the .ui file
    (cui/uiconfig/ui/toolbarmodedialog.ui), not the
    longer text set later.
    
    Make the widget resizable by calling
    QScrollArea::setWidgetResizable [2]
    after creating the scroll area.
    
    This makes the auto-resize of the label
    work so that the full text is displayed
    again as expected.
    
    [1] https://doc.qt.io/qt-6/qscrollarea.html
    [2] https://doc.qt.io/qt-6/qscrollarea.html#widgetResizable-prop
    
    Change-Id: I2fada7b5e2037d6631006dcabd0ce08dfff27795
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/184033
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>

diff --git a/vcl/qt5/QtBuilder.cxx b/vcl/qt5/QtBuilder.cxx
index 7d5214f133af..c57977ddf899 100644
--- a/vcl/qt5/QtBuilder.cxx
+++ b/vcl/qt5/QtBuilder.cxx
@@ -312,7 +312,9 @@ QObject* QtBuilder::makeObject(QObject* pParent, 
std::u16string_view sName, std:
     }
     else if (sName == u"GtkScrolledWindow")
     {
-        pObject = new QScrollArea(pParentWidget);
+        QScrollArea* pScrollArea = new QScrollArea(pParentWidget);
+        pScrollArea->setWidgetResizable(true);
+        pObject = pScrollArea;
     }
     else if (sName == u"GtkSeparator")
     {
commit 51d9b37032c1054f873d5378f08ffd09b5c44bcf
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Fri Apr 11 11:03:22 2025 +0200
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Fri Apr 11 19:44:03 2025 +0200

    tdf#130857 Define widgets in Math's "Spacing" dlg in order
    
    Switch the order in which the widgets in the .ui file inside
    the "grid2" are defined so that the order matches the visual appearance
    (and "left-attach"/"top-attach" properties order), which makes sure
    that tab focus order with the Qt-based VCL plugins is correct as well
    when using native Qt widgets (SAL_VCL_QT_USE_WELDED_WIDGETS=1), where
    focus order is (by default) based on widget creation order.
    
    See
    
        commit 02692566ad9fc7c3484f8581ffa0004cd4e43987
        Author: Michael Weghorn <m.wegh...@posteo.de>
        Date:   Thu Oct 24 17:43:35 2024 +0200
    
            tdf#130857 optnewdictionarydialog.ui: Define focusable widgets in 
order
    
    for more background.
    
    The dialog can be triggered in Math via "Format" -> "Spacing".
    
    Change-Id: I00c4e4bc93bc398f2f8752a9ff5d62ebe4caf8e3
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/184027
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>

diff --git a/starmath/uiconfig/smath/ui/spacingdialog.ui 
b/starmath/uiconfig/smath/ui/spacingdialog.ui
index c62ff2263a08..388fcd669772 100644
--- a/starmath/uiconfig/smath/ui/spacingdialog.ui
+++ b/starmath/uiconfig/smath/ui/spacingdialog.ui
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.38.2 -->
+<!-- Generated with glade 3.40.0 -->
 <interface domain="sm">
   <requires lib="gtk+" version="3.20"/>
   <object class="GtkAdjustment" id="adjustment1">
@@ -266,63 +266,78 @@
                             <property name="row-spacing">6</property>
                             <property name="column-spacing">12</property>
                             <child>
-                              <object class="GtkSpinButton" id="spinbutton2">
+                              <object class="GtkLabel" id="label1">
                                 <property name="visible">True</property>
-                                <property name="can-focus">True</property>
-                                <property name="events">GDK_FOCUS_CHANGE_MASK 
| GDK_STRUCTURE_MASK</property>
+                                <property name="can-focus">False</property>
                                 <property name="no-show-all">True</property>
-                                <property 
name="activates-default">True</property>
-                                <property 
name="truncate-multiline">True</property>
-                                <property 
name="adjustment">adjustment2</property>
+                                <property name="label">String 1</property>
+                                <property name="use-underline">True</property>
+                                <property 
name="mnemonic-widget">spinbutton1</property>
+                                <property name="xalign">0</property>
                               </object>
                               <packing>
-                                <property name="left-attach">1</property>
-                                <property name="top-attach">1</property>
+                                <property name="left-attach">0</property>
+                                <property name="top-attach">0</property>
                               </packing>
                             </child>
                             <child>
-                              <object class="GtkSpinButton" id="spinbutton3">
+                              <object class="GtkSpinButton" id="spinbutton1">
                                 <property name="visible">True</property>
                                 <property name="can-focus">True</property>
                                 <property name="events">GDK_FOCUS_CHANGE_MASK 
| GDK_STRUCTURE_MASK</property>
                                 <property name="no-show-all">True</property>
                                 <property 
name="activates-default">True</property>
                                 <property 
name="truncate-multiline">True</property>
-                                <property 
name="adjustment">adjustment3</property>
+                                <property 
name="adjustment">adjustment1</property>
                               </object>
                               <packing>
                                 <property name="left-attach">1</property>
-                                <property name="top-attach">3</property>
+                                <property name="top-attach">0</property>
                               </packing>
                             </child>
                             <child>
-                              <object class="GtkLabel" id="label1">
+                              <object class="GtkLabel" id="label2">
                                 <property name="visible">True</property>
                                 <property name="can-focus">False</property>
                                 <property name="no-show-all">True</property>
-                                <property name="label">String 1</property>
+                                <property name="label">String 2</property>
                                 <property name="use-underline">True</property>
-                                <property 
name="mnemonic-widget">spinbutton1</property>
+                                <property 
name="mnemonic-widget">spinbutton2</property>
                                 <property name="xalign">0</property>
                               </object>
                               <packing>
                                 <property name="left-attach">0</property>
-                                <property name="top-attach">0</property>
+                                <property name="top-attach">1</property>
                               </packing>
                             </child>
                             <child>
-                              <object class="GtkLabel" id="label2">
+                              <object class="GtkSpinButton" id="spinbutton2">
                                 <property name="visible">True</property>
-                                <property name="can-focus">False</property>
+                                <property name="can-focus">True</property>
+                                <property name="events">GDK_FOCUS_CHANGE_MASK 
| GDK_STRUCTURE_MASK</property>
+                                <property name="no-show-all">True</property>
+                                <property 
name="activates-default">True</property>
+                                <property 
name="truncate-multiline">True</property>
+                                <property 
name="adjustment">adjustment2</property>
+                              </object>
+                              <packing>
+                                <property name="left-attach">1</property>
+                                <property name="top-attach">1</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkCheckButton" id="checkbutton">
+                                <property name="label" translatable="yes" 
context="spacingdialog|checkbutton">Scale all brackets</property>
+                                <property name="can-focus">True</property>
+                                <property 
name="receives-default">False</property>
                                 <property name="no-show-all">True</property>
-                                <property name="label">String 2</property>
                                 <property name="use-underline">True</property>
-                                <property 
name="mnemonic-widget">spinbutton2</property>
-                                <property name="xalign">0</property>
+                                <property name="draw-indicator">True</property>
                               </object>
                               <packing>
                                 <property name="left-attach">0</property>
-                                <property name="top-attach">1</property>
+                                <property name="top-attach">2</property>
+                                <property name="width">2</property>
                               </packing>
                             </child>
                             <child>
@@ -341,18 +356,18 @@
                               </packing>
                             </child>
                             <child>
-                              <object class="GtkSpinButton" id="spinbutton4">
+                              <object class="GtkSpinButton" id="spinbutton3">
                                 <property name="visible">True</property>
                                 <property name="can-focus">True</property>
                                 <property name="events">GDK_FOCUS_CHANGE_MASK 
| GDK_STRUCTURE_MASK</property>
                                 <property name="no-show-all">True</property>
                                 <property 
name="activates-default">True</property>
                                 <property 
name="truncate-multiline">True</property>
-                                <property 
name="adjustment">adjustment4</property>
+                                <property 
name="adjustment">adjustment3</property>
                               </object>
                               <packing>
                                 <property name="left-attach">1</property>
-                                <property name="top-attach">4</property>
+                                <property name="top-attach">3</property>
                               </packing>
                             </child>
                             <child>
@@ -371,33 +386,18 @@
                               </packing>
                             </child>
                             <child>
-                              <object class="GtkCheckButton" id="checkbutton">
-                                <property name="label" translatable="yes" 
context="spacingdialog|checkbutton">Scale all brackets</property>
-                                <property name="can-focus">True</property>
-                                <property 
name="receives-default">False</property>
-                                <property name="no-show-all">True</property>
-                                <property name="use-underline">True</property>
-                                <property name="draw-indicator">True</property>
-                              </object>
-                              <packing>
-                                <property name="left-attach">0</property>
-                                <property name="top-attach">2</property>
-                                <property name="width">2</property>
-                              </packing>
-                            </child>
-                            <child>
-                              <object class="GtkSpinButton" id="spinbutton1">
+                              <object class="GtkSpinButton" id="spinbutton4">
                                 <property name="visible">True</property>
                                 <property name="can-focus">True</property>
                                 <property name="events">GDK_FOCUS_CHANGE_MASK 
| GDK_STRUCTURE_MASK</property>
                                 <property name="no-show-all">True</property>
                                 <property 
name="activates-default">True</property>
                                 <property 
name="truncate-multiline">True</property>
-                                <property 
name="adjustment">adjustment1</property>
+                                <property 
name="adjustment">adjustment4</property>
                               </object>
                               <packing>
                                 <property name="left-attach">1</property>
-                                <property name="top-attach">0</property>
+                                <property name="top-attach">4</property>
                               </packing>
                             </child>
                           </object>
commit 6020bbda165b244fac628fa499a8e3bf8f7f0d8b
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Fri Apr 11 10:49:41 2025 +0200
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Fri Apr 11 19:43:56 2025 +0200

    tdf#130857 math: Ensure focus handler in "Spacing" dlg gets called
    
    As mentioned for Math's "Format" -> "Spacing" dialog in
    previous commit
    
        Change-Id: I3018c5a76cd863332ac8560a926105ae76327a38
        Author: Michael Weghorn <m.wegh...@posteo.de>
        Date:   Fri Apr 11 10:31:09 2025 +0200
    
            tdf#130857 qt weld: Support Math's "Spacing" dialog
    
    for the case of using native widgets with the qt6 VCL plugin:
    
    > Currently, the image isn't always updated when choosing
    > a different category via "Category" menu button. This
    > will be addressed in a separate commit.
    
    For some reason (not further analyzed so far), no
    QApplication::focusChanged signal gets emitted (that would then
    trigger the slot in QtInstanceWidget::applicationFocusChanged)
    for the following scenario:
    
    * start Math with the qt6 VCL plugin and environment variable
      SAL_VCL_QT_USE_WELDED_WIDGETS=1 set
    * open the "Format" -> "Spacing" dialog
    * while the focus is still on the "Spacing" spinbox, click the
      "Category" menu button and select another category, e.g. "Operators"
    
    The problem cannot be observed when first moving focus away
    from the "Spacing" spinbox.
    
    To make sure the image gets updated, explicitly call
    the SmDistanceDialog::SetCategory
    Call the `GetFocusHdl` handler in SmDistanceDialog::SetCategory
    after setting focus to the spinbutton which makes this work
    for the case of using native widgets with qt6 as well.
    
    Change-Id: Ia4a1389a014f22c9c1665093321b231838ad1215
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/184026
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>
    Tested-by: Jenkins

diff --git a/starmath/source/dialog.cxx b/starmath/source/dialog.cxx
index 498c3070f0be..eb99711bea6e 100644
--- a/starmath/source/dialog.cxx
+++ b/starmath/source/dialog.cxx
@@ -886,6 +886,10 @@ void SmDistanceDialog::SetCategory(sal_uInt16 nCategory)
     nActiveCategory = nCategory;
 
     m_xMetricField1->grab_focus();
+    // ensure the focus handler gets called
+    // (for qt6 and native widgets, no focus event gets sent when "Category" 
menu was triggered using
+    // mouse while m_xMetricField1 had keyboard focus)
+    GetFocusHdl(m_xMetricField1->get_widget());
 }
 
 SmDistanceDialog::SmDistanceDialog(weld::Window *pParent)

Reply via email to