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/QtInstanceSpinner.hxx |   27 +++++++++++++++++++++++++++
 vcl/inc/qt6/QtInstanceSpinner.hxx |   12 ++++++++++++
 vcl/qt5/QtBuilder.cxx             |   19 +++++++++++++------
 vcl/qt5/QtInstanceBuilder.cxx     |   14 +++++++++++---
 vcl/qt5/QtInstanceSpinner.cxx     |   29 +++++++++++++++++++++++++++++
 vcl/qt6/QtInstanceSpinner.cxx     |   12 ++++++++++++
 11 files changed, 109 insertions(+), 10 deletions(-)

New commits:
commit 59f363f705583529af17fc43d314a7e47bbe2657
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Sat Jul 26 09:54:39 2025 +0200
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Tue Jul 29 10:01:00 2025 +0200

    tdf#130857 qt weld: Support widget test dialog
    
    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.
    
    This dialogs uses a weld::Spinner, i.e. uses QtInstanceSpinner
    newly introduced in previous commit
    
        Change-Id: I555b6b21d1a610aae4deecf7402ef9ebc00f0863
        Author: Michael Weghorn <m.wegh...@posteo.de>
        Date:   Sat Jul 26 09:49:33 2025 +0200
    
            tdf#130857 qt weld: Introduce QtInstanceSpinner
    
    To trigger the dialog:
    
    * in "Tools" -> "Customize", set a keyboard shortcut for
      function/UNO command ".uno:WidgetTestDialog"
    * close the dialog and activat the shortcut
    
    Change-Id: Ic36750aa2cc2a593063fcea9c0e77bc38705e7dc
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/188392
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>
    Tested-by: Jenkins

diff --git a/vcl/qt5/QtInstanceBuilder.cxx b/vcl/qt5/QtInstanceBuilder.cxx
index c74fc5677027..580312c3e882 100644
--- a/vcl/qt5/QtInstanceBuilder.cxx
+++ b/vcl/qt5/QtInstanceBuilder.cxx
@@ -97,6 +97,7 @@ bool QtInstanceBuilder::IsUIFileSupported(const OUString& 
rUIFile, const weld::W
         u"cui/ui/uitabpage.ui"_ustr,
         u"cui/ui/welcomedialog.ui"_ustr,
         u"cui/ui/whatsnewtabpage.ui"_ustr,
+        u"cui/ui/widgettestdialog.ui"_ustr,
         u"cui/ui/zoomdialog.ui"_ustr,
         u"dbaccess/ui/savedialog.ui"_ustr,
         u"dbaccess/ui/tabledesignsavemodifieddialog.ui"_ustr,
commit 6835fbc81e87465034096a73bebb83e0a49fce42
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Sat Jul 26 09:49:33 2025 +0200
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Tue Jul 29 10:00:54 2025 +0200

    tdf#130857 qt weld: Introduce QtInstanceSpinner
    
    This is the weld::Spinner implementation using a
    native Qt widget.
    
    There seems to be no direct equivalent for GTK's
    GtkSpinner, whose doc [1] says:
    
    > A GtkSpinner widget displays an icon-size spinning animation. It is
    > often used as an alternative to a GtkProgressBar for displaying
    > indefinite activity, instead of actual progress.
    
    QProgressBar does support an undeterminate state however.
    Quoting from the QProgressBar::setRange doc [2]:
    
    > The QProgressBar can be set to undetermined state by
    > using setRange(0, 0).
    
    Use a QProgressBar in undeterminate state, and simply
    show/hide the widget in the weld::Spinner::start
    and weld::Spinner::stop overrides.
    
    [1] https://docs.gtk.org/gtk3/class.Spinner.html
    [2] https://doc.qt.io/qt-6/qprogressbar.html#setRange
    
    Change-Id: I555b6b21d1a610aae4deecf7402ef9ebc00f0863
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/188391
    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 2f3e22ac76c3..8a27acd7656e 100644
--- a/vcl/CustomTarget_qt5_moc.mk
+++ b/vcl/CustomTarget_qt5_moc.mk
@@ -49,6 +49,7 @@ $(call gb_CustomTarget_get_target,vcl/qt5) : \
        $(gb_CustomTarget_workdir)/vcl/qt5/QtInstanceScrollbar.moc \
        $(gb_CustomTarget_workdir)/vcl/qt5/QtInstanceScrolledWindow.moc \
        $(gb_CustomTarget_workdir)/vcl/qt5/QtInstanceSpinButton.moc \
+       $(gb_CustomTarget_workdir)/vcl/qt5/QtInstanceSpinner.moc \
        $(gb_CustomTarget_workdir)/vcl/qt5/QtInstanceTextView.moc \
        $(gb_CustomTarget_workdir)/vcl/qt5/QtInstanceToggleButton.moc \
        $(gb_CustomTarget_workdir)/vcl/qt5/QtInstanceToolbar.moc \
diff --git a/vcl/CustomTarget_qt6_moc.mk b/vcl/CustomTarget_qt6_moc.mk
index 73dd8e279db6..9402a72d6fce 100644
--- a/vcl/CustomTarget_qt6_moc.mk
+++ b/vcl/CustomTarget_qt6_moc.mk
@@ -49,6 +49,7 @@ $(call gb_CustomTarget_get_target,vcl/qt6) : \
        $(gb_CustomTarget_workdir)/vcl/qt6/QtInstanceScrollbar.moc \
        $(gb_CustomTarget_workdir)/vcl/qt6/QtInstanceScrolledWindow.moc \
        $(gb_CustomTarget_workdir)/vcl/qt6/QtInstanceSpinButton.moc \
+       $(gb_CustomTarget_workdir)/vcl/qt6/QtInstanceSpinner.moc \
        $(gb_CustomTarget_workdir)/vcl/qt6/QtInstanceTextView.moc \
        $(gb_CustomTarget_workdir)/vcl/qt6/QtInstanceToggleButton.moc \
        $(gb_CustomTarget_workdir)/vcl/qt6/QtInstanceToolbar.moc \
diff --git a/vcl/Library_vclplug_qt5.mk b/vcl/Library_vclplug_qt5.mk
index 858d400b49ec..75f09754b893 100644
--- a/vcl/Library_vclplug_qt5.mk
+++ b/vcl/Library_vclplug_qt5.mk
@@ -132,6 +132,7 @@ $(eval $(call gb_Library_add_exception_objects,vclplug_qt5,\
     vcl/qt5/QtInstanceScrollbar \
     vcl/qt5/QtInstanceScrolledWindow \
     vcl/qt5/QtInstanceSpinButton \
+    vcl/qt5/QtInstanceSpinner \
     vcl/qt5/QtInstanceTextView \
     vcl/qt5/QtInstanceToggleButton \
     vcl/qt5/QtInstanceToolbar \
diff --git a/vcl/Library_vclplug_qt6.mk b/vcl/Library_vclplug_qt6.mk
index 74bcf1289186..73b8856c30f6 100644
--- a/vcl/Library_vclplug_qt6.mk
+++ b/vcl/Library_vclplug_qt6.mk
@@ -131,6 +131,7 @@ $(eval $(call gb_Library_add_exception_objects,vclplug_qt6,\
     vcl/qt6/QtInstanceScrollbar \
     vcl/qt6/QtInstanceScrolledWindow \
     vcl/qt6/QtInstanceSpinButton \
+    vcl/qt6/QtInstanceSpinner \
     vcl/qt6/QtInstanceTextView \
     vcl/qt6/QtInstanceToggleButton \
     vcl/qt6/QtInstanceToolbar \
diff --git a/vcl/inc/qt5/QtInstanceBuilder.hxx 
b/vcl/inc/qt5/QtInstanceBuilder.hxx
index f5eb9d94e862..c515394cd5fd 100644
--- a/vcl/inc/qt5/QtInstanceBuilder.hxx
+++ b/vcl/inc/qt5/QtInstanceBuilder.hxx
@@ -53,7 +53,7 @@ public:
     virtual std::unique_ptr<weld::Scale> weld_scale(const OUString& rId) 
override;
     virtual std::unique_ptr<weld::ProgressBar> weld_progress_bar(const 
OUString& rId) override;
     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::Spinner> weld_spinner(const OUString& rId) 
override;
     virtual std::unique_ptr<weld::Image> weld_image(const OUString& rId) 
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;
diff --git a/vcl/inc/qt5/QtInstanceSpinner.hxx 
b/vcl/inc/qt5/QtInstanceSpinner.hxx
new file mode 100644
index 000000000000..9637d4390d61
--- /dev/null
+++ b/vcl/inc/qt5/QtInstanceSpinner.hxx
@@ -0,0 +1,27 @@
+/* -*- 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/QProgressBar>
+
+class QtInstanceSpinner : public QtInstanceWidget, public virtual weld::Spinner
+{
+    Q_OBJECT
+
+public:
+    QtInstanceSpinner(QProgressBar* pProgressBar);
+
+    virtual void start() override;
+    virtual void stop() override;
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s 
cinkeys+=0=break: */
diff --git a/vcl/inc/qt6/QtInstanceSpinner.hxx 
b/vcl/inc/qt6/QtInstanceSpinner.hxx
new file mode 100644
index 000000000000..9e76637e9eef
--- /dev/null
+++ b/vcl/inc/qt6/QtInstanceSpinner.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/QtInstanceSpinner.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 a76b857b2ba9..d954fadba25a 100644
--- a/vcl/qt5/QtBuilder.cxx
+++ b/vcl/qt5/QtBuilder.cxx
@@ -359,6 +359,13 @@ QObject* QtBuilder::makeObject(QObject* pParent, 
std::u16string_view sName, std:
         setSpinButtonProperties(*pSpinBox, rMap);
         pObject = pSpinBox;
     }
+    else if (sName == u"GtkSpinner")
+    {
+        // use a QProgressBar in undetermined state (i.e. with range [0, 0])
+        QProgressBar* pProgressBar = new QProgressBar(pParentWidget);
+        pProgressBar->setRange(0, 0);
+        pObject = pProgressBar;
+    }
     else if (sName == u"GtkTextView")
     {
         QPlainTextEdit* pTextEdit = new QPlainTextEdit(pParentWidget);
diff --git a/vcl/qt5/QtInstanceBuilder.cxx b/vcl/qt5/QtInstanceBuilder.cxx
index 1d01b3e3cf18..c74fc5677027 100644
--- a/vcl/qt5/QtInstanceBuilder.cxx
+++ b/vcl/qt5/QtInstanceBuilder.cxx
@@ -40,6 +40,7 @@
 #include <QtInstanceScrollbar.hxx>
 #include <QtInstanceScrolledWindow.hxx>
 #include <QtInstanceSpinButton.hxx>
+#include <QtInstanceSpinner.hxx>
 #include <QtInstanceTextView.hxx>
 #include <QtInstanceToggleButton.hxx>
 #include <QtInstanceToolbar.hxx>
@@ -451,10 +452,16 @@ std::unique_ptr<weld::LevelBar> 
QtInstanceBuilder::weld_level_bar(const OUString
     return xRet;
 }
 
-std::unique_ptr<weld::Spinner> QtInstanceBuilder::weld_spinner(const OUString&)
+std::unique_ptr<weld::Spinner> QtInstanceBuilder::weld_spinner(const OUString& 
rId)
 {
-    assert(false && "Not implemented yet");
-    return nullptr;
+    SolarMutexGuard g;
+
+    std::unique_ptr<weld::Spinner> xRet;
+    GetQtInstance().RunInMainThread([&] {
+        if (QProgressBar* pProgressBar = m_xBuilder->get<QProgressBar>(rId))
+            xRet = std::make_unique<QtInstanceSpinner>(pProgressBar);
+    });
+    return xRet;
 }
 
 std::unique_ptr<weld::Image> QtInstanceBuilder::weld_image(const OUString& rId)
diff --git a/vcl/qt5/QtInstanceSpinner.cxx b/vcl/qt5/QtInstanceSpinner.cxx
new file mode 100644
index 000000000000..d7c54f844baa
--- /dev/null
+++ b/vcl/qt5/QtInstanceSpinner.cxx
@@ -0,0 +1,29 @@
+/* -*- 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 <QtInstanceSpinner.hxx>
+#include <QtInstanceSpinner.moc>
+
+QtInstanceSpinner::QtInstanceSpinner(QProgressBar* pProgressBar)
+    : QtInstanceWidget(pProgressBar)
+{
+    assert(pProgressBar);
+
+    // This implementation relies on using a QProgressBar in undeterminate 
state,
+    // i.e. with range [0, 0] and only shows/hides that progress bar
+    // to make the animation (in)visible.
+    assert(pProgressBar->minimum() == 0 && pProgressBar->maximum() == 0
+           && "Progressbar is not in undeterminate state");
+}
+
+void QtInstanceSpinner::start() { show(); }
+
+void QtInstanceSpinner::stop() { hide(); }
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s 
cinkeys+=0=break: */
diff --git a/vcl/qt6/QtInstanceSpinner.cxx b/vcl/qt6/QtInstanceSpinner.cxx
new file mode 100644
index 000000000000..0836d75675fe
--- /dev/null
+++ b/vcl/qt6/QtInstanceSpinner.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/QtInstanceSpinner.cxx"
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s 
cinkeys+=0=break: */
commit fb997573eaec84287fa69ed1bda6a4513d257204
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Sat Jul 26 09:09:22 2025 +0200
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Tue Jul 29 10:00:48 2025 +0200

    tdf#130857 qt weld: Move "GtkScale" to its alphabetical place
    
    ... to make it easier to find the relevant
    case when reading code.
    
    Change-Id: Ib7f7f864ab5dc6f20008904d19b2490ba6c9fae6
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/188390
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>

diff --git a/vcl/qt5/QtBuilder.cxx b/vcl/qt5/QtBuilder.cxx
index 27b9e1f0b6b0..a76b857b2ba9 100644
--- a/vcl/qt5/QtBuilder.cxx
+++ b/vcl/qt5/QtBuilder.cxx
@@ -324,6 +324,12 @@ QObject* QtBuilder::makeObject(QObject* pParent, 
std::u16string_view sName, std:
         extractRadioButtonGroup(rId, rMap);
         pObject = pRadioButton;
     }
+    else if (sName == u"GtkScale")
+    {
+        QSlider* pSlider = new QSlider(pParentWidget);
+        setScaleProperties(*pSlider, rMap);
+        pObject = pSlider;
+    }
     else if (sName == u"GtkScrollbar")
     {
         pObject = new QScrollBar(pParentWidget);
@@ -341,12 +347,6 @@ QObject* QtBuilder::makeObject(QObject* pParent, 
std::u16string_view sName, std:
         pFrame->setFrameShape(bVertical ? QFrame::VLine : QFrame::HLine);
         pObject = pFrame;
     }
-    else if (sName == u"GtkScale")
-    {
-        QSlider* pSlider = new QSlider(pParentWidget);
-        setScaleProperties(*pSlider, rMap);
-        pObject = pSlider;
-    }
     else if (sName == u"GtkSeparatorToolItem")
     {
         QToolBar* pToolBar = qobject_cast<QToolBar*>(pParentWidget);

Reply via email to