vcl/inc/qt5/QtInstanceMenuButton.hxx | 4 ++++ vcl/qt5/QtBuilder.cxx | 2 ++ vcl/qt5/QtInstanceBuilder.cxx | 2 ++ vcl/qt5/QtInstanceMenuButton.cxx | 19 +++++++++++++++++++ 4 files changed, 27 insertions(+)
New commits: commit e46ae24ec8e7bc256599c00d41815f71887e58d7 Author: Michael Weghorn <[email protected]> AuthorDate: Tue Feb 3 00:46:43 2026 +0100 Commit: Michael Weghorn <[email protected]> CommitDate: Tue Feb 3 10:53:48 2026 +0100 tdf#130857 qt weld: Support "Assign Macro" 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. The dialog can e.g. be triggered like this: * start Writer * "Insert" -> "Hyperlink" * switch to the "Document" tab * click on the "Events" button Change-Id: I76df029cbd012d96d6c3df59cf989414e87a22d0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/198576 Tested-by: Jenkins Reviewed-by: Michael Weghorn <[email protected]> diff --git a/vcl/qt5/QtInstanceBuilder.cxx b/vcl/qt5/QtInstanceBuilder.cxx index 66d363c3e425..75b7d643ccda 100644 --- a/vcl/qt5/QtInstanceBuilder.cxx +++ b/vcl/qt5/QtInstanceBuilder.cxx @@ -66,6 +66,7 @@ constexpr auto SUPPORTED_UI_FILES = frozen::make_unordered_set<std::u16string_vi u"cui/ui/certdialog.ui", u"cui/ui/comment.ui", u"cui/ui/editdictionarydialog.ui", + u"cui/ui/eventassigndialog.ui", u"cui/ui/fontfeaturesdialog.ui", u"cui/ui/fontfragment.ui", u"cui/ui/gallerytitledialog.ui", @@ -267,6 +268,7 @@ constexpr auto SUPPORTED_WITH_QT_PARENT = frozen::make_unordered_set<std::u16str u"cui/ui/additionsfragment.ui", u"cui/ui/appearance.ui", u"cui/ui/cellalignment.ui", + u"cui/ui/eventassignpage.ui", u"cui/ui/graphictestentry.ui", u"cui/ui/lineendstabpage.ui", u"cui/ui/linetabpage.ui", commit a32d6ad32fa4665b6cc7b381bb45187db2db9322 Author: Michael Weghorn <[email protected]> AuthorDate: Mon Feb 2 23:58:29 2026 +0100 Commit: Michael Weghorn <[email protected]> CommitDate: Tue Feb 3 10:53:40 2026 +0100 tdf#130857 qt weld: Show text for menu buttons For the QToolButton objects created for "GtkMenuButton" objects in .ui files, set the toolbutton style [1] to Qt::ToolButtonTextBesideIcon instead of the default of Qt::ToolButtonIconOnly when the text is non-empty, so it actually gets displayed. Keep the style of Qt::ToolButtonIconOnly if the text is empty, to avoid any unnecessary space getting reserved/used otherwise. (The latter was seen e.g. with the Fusion style shipped with Qt while the KDE Breeze style wouldn't use extra space in either case for empty text.) This makes the text for the current color show up in Calc's "Create Scenario" dialog newly supported since commit f984b7f6de2c9cb86f256fb670d309788f1ce38d Author: Michael Weghorn <[email protected]> Date: Mon Feb 2 17:42:31 2026 +0100 tdf#130857 qt weld: Support Calc "Create Scenario" dialog [1] https://doc.qt.io/qt-6/qtoolbutton.html#toolButtonStyle-prop Change-Id: I61de2b72d517d1a9d17f142e95cd91e4da9fae33 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/198575 Tested-by: Jenkins Reviewed-by: Michael Weghorn <[email protected]> diff --git a/vcl/inc/qt5/QtInstanceMenuButton.hxx b/vcl/inc/qt5/QtInstanceMenuButton.hxx index 52b8af9c1839..1e6d14cce6be 100644 --- a/vcl/inc/qt5/QtInstanceMenuButton.hxx +++ b/vcl/inc/qt5/QtInstanceMenuButton.hxx @@ -23,6 +23,8 @@ class QtInstanceMenuButton : public QtInstanceToggleButton, public virtual weld: public: QtInstanceMenuButton(QToolButton* pButton); + virtual void set_label(const OUString& rText) override; + virtual void insert_item(int nPos, const OUString& rId, const OUString& rStr, const OUString* pIconName, VirtualDevice* pImageSurface, TriState eCheckRadioFalse) override; @@ -38,6 +40,8 @@ public: virtual void set_popover(weld::Widget* pPopover) override; + static void updateToolButtonStyle(QToolButton& rToolButton); + private: QMenu& getMenu() const; QAction* getAction(const OUString& rIdent) const; diff --git a/vcl/qt5/QtBuilder.cxx b/vcl/qt5/QtBuilder.cxx index 1e943ac18e6c..722a65bee3a1 100644 --- a/vcl/qt5/QtBuilder.cxx +++ b/vcl/qt5/QtBuilder.cxx @@ -12,6 +12,7 @@ #include <QtDoubleSpinBox.hxx> #include <QtExpander.hxx> #include <QtInstanceMenu.hxx> +#include <QtInstanceMenuButton.hxx> #include <QtInstanceMessageDialog.hxx> #include <QtInstanceNotebook.hxx> #include <QtInstanceTreeView.hxx> @@ -1005,6 +1006,7 @@ void QtBuilder::setMenuButtonProperties(QToolButton& rButton, stringmap& rProps, } setButtonProperties(rButton, rProps, pParentWidget); + QtInstanceMenuButton::updateToolButtonStyle(rButton); } void QtBuilder::setMessageDialogProperties(QMessageBox& rMessageBox, stringmap& rProps) diff --git a/vcl/qt5/QtInstanceMenuButton.cxx b/vcl/qt5/QtInstanceMenuButton.cxx index 02f53531e5a6..7ef9b30b0ebf 100644 --- a/vcl/qt5/QtInstanceMenuButton.cxx +++ b/vcl/qt5/QtInstanceMenuButton.cxx @@ -30,6 +30,12 @@ QtInstanceMenuButton::QtInstanceMenuButton(QToolButton* pButton) connect(m_pToolButton, &QToolButton::clicked, this, &QtInstanceMenuButton::handleButtonClicked); } +void QtInstanceMenuButton::set_label(const OUString& rText) +{ + QtInstanceToggleButton::set_label(rText); + updateToolButtonStyle(*m_pToolButton); +} + void QtInstanceMenuButton::insert_item(int nPos, const OUString& rId, const OUString& rStr, const OUString* pIconName, VirtualDevice* pImageSurface, TriState eCheckRadioFalse) @@ -141,6 +147,19 @@ void QtInstanceMenuButton::set_popover(weld::Widget* pPopover) m_pPopover = pPopoverWidget ? pPopoverWidget->getQWidget() : nullptr; } +void QtInstanceMenuButton::updateToolButtonStyle(QToolButton& rToolButton) +{ + SolarMutexGuard g; + + GetQtInstance().RunInMainThread([&] { + // set tool buttton style to ensure that text is shown when not empty, + // and no unnecessary space is reserved for text if it is empty + const Qt::ToolButtonStyle eStyle + = rToolButton.text().isEmpty() ? Qt::ToolButtonIconOnly : Qt::ToolButtonTextBesideIcon; + rToolButton.setToolButtonStyle(eStyle); + }); +} + QMenu& QtInstanceMenuButton::getMenu() const { QMenu* pMenu = m_pToolButton->menu();
