sfx2/uiconfig/ui/templatedlg.ui |   64 ++++++++++++++++++----------------------
 vcl/inc/qt5/QtBuilder.hxx       |    1 
 vcl/qt5/QtBuilder.cxx           |   16 +++++++---
 3 files changed, 43 insertions(+), 38 deletions(-)

New commits:
commit 58544c8fec07b151bb74094e1a0be8b965caf1e9
Author:     Michael Weghorn <[email protected]>
AuthorDate: Sat Jan 18 18:05:39 2025 +0100
Commit:     Michael Weghorn <[email protected]>
CommitDate: Sun Jan 19 21:34:59 2025 +0100

    tdf#130857 templatedlg.ui: Don't use "pack-type end"
    
    Don't use the "pack-type" property with a value of "end"
    to reverse the order of GtkBox children, but use the
    default (of "start") and set the indices for the "packing"
    properties of the children in the usual order, which is more
    straighforward.
    
    The "pack-type" GtkBox property no longer exists in GTK 4 (see [1];
    `Convert3To4` in vcl/unx/gtk4/convert3to4.cxx currently
    has special handling for it for the "GtkBox" case to revert
    the order) and I also think it makes more sense to "normalize"
    the .ui files than implementing such a special handling in
    QtBuilder.
    
    Adjusting this in glade and resaving the .ui file also results
    in the GtkBox children to be defined in visual order, which ensures
    that the (focus) order is correct in Qt as it (by default) is based
    on the order in which widgets are created.
    
    (The "File" -> "Templates" -> "Manage Templates" dialog is not
    yet supported by QtInstanceBuilder, just noticed this while
    experimenting in a WIP branch.)
    
    [1] https://discourse.gnome.org/t/gtk4-replacement-for-pack-type/5574
    
    Change-Id: I1633fc05da68a7ccce36e17d13d0d654f4e6145b
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180463
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <[email protected]>

diff --git a/sfx2/uiconfig/ui/templatedlg.ui b/sfx2/uiconfig/ui/templatedlg.ui
index 7f7fe31d6371..23d8cc8d8720 100644
--- a/sfx2/uiconfig/ui/templatedlg.ui
+++ b/sfx2/uiconfig/ui/templatedlg.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="sfx">
   <requires lib="gtk+" version="3.20"/>
   <object class="GtkMenu" id="contextmenu">
@@ -158,40 +158,14 @@
                     <property name="can-focus">False</property>
                     <property name="spacing">12</property>
                     <child>
-                      <object class="GtkBox" id="box7">
+                      <object class="GtkLabel" id="label1">
                         <property name="visible">True</property>
                         <property name="can-focus">False</property>
-                        <child>
-                          <object class="GtkMenuButton" id="action_menu">
-                            <property name="label" translatable="yes" 
context="templatedlg|action_menu|label">_Manage</property>
-                            <property name="visible">True</property>
-                            <property name="can-focus">True</property>
-                            <property name="receives-default">False</property>
-                            <property name="use-underline">True</property>
-                            <property name="always-show-image">True</property>
-                            <property name="draw-indicator">True</property>
-                            <property name="popup">menu1</property>
-                            <property name="use-popover">False</property>
-                            <child>
-                              <placeholder/>
-                            </child>
-                            <child internal-child="accessible">
-                              <object class="AtkObject" 
id="action_menu-atkobject">
-                                <property 
name="AtkObject::accessible-description" translatable="yes" 
context="templatedlg|extended_tip|action_menu">Provides commands to create, 
rename and delete categories, reset default templates, and refresh the template 
manager.</property>
-                              </object>
-                            </child>
-                          </object>
-                          <packing>
-                            <property name="expand">False</property>
-                            <property name="fill">True</property>
-                            <property name="position">0</property>
-                          </packing>
-                        </child>
+                        <property name="label" translatable="yes" 
context="templatedlg|label1">Filter</property>
                       </object>
                       <packing>
                         <property name="expand">False</property>
                         <property name="fill">True</property>
-                        <property name="pack-type">end</property>
                         <property name="position">0</property>
                       </packing>
                     </child>
@@ -239,20 +213,43 @@
                       <packing>
                         <property name="expand">False</property>
                         <property name="fill">True</property>
-                        <property name="pack-type">end</property>
                         <property name="position">1</property>
                       </packing>
                     </child>
                     <child>
-                      <object class="GtkLabel" id="label1">
+                      <object class="GtkBox" id="box7">
                         <property name="visible">True</property>
                         <property name="can-focus">False</property>
-                        <property name="label" translatable="yes" 
context="templatedlg|label1">Filter</property>
+                        <child>
+                          <object class="GtkMenuButton" id="action_menu">
+                            <property name="label" translatable="yes" 
context="templatedlg|action_menu|label">_Manage</property>
+                            <property name="visible">True</property>
+                            <property name="can-focus">True</property>
+                            <property name="receives-default">False</property>
+                            <property name="use-underline">True</property>
+                            <property name="always-show-image">True</property>
+                            <property name="draw-indicator">True</property>
+                            <property name="popup">menu1</property>
+                            <property name="use-popover">False</property>
+                            <child>
+                              <placeholder/>
+                            </child>
+                            <child internal-child="accessible">
+                              <object class="AtkObject" 
id="action_menu-atkobject">
+                                <property 
name="AtkObject::accessible-description" translatable="yes" 
context="templatedlg|extended_tip|action_menu">Provides commands to create, 
rename and delete categories, reset default templates, and refresh the template 
manager.</property>
+                              </object>
+                            </child>
+                          </object>
+                          <packing>
+                            <property name="expand">False</property>
+                            <property name="fill">True</property>
+                            <property name="position">0</property>
+                          </packing>
+                        </child>
                       </object>
                       <packing>
                         <property name="expand">False</property>
                         <property name="fill">True</property>
-                        <property name="pack-type">end</property>
                         <property name="position">2</property>
                       </packing>
                     </child>
@@ -260,7 +257,6 @@
                   <packing>
                     <property name="expand">False</property>
                     <property name="fill">True</property>
-                    <property name="pack-type">end</property>
                     <property name="position">1</property>
                   </packing>
                 </child>
commit c6c756864dd4b052b63079fb6931ad5af0b3158f
Author:     Michael Weghorn <[email protected]>
AuthorDate: Sat Jan 18 17:41:24 2025 +0100
Commit:     Michael Weghorn <[email protected]>
CommitDate: Sun Jan 19 21:34:51 2025 +0100

    tdf#130857 qt weld: Evaluate entry's placeholder text
    
    Evaluate the GtkEntry "placeholder-text" property [1]
    when processing "GtkEntry" objects in .ui files.
    
    This gets used e.g. in the (not yet supported)
    "File" -> "Templates" -> "Manage Templates" dialog
    for the "Search..." entry.
    
    [1] https://docs.gtk.org/gtk3/property.Entry.placeholder-text.html
    
    Change-Id: Ic5d85199da4511bfc6758a77079f3b4c6c2aa7bd
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180462
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <[email protected]>

diff --git a/vcl/inc/qt5/QtBuilder.hxx b/vcl/inc/qt5/QtBuilder.hxx
index c2987dc33b19..f5a33571fbd8 100644
--- a/vcl/inc/qt5/QtBuilder.hxx
+++ b/vcl/inc/qt5/QtBuilder.hxx
@@ -98,6 +98,7 @@ private:
     static void replaceWidget(QWidget* pOldWidget, QWidget* pNewWidget);
     static void setProperties(QObject* obj, stringmap& rProps);
     void setButtonProperties(QAbstractButton& rButton, stringmap& rProps);
+    static void setEntryProperties(QLineEdit& rLineEdit, stringmap& rProps);
     static void setLabelProperties(QLabel& rLabel, stringmap& rProps);
     void setMenuButtonProperties(QToolButton& rButton, stringmap& rProps);
     void setScaleProperties(QSlider& rSlider, stringmap& rProps);
diff --git a/vcl/qt5/QtBuilder.cxx b/vcl/qt5/QtBuilder.cxx
index 132d9e8a38c0..b84778288b60 100644
--- a/vcl/qt5/QtBuilder.cxx
+++ b/vcl/qt5/QtBuilder.cxx
@@ -222,10 +222,7 @@ QObject* QtBuilder::makeObject(QObject* pParent, 
std::u16string_view sName, std:
     else if (sName == u"GtkEntry")
     {
         QLineEdit* pLineEdit = new QLineEdit(pParentWidget);
-        auto aIt = rMap.find(u"visibility"_ustr);
-        if (aIt != rMap.end() && !toBool(aIt->second))
-            pLineEdit->setEchoMode(QLineEdit::Password);
-
+        setEntryProperties(*pLineEdit, rMap);
         pObject = pLineEdit;
     }
     else if (sName == u"GtkExpander")
@@ -826,6 +823,17 @@ void QtBuilder::setButtonProperties(QAbstractButton& 
rButton, stringmap& rProps)
     }
 }
 
+void QtBuilder::setEntryProperties(QLineEdit& rLineEdit, stringmap& rProps)
+{
+    auto aIt = rProps.find(u"placeholder-text"_ustr);
+    if (aIt != rProps.end())
+        rLineEdit.setPlaceholderText(toQString(aIt->second));
+
+    aIt = rProps.find(u"visibility"_ustr);
+    if (aIt != rProps.end() && !toBool(aIt->second))
+        rLineEdit.setEchoMode(QLineEdit::Password);
+}
+
 void QtBuilder::setLabelProperties(QLabel& rLabel, stringmap& rProps)
 {
     for (auto const & [ rKey, rValue ] : rProps)

Reply via email to