sc/uiconfig/scalc/ui/groupbydate.ui |  237 ++++++++++++++++++------------------
 vcl/CustomTarget_qt5_moc.mk         |    1 
 vcl/CustomTarget_qt6_moc.mk         |    1 
 vcl/Library_vclplug_qt5.mk          |    1 
 vcl/Library_vclplug_qt6.mk          |    1 
 vcl/inc/qt5/QtInstanceBuilder.hxx   |    2 
 vcl/inc/qt5/QtInstanceCalendar.hxx  |   33 +++++
 vcl/inc/qt5/QtTools.hxx             |    9 +
 vcl/inc/qt6/QtInstanceCalendar.hxx  |   12 +
 vcl/qt5/QtBuilder.cxx               |    5 
 vcl/qt5/QtInstanceBuilder.cxx       |   20 ++-
 vcl/qt5/QtInstanceCalendar.cxx      |   54 ++++++++
 vcl/qt6/QtInstanceCalendar.cxx      |   12 +
 13 files changed, 267 insertions(+), 121 deletions(-)

New commits:
commit c100a4e59350b69db7fe1de20094739e7afdcd6b
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Thu May 29 16:34:43 2025 +0200
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Fri May 30 07:46:47 2025 +0200

    sc a11y: Resave groupbydate.ui + set a11y relations
    
    Resave the dialog with glade 3.40 and fix
    preexisting a11y issues now triggering gla11y
    build errors:
    
        sc/uiconfig/scalc/ui/groupbydate.ui:148 FATAL WARNING: 'GtkMenuButton' 
'start_date' does not have its own label
        sc/uiconfig/scalc/ui/groupbydate.ui:232 FATAL WARNING: 'GtkMenuButton' 
'end_date' does not have its own label
    
    Manually restore the
    
        <property name="label" translatable="no"></property>
    
    for the 2 GtkMenuButton objects to avoid following critical
    warnings seen with the gtk3 VCL plugin:
    
        (soffice:340885): GLib-GObject-CRITICAL **: 18:11:59.786: invalid cast 
from 'GtkImage' to 'GtkLabel'
    
        (soffice:340885): Gtk-CRITICAL **: 18:11:59.786: gtk_label_set_label: 
assertion 'GTK_IS_LABEL (label)' failed
    
    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"
    
    Change-Id: Ia83a764245aa577fbab9e1c1917c25fd1b0c2a8d
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/186018
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>

diff --git a/sc/uiconfig/scalc/ui/groupbydate.ui 
b/sc/uiconfig/scalc/ui/groupbydate.ui
index 59895239b4a9..1da1fce79b18 100644
--- a/sc/uiconfig/scalc/ui/groupbydate.ui
+++ b/sc/uiconfig/scalc/ui/groupbydate.ui
@@ -1,11 +1,11 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.22.1 -->
+<!-- Generated with glade 3.40.0 -->
 <interface domain="sc">
   <requires lib="gtk+" version="3.20"/>
   <object class="GtkAdjustment" id="adjustment1">
     <property name="upper">100</property>
-    <property name="step_increment">1</property>
-    <property name="page_increment">10</property>
+    <property name="step-increment">1</property>
+    <property name="page-increment">10</property>
   </object>
   <object class="GtkTreeStore" id="liststore1">
     <columns>
@@ -22,31 +22,28 @@
     </columns>
   </object>
   <object class="GtkDialog" id="PivotTableGroupByDate">
-    <property name="can_focus">False</property>
-    <property name="border_width">6</property>
+    <property name="can-focus">False</property>
+    <property name="border-width">6</property>
     <property name="title" translatable="yes" 
context="groupbydate|PivotTableGroupByDate">Grouping</property>
     <property name="resizable">False</property>
-    <property name="type_hint">dialog</property>
-    <child>
-      <placeholder/>
-    </child>
+    <property name="type-hint">dialog</property>
     <child internal-child="vbox">
       <object class="GtkBox" id="dialog-vbox1">
-        <property name="can_focus">False</property>
+        <property name="can-focus">False</property>
         <property name="orientation">vertical</property>
         <property name="spacing">12</property>
         <child internal-child="action_area">
           <object class="GtkButtonBox" id="dialog-action_area1">
-            <property name="can_focus">False</property>
-            <property name="layout_style">end</property>
+            <property name="can-focus">False</property>
+            <property name="layout-style">end</property>
             <child>
               <object class="GtkButton" id="ok">
                 <property name="label" translatable="yes" 
context="stock">_OK</property>
                 <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="can_default">True</property>
-                <property name="has_default">True</property>
-                <property name="receives_default">True</property>
+                <property name="can-focus">True</property>
+                <property name="can-default">True</property>
+                <property name="has-default">True</property>
+                <property name="receives-default">True</property>
                 <property name="use-underline">True</property>
               </object>
               <packing>
@@ -59,9 +56,9 @@
               <object class="GtkButton" id="cancel">
                 <property name="label" translatable="yes" 
context="stock">_Cancel</property>
                 <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="can_default">True</property>
-                <property name="receives_default">True</property>
+                <property name="can-focus">True</property>
+                <property name="can-default">True</property>
+                <property name="receives-default">True</property>
                 <property name="use-underline">True</property>
               </object>
               <packing>
@@ -74,8 +71,8 @@
               <object class="GtkButton" id="help">
                 <property name="label" translatable="yes" 
context="stock">_Help</property>
                 <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="receives_default">True</property>
+                <property name="can-focus">True</property>
+                <property name="receives-default">True</property>
                 <property name="use-underline">True</property>
               </object>
               <packing>
@@ -89,78 +86,84 @@
           <packing>
             <property name="expand">False</property>
             <property name="fill">True</property>
-            <property name="pack_type">end</property>
+            <property name="pack-type">end</property>
             <property name="position">0</property>
           </packing>
         </child>
         <child>
           <object class="GtkBox" id="box1">
             <property name="visible">True</property>
-            <property name="can_focus">False</property>
+            <property name="can-focus">False</property>
             <property name="hexpand">True</property>
             <property name="vexpand">True</property>
             <property name="orientation">vertical</property>
             <child>
               <object class="GtkFrame" id="frame1">
                 <property name="visible">True</property>
-                <property name="can_focus">False</property>
-                <property name="label_xalign">0</property>
-                <property name="shadow_type">none</property>
+                <property name="can-focus">False</property>
+                <property name="label-xalign">0</property>
+                <property name="shadow-type">none</property>
                 <child>
-                  <!-- n-columns=1 n-rows=1 -->
+                  <!-- n-columns=2 n-rows=2 -->
                   <object class="GtkGrid" id="grid1">
                     <property name="visible">True</property>
-                    <property name="can_focus">False</property>
-                    <property name="hexpand">True</property>
-                    <property name="vexpand">True</property>
-                    <property name="row_spacing">6</property>
-                    <property name="column_spacing">12</property>
+                    <property name="can-focus">False</property>
                     <property name="margin-start">12</property>
                     <property name="margin-top">6</property>
+                    <property name="hexpand">True</property>
+                    <property name="vexpand">True</property>
+                    <property name="row-spacing">6</property>
+                    <property name="column-spacing">12</property>
                     <child>
                       <object class="GtkRadioButton" id="auto_start">
                         <property name="label" translatable="yes" 
context="groupbydate|auto_start">_Automatically</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="can-focus">True</property>
+                        <property name="receives-default">False</property>
+                        <property name="use-underline">True</property>
                         <property name="active">True</property>
-                        <property name="draw_indicator">True</property>
+                        <property name="draw-indicator">True</property>
                       </object>
                       <packing>
-                        <property name="left_attach">0</property>
-                        <property name="top_attach">0</property>
+                        <property name="left-attach">0</property>
+                        <property name="top-attach">0</property>
                       </packing>
                     </child>
                     <child>
                       <object class="GtkRadioButton" id="manual_start">
                         <property name="label" translatable="yes" 
context="groupbydate|manual_start">_Manually at:</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="draw_indicator">True</property>
+                        <property name="can-focus">True</property>
+                        <property name="receives-default">False</property>
+                        <property name="use-underline">True</property>
+                        <property name="draw-indicator">True</property>
                         <property name="group">auto_start</property>
+                        <accessibility>
+                          <relation type="label-for" target="start_date"/>
+                        </accessibility>
                       </object>
                       <packing>
-                        <property name="left_attach">0</property>
-                        <property name="top_attach">1</property>
+                        <property name="left-attach">0</property>
+                        <property name="top-attach">1</property>
                       </packing>
                     </child>
                     <child>
                       <object class="GtkMenuButton" id="start_date">
                         <property name="visible">True</property>
-                        <property name="can_focus">True</property>
-                        <property name="receives_default">False</property>
-                        <property name="draw_indicator">True</property>
+                        <property name="can-focus">True</property>
+                        <property name="receives-default">False</property>
+                        <property name="draw-indicator">True</property>
                         <property name="label" translatable="no"></property>
                         <child>
                           <placeholder/>
                         </child>
+                        <accessibility>
+                          <relation type="labelled-by" target="manual_start"/>
+                        </accessibility>
                       </object>
                       <packing>
-                        <property name="left_attach">1</property>
-                        <property name="top_attach">1</property>
+                        <property name="left-attach">1</property>
+                        <property name="top-attach">1</property>
                       </packing>
                     </child>
                     <child>
@@ -171,7 +174,7 @@
                 <child type="label">
                   <object class="GtkLabel" id="label1">
                     <property name="visible">True</property>
-                    <property name="can_focus">False</property>
+                    <property name="can-focus">False</property>
                     <property name="label" translatable="yes" 
context="groupbydate|label1">Start</property>
                     <attributes>
                       <attribute name="weight" value="bold"/>
@@ -188,64 +191,70 @@
             <child>
               <object class="GtkFrame" id="frame2">
                 <property name="visible">True</property>
-                <property name="can_focus">False</property>
-                <property name="label_xalign">0</property>
-                <property name="shadow_type">none</property>
+                <property name="can-focus">False</property>
+                <property name="label-xalign">0</property>
+                <property name="shadow-type">none</property>
                 <child>
-                  <!-- n-columns=1 n-rows=1 -->
+                  <!-- n-columns=2 n-rows=2 -->
                   <object class="GtkGrid" id="grid2">
                     <property name="visible">True</property>
-                    <property name="can_focus">False</property>
-                    <property name="hexpand">True</property>
-                    <property name="vexpand">True</property>
-                    <property name="row_spacing">6</property>
-                    <property name="column_spacing">12</property>
+                    <property name="can-focus">False</property>
                     <property name="margin-start">12</property>
                     <property name="margin-top">6</property>
+                    <property name="hexpand">True</property>
+                    <property name="vexpand">True</property>
+                    <property name="row-spacing">6</property>
+                    <property name="column-spacing">12</property>
                     <child>
                       <object class="GtkRadioButton" id="auto_end">
                         <property name="label" translatable="yes" 
context="groupbydate|auto_end">A_utomatically</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="can-focus">True</property>
+                        <property name="receives-default">False</property>
+                        <property name="use-underline">True</property>
                         <property name="active">True</property>
-                        <property name="draw_indicator">True</property>
+                        <property name="draw-indicator">True</property>
                       </object>
                       <packing>
-                        <property name="left_attach">0</property>
-                        <property name="top_attach">0</property>
+                        <property name="left-attach">0</property>
+                        <property name="top-attach">0</property>
                       </packing>
                     </child>
                     <child>
                       <object class="GtkRadioButton" id="manual_end">
                         <property name="label" translatable="yes" 
context="groupbydate|manual_end">Ma_nually at:</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="draw_indicator">True</property>
+                        <property name="can-focus">True</property>
+                        <property name="receives-default">False</property>
+                        <property name="use-underline">True</property>
+                        <property name="draw-indicator">True</property>
                         <property name="group">auto_end</property>
+                        <accessibility>
+                          <relation type="label-for" target="end_date"/>
+                        </accessibility>
                       </object>
                       <packing>
-                        <property name="left_attach">0</property>
-                        <property name="top_attach">1</property>
+                        <property name="left-attach">0</property>
+                        <property name="top-attach">1</property>
                       </packing>
                     </child>
                     <child>
                       <object class="GtkMenuButton" id="end_date">
                         <property name="visible">True</property>
-                        <property name="can_focus">True</property>
-                        <property name="receives_default">False</property>
-                        <property name="draw_indicator">True</property>
+                        <property name="can-focus">True</property>
+                        <property name="receives-default">False</property>
+                        <property name="draw-indicator">True</property>
                         <property name="label" translatable="no"></property>
                         <child>
                           <placeholder/>
                         </child>
+                        <accessibility>
+                          <relation type="labelled-by" target="manual_end"/>
+                        </accessibility>
                       </object>
                       <packing>
-                        <property name="left_attach">1</property>
-                        <property name="top_attach">1</property>
+                        <property name="left-attach">1</property>
+                        <property name="top-attach">1</property>
                       </packing>
                     </child>
                     <child>
@@ -256,7 +265,7 @@
                 <child type="label">
                   <object class="GtkLabel" id="label2">
                     <property name="visible">True</property>
-                    <property name="can_focus">False</property>
+                    <property name="can-focus">False</property>
                     <property name="label" translatable="yes" 
context="groupbydate|label2">End</property>
                     <attributes>
                       <attribute name="weight" value="bold"/>
@@ -273,94 +282,94 @@
             <child>
               <object class="GtkFrame" id="frame3">
                 <property name="visible">True</property>
-                <property name="can_focus">False</property>
+                <property name="can-focus">False</property>
                 <property name="hexpand">True</property>
                 <property name="vexpand">True</property>
-                <property name="label_xalign">0</property>
-                <property name="shadow_type">none</property>
+                <property name="label-xalign">0</property>
+                <property name="shadow-type">none</property>
                 <child>
-                  <!-- n-columns=1 n-rows=1 -->
+                  <!-- n-columns=2 n-rows=2 -->
                   <object class="GtkGrid" id="grid3">
                     <property name="visible">True</property>
-                    <property name="can_focus">False</property>
-                    <property name="hexpand">True</property>
-                    <property name="vexpand">True</property>
-                    <property name="row_spacing">6</property>
-                    <property name="column_spacing">12</property>
+                    <property name="can-focus">False</property>
                     <property name="margin-start">12</property>
                     <property name="margin-top">6</property>
+                    <property name="hexpand">True</property>
+                    <property name="vexpand">True</property>
+                    <property name="row-spacing">6</property>
+                    <property name="column-spacing">12</property>
                     <child>
                       <object class="GtkRadioButton" id="days">
                         <property name="label" translatable="yes" 
context="groupbydate|days">Number of _days:</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="can-focus">True</property>
+                        <property name="receives-default">False</property>
+                        <property name="use-underline">True</property>
                         <property name="active">True</property>
-                        <property name="draw_indicator">True</property>
+                        <property name="draw-indicator">True</property>
                         <accessibility>
                           <relation type="label-for" target="days_value"/>
                         </accessibility>
                       </object>
                       <packing>
-                        <property name="left_attach">0</property>
-                        <property name="top_attach">0</property>
+                        <property name="left-attach">0</property>
+                        <property name="top-attach">0</property>
                       </packing>
                     </child>
                     <child>
                       <object class="GtkRadioButton" id="intervals">
                         <property name="label" translatable="yes" 
context="groupbydate|intervals">_Intervals:</property>
                         <property name="visible">True</property>
-                        <property name="can_focus">True</property>
-                        <property name="receives_default">False</property>
+                        <property name="can-focus">True</property>
+                        <property name="receives-default">False</property>
                         <property name="valign">start</property>
-                        <property name="use_underline">True</property>
-                        <property name="draw_indicator">True</property>
+                        <property name="use-underline">True</property>
+                        <property name="draw-indicator">True</property>
                         <property name="group">days</property>
                         <accessibility>
                           <relation type="label-for" target="interval_list"/>
                         </accessibility>
                       </object>
                       <packing>
-                        <property name="left_attach">0</property>
-                        <property name="top_attach">1</property>
+                        <property name="left-attach">0</property>
+                        <property name="top-attach">1</property>
                       </packing>
                     </child>
                     <child>
                       <object class="GtkSpinButton" id="days_value">
                         <property name="visible">True</property>
-                        <property name="can_focus">True</property>
-                        <property name="adjustment">adjustment1</property>
+                        <property name="can-focus">True</property>
                         <property name="truncate-multiline">True</property>
+                        <property name="adjustment">adjustment1</property>
                         <accessibility>
                           <relation type="labelled-by" target="days"/>
                         </accessibility>
                       </object>
                       <packing>
-                        <property name="left_attach">1</property>
-                        <property name="top_attach">0</property>
+                        <property name="left-attach">1</property>
+                        <property name="top-attach">0</property>
                       </packing>
                     </child>
                     <child>
                       <object class="GtkScrolledWindow">
                         <property name="visible">True</property>
-                        <property name="can_focus">True</property>
+                        <property name="can-focus">True</property>
                         <property name="hexpand">True</property>
                         <property name="vexpand">True</property>
-                        <property name="hscrollbar_policy">never</property>
-                        <property name="vscrollbar_policy">never</property>
-                        <property name="shadow_type">in</property>
+                        <property name="hscrollbar-policy">never</property>
+                        <property name="vscrollbar-policy">never</property>
+                        <property name="shadow-type">in</property>
                         <child>
                           <object class="GtkTreeView" id="interval_list">
                             <property name="visible">True</property>
-                            <property name="can_focus">True</property>
-                            <property name="receives_default">True</property>
+                            <property name="can-focus">True</property>
+                            <property name="receives-default">True</property>
                             <property name="hexpand">True</property>
                             <property name="vexpand">True</property>
                             <property name="model">liststore1</property>
-                            <property name="headers_visible">False</property>
-                            <property name="search_column">0</property>
-                            <property name="show_expanders">False</property>
+                            <property name="headers-visible">False</property>
+                            <property name="search-column">0</property>
+                            <property name="show-expanders">False</property>
                             <child internal-child="selection">
                               <object class="GtkTreeSelection" id="Macro 
Library List-selection2"/>
                             </child>
@@ -397,8 +406,8 @@
                         </child>
                       </object>
                       <packing>
-                        <property name="left_attach">1</property>
-                        <property name="top_attach">1</property>
+                        <property name="left-attach">1</property>
+                        <property name="top-attach">1</property>
                       </packing>
                     </child>
                   </object>
@@ -406,7 +415,7 @@
                 <child type="label">
                   <object class="GtkLabel" id="label3">
                     <property name="visible">True</property>
-                    <property name="can_focus">False</property>
+                    <property name="can-focus">False</property>
                     <property name="label" translatable="yes" 
context="groupbydate|label3">Group by</property>
                     <attributes>
                       <attribute name="weight" value="bold"/>
commit 2cd7bf146077cd598ad52f8d8cd860535f8a9e5c
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Thu May 29 15:43:15 2025 +0200
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Fri May 30 07:46:40 2025 +0200

    tdf#130857 qt weld: Prepare for more conditional UI file support
    
    Various .ui files are used for non-toplevel widgets
    that can be used from different dialogs/toplevels.
    
    Using native Qt widgets for these is only supported
    in case the whole dialog is a native Qt dialog,
    because proper functioning depends on a QWidget
    hierarchy.
    A SalInstanceWidget parent doesn't support
    QtInstanceWidget children but relies on them being
    SalInstanceWidgets as well (i.e. vcl::Window based).
    
    Prepare for supporting more .ui files conditionally,
    i.e. only when the parent is a QWidget as well.
    
    This generalizes the solution introduced with
    
        commit 9a03fb9266440013eef5f8cd11cc1e5478706496
        Author: Michael Weghorn <m.wegh...@posteo.de>
        Date:   Mon May 12 14:05:23 2025 +0200
    
            tdf#130857 qt weld: Support new Welcome dialog
    
    a bit to use a set of .ui files as well, so more
    can easily be added in the future.
    
    Change-Id: I0174d306187ed65f49f165b9eff7f2f2ea05a3a5
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/186017
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>
    Tested-by: Jenkins

diff --git a/vcl/qt5/QtInstanceBuilder.cxx b/vcl/qt5/QtInstanceBuilder.cxx
index ffd61b79e2f1..802eb0fc1ca8 100644
--- a/vcl/qt5/QtInstanceBuilder.cxx
+++ b/vcl/qt5/QtInstanceBuilder.cxx
@@ -162,12 +162,17 @@ bool QtInstanceBuilder::IsUIFileSupported(const OUString& 
rUIFile, const weld::W
         u"writerperfect/ui/exportepub.ui"_ustr,
     };
 
+    // These UI files are used in multiple places and only supported within
+    // native Qt dialogs/widgets
+    static std::unordered_set<OUString> aSupportedWithQtParent = {
+        u"cui/ui/appearance.ui"_ustr,
+    };
+
     if (aSupportedUIFiles.contains(rUIFile))
         return true;
 
-    // this tab page is currently only supported in the "Welcome" dialog, but
-    // not in the "Tools" -> "Options" dialog that's not using native Qt 
widgets yet
-    return rUIFile == u"cui/ui/appearance.ui" && dynamic_cast<const 
QtInstanceWidget*>(pParent);
+    return aSupportedWithQtParent.contains(rUIFile)
+           && dynamic_cast<const QtInstanceWidget*>(pParent);
 }
 
 std::unique_ptr<weld::MessageDialog> 
QtInstanceBuilder::weld_message_dialog(const OUString& id)
commit be3e1d32a85eeb2ebb6a83a42d62329b1607e5f2
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Thu May 29 15:32:54 2025 +0200
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Fri May 30 07:46:32 2025 +0200

    tdf#130857 qt weld: Introduce QtInstanceCalendar
    
    This is the weld::Calendar implementation using
    a native QCalendarWidget.
    
    It's not used in practice yet, as no dialog using
    it has been declared as supported yet, but this
    is one step in preparation of doing so in the future.
    
    Change-Id: I8a65701a1aa477a04dcf66f63df7864db0b0cdf4
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/186010
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>

diff --git a/vcl/CustomTarget_qt5_moc.mk b/vcl/CustomTarget_qt5_moc.mk
index 4a10cfd2b0f5..2a9ede0947ba 100644
--- a/vcl/CustomTarget_qt5_moc.mk
+++ b/vcl/CustomTarget_qt5_moc.mk
@@ -20,6 +20,7 @@ $(call gb_CustomTarget_get_target,vcl/qt5) : \
        $(gb_CustomTarget_workdir)/vcl/qt5/QtInstance.moc \
        $(gb_CustomTarget_workdir)/vcl/qt5/QtInstanceAssistant.moc \
        $(gb_CustomTarget_workdir)/vcl/qt5/QtInstanceBox.moc \
+       $(gb_CustomTarget_workdir)/vcl/qt5/QtInstanceCalendar.moc \
        $(gb_CustomTarget_workdir)/vcl/qt5/QtInstanceCheckButton.moc \
        $(gb_CustomTarget_workdir)/vcl/qt5/QtInstanceComboBox.moc \
        $(gb_CustomTarget_workdir)/vcl/qt5/QtInstanceContainer.moc \
diff --git a/vcl/CustomTarget_qt6_moc.mk b/vcl/CustomTarget_qt6_moc.mk
index 9dee1cbb298e..08638dfc7d73 100644
--- a/vcl/CustomTarget_qt6_moc.mk
+++ b/vcl/CustomTarget_qt6_moc.mk
@@ -20,6 +20,7 @@ $(call gb_CustomTarget_get_target,vcl/qt6) : \
        $(gb_CustomTarget_workdir)/vcl/qt6/QtInstance.moc \
        $(gb_CustomTarget_workdir)/vcl/qt6/QtInstanceAssistant.moc \
        $(gb_CustomTarget_workdir)/vcl/qt6/QtInstanceBox.moc \
+       $(gb_CustomTarget_workdir)/vcl/qt6/QtInstanceCalendar.moc \
        $(gb_CustomTarget_workdir)/vcl/qt6/QtInstanceCheckButton.moc \
        $(gb_CustomTarget_workdir)/vcl/qt6/QtInstanceComboBox.moc \
        $(gb_CustomTarget_workdir)/vcl/qt6/QtInstanceContainer.moc \
diff --git a/vcl/Library_vclplug_qt5.mk b/vcl/Library_vclplug_qt5.mk
index 5f1a31a8f617..e21175a70423 100644
--- a/vcl/Library_vclplug_qt5.mk
+++ b/vcl/Library_vclplug_qt5.mk
@@ -103,6 +103,7 @@ $(eval $(call gb_Library_add_exception_objects,vclplug_qt5,\
     vcl/qt5/QtInstanceBox \
     vcl/qt5/QtInstanceBuilder \
     vcl/qt5/QtInstanceButton \
+    vcl/qt5/QtInstanceCalendar \
     vcl/qt5/QtInstanceCheckButton \
     vcl/qt5/QtInstanceContainer \
     vcl/qt5/QtInstanceComboBox \
diff --git a/vcl/Library_vclplug_qt6.mk b/vcl/Library_vclplug_qt6.mk
index 5e40085748a9..efab1cb133df 100644
--- a/vcl/Library_vclplug_qt6.mk
+++ b/vcl/Library_vclplug_qt6.mk
@@ -102,6 +102,7 @@ $(eval $(call gb_Library_add_exception_objects,vclplug_qt6,\
     vcl/qt6/QtInstanceBox \
     vcl/qt6/QtInstanceBuilder \
     vcl/qt6/QtInstanceButton \
+    vcl/qt6/QtInstanceCalendar \
     vcl/qt6/QtInstanceCheckButton \
     vcl/qt6/QtInstanceComboBox \
     vcl/qt6/QtInstanceContainer \
diff --git a/vcl/inc/qt5/QtInstanceBuilder.hxx 
b/vcl/inc/qt5/QtInstanceBuilder.hxx
index dc1a9da87457..7cfbee5db926 100644
--- a/vcl/inc/qt5/QtInstanceBuilder.hxx
+++ b/vcl/inc/qt5/QtInstanceBuilder.hxx
@@ -55,7 +55,7 @@ public:
     virtual std::unique_ptr<weld::LevelBar> weld_level_bar(const OUString& 
rId) override;
     virtual std::unique_ptr<weld::Spinner> weld_spinner(const OUString&) 
override;
     virtual std::unique_ptr<weld::Image> weld_image(const OUString& rId) 
override;
-    virtual std::unique_ptr<weld::Calendar> weld_calendar(const OUString&) 
override;
+    virtual std::unique_ptr<weld::Calendar> weld_calendar(const OUString& rId) 
override;
     virtual std::unique_ptr<weld::Entry> weld_entry(const OUString& rId) 
override;
     virtual std::unique_ptr<weld::SpinButton> weld_spin_button(const OUString& 
rId) override;
     virtual std::unique_ptr<weld::MetricSpinButton>
diff --git a/vcl/inc/qt5/QtInstanceCalendar.hxx 
b/vcl/inc/qt5/QtInstanceCalendar.hxx
new file mode 100644
index 000000000000..b3b1fe51a0d8
--- /dev/null
+++ b/vcl/inc/qt5/QtInstanceCalendar.hxx
@@ -0,0 +1,33 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; 
fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#pragma once
+
+#include "QtInstanceWidget.hxx"
+
+#include <QtWidgets/QCalendarWidget>
+
+class QtInstanceCalendar : public QtInstanceWidget, public virtual 
weld::Calendar
+{
+    Q_OBJECT
+
+    QCalendarWidget* m_pCalendarWidget;
+
+public:
+    QtInstanceCalendar(QCalendarWidget* pCalendarWidget);
+
+    virtual void set_date(const Date& rDate) override;
+    virtual Date get_date() const override;
+
+private Q_SLOTS:
+    void handleActivated();
+    void handleSelectionChanged();
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s 
cinkeys+=0=break: */
diff --git a/vcl/inc/qt5/QtTools.hxx b/vcl/inc/qt5/QtTools.hxx
index 7e4a2088fb1b..4c2058c15dcb 100644
--- a/vcl/inc/qt5/QtTools.hxx
+++ b/vcl/inc/qt5/QtTools.hxx
@@ -21,6 +21,7 @@
 
 #include <config_vclplug.h>
 
+#include <QtCore/QDate>
 #include <QtCore/QPoint>
 #include <QtCore/QRect>
 #include <QtCore/QSize>
@@ -32,6 +33,7 @@
 #include <rtl/string.hxx>
 #include <rtl/ustring.hxx>
 #include <tools/color.hxx>
+#include <tools/date.hxx>
 #include <tools/gen.hxx>
 #include <vcl/bitmap/BitmapTypes.hxx>
 #include <vcl/event.hxx>
@@ -85,6 +87,13 @@ inline Color toColor(const QColor& rColor)
     return Color(rColor.red(), rColor.green(), rColor.blue());
 }
 
+inline QDate toQDate(const Date& rDate)
+{
+    return QDate(rDate.GetYear(), rDate.GetMonth(), rDate.GetDay());
+}
+
+inline Date toDate(const QDate& rDate) { return Date(rDate.day(), 
rDate.month(), rDate.year()); }
+
 Qt::DropActions toQtDropActions(sal_Int8 dragOperation);
 sal_Int8 toVclDropActions(Qt::DropActions dragOperation);
 sal_Int8 toVclDropAction(Qt::DropAction dragOperation);
diff --git a/vcl/inc/qt6/QtInstanceCalendar.hxx 
b/vcl/inc/qt6/QtInstanceCalendar.hxx
new file mode 100644
index 000000000000..2a91da37490b
--- /dev/null
+++ b/vcl/inc/qt6/QtInstanceCalendar.hxx
@@ -0,0 +1,12 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; 
fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include "../qt5/QtInstanceCalendar.hxx"
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s 
cinkeys+=0=break: */
diff --git a/vcl/qt5/QtBuilder.cxx b/vcl/qt5/QtBuilder.cxx
index 0087487bb747..74c0a58bcb66 100644
--- a/vcl/qt5/QtBuilder.cxx
+++ b/vcl/qt5/QtBuilder.cxx
@@ -29,6 +29,7 @@
 #include <QtWidgets/QActionGroup>
 #endif
 #include <QtWidgets/QButtonGroup>
+#include <QtWidgets/QCalendarWidget>
 #include <QtWidgets/QCheckBox>
 #include <QtWidgets/QComboBox>
 #include <QtWidgets/QDialog>
@@ -200,6 +201,10 @@ QObject* QtBuilder::makeObject(QObject* pParent, 
std::u16string_view sName, std:
         setButtonProperties(*pButton, rMap, pParentWidget);
         pObject = pButton;
     }
+    else if (sName == u"GtkCalendar")
+    {
+        pObject = new QCalendarWidget(pParentWidget);
+    }
     else if (sName == u"GtkCheckButton")
     {
         QCheckBox* pCheckBox = new QCheckBox(pParentWidget);
diff --git a/vcl/qt5/QtInstanceBuilder.cxx b/vcl/qt5/QtInstanceBuilder.cxx
index e96ce889f8ba..ffd61b79e2f1 100644
--- a/vcl/qt5/QtInstanceBuilder.cxx
+++ b/vcl/qt5/QtInstanceBuilder.cxx
@@ -15,6 +15,7 @@
 #include <QtBuilder.hxx>
 #include <QtInstanceAssistant.hxx>
 #include <QtInstanceBox.hxx>
+#include <QtInstanceCalendar.hxx>
 #include <QtInstanceCheckButton.hxx>
 #include <QtInstanceComboBox.hxx>
 #include <QtInstanceDrawingArea.hxx>
@@ -359,10 +360,12 @@ std::unique_ptr<weld::Image> 
QtInstanceBuilder::weld_image(const OUString& rId)
     return xRet;
 }
 
-std::unique_ptr<weld::Calendar> QtInstanceBuilder::weld_calendar(const 
OUString&)
+std::unique_ptr<weld::Calendar> QtInstanceBuilder::weld_calendar(const 
OUString& rId)
 {
-    assert(false && "Not implemented yet");
-    return nullptr;
+    QCalendarWidget* pCalendarWidget = m_xBuilder->get<QCalendarWidget>(rId);
+    std::unique_ptr<weld::Calendar> xRet(
+        pCalendarWidget ? 
std::make_unique<QtInstanceCalendar>(pCalendarWidget) : nullptr);
+    return xRet;
 }
 
 std::unique_ptr<weld::Entry> QtInstanceBuilder::weld_entry(const OUString& rId)
diff --git a/vcl/qt5/QtInstanceCalendar.cxx b/vcl/qt5/QtInstanceCalendar.cxx
new file mode 100644
index 000000000000..dd85a8740cdc
--- /dev/null
+++ b/vcl/qt5/QtInstanceCalendar.cxx
@@ -0,0 +1,54 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; 
fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include <QtInstanceCalendar.hxx>
+#include <QtInstanceCalendar.moc>
+
+QtInstanceCalendar::QtInstanceCalendar(QCalendarWidget* pCalendarWidget)
+    : QtInstanceWidget(pCalendarWidget)
+    , m_pCalendarWidget(pCalendarWidget)
+{
+    assert(m_pCalendarWidget);
+
+    connect(m_pCalendarWidget, &QCalendarWidget::activated, this,
+            &QtInstanceCalendar::handleActivated);
+    connect(m_pCalendarWidget, &QCalendarWidget::selectionChanged, this,
+            &QtInstanceCalendar::handleSelectionChanged);
+}
+
+void QtInstanceCalendar::set_date(const Date& rDate)
+{
+    SolarMutexGuard g;
+
+    GetQtInstance().RunInMainThread([&] { 
m_pCalendarWidget->setSelectedDate(toQDate(rDate)); });
+}
+
+Date QtInstanceCalendar::get_date() const
+{
+    SolarMutexGuard g;
+
+    Date aDate(Date::DateInitEmpty::EMPTY);
+    GetQtInstance().RunInMainThread([&] { aDate = 
toDate(m_pCalendarWidget->selectedDate()); });
+
+    return aDate;
+}
+
+void QtInstanceCalendar::handleActivated()
+{
+    SolarMutexGuard g;
+    signal_activated();
+}
+
+void QtInstanceCalendar::handleSelectionChanged()
+{
+    SolarMutexGuard g;
+    signal_selected();
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s 
cinkeys+=0=break: */
diff --git a/vcl/qt6/QtInstanceCalendar.cxx b/vcl/qt6/QtInstanceCalendar.cxx
new file mode 100644
index 000000000000..e1cab21a200a
--- /dev/null
+++ b/vcl/qt6/QtInstanceCalendar.cxx
@@ -0,0 +1,12 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; 
fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include "../qt5/QtInstanceCalendar.cxx"
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s 
cinkeys+=0=break: */

Reply via email to