vcl/inc/qt5/QtInstanceToggleButton.hxx | 3 +++ vcl/qt5/QtBuilder.cxx | 4 +++- vcl/qt5/QtInstanceToggleButton.cxx | 14 +++++++++++++- 3 files changed, 19 insertions(+), 2 deletions(-)
New commits: commit 1052f5cd508a33c4cea3a89d16f03b53ebe18b40 Author: Michael Weghorn <m.wegh...@posteo.de> AuthorDate: Sat Jan 18 18:58:30 2025 +0100 Commit: Michael Weghorn <m.wegh...@posteo.de> CommitDate: Sun Jan 19 21:35:24 2025 +0100 tdf#130857 qt weld: Signal when toggle button gets toggled Change-Id: Ia44a203a56a2b560a995446da2dd1c48a736bf60 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180467 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.wegh...@posteo.de> diff --git a/vcl/inc/qt5/QtInstanceToggleButton.hxx b/vcl/inc/qt5/QtInstanceToggleButton.hxx index 1f7566c4cd5f..c7da7454f4d6 100644 --- a/vcl/inc/qt5/QtInstanceToggleButton.hxx +++ b/vcl/inc/qt5/QtInstanceToggleButton.hxx @@ -25,6 +25,9 @@ public: virtual void set_inconsistent(bool bInconsistent) override; virtual bool get_inconsistent() const override; + +private Q_SLOTS: + void signalToggled(); }; /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/vcl/qt5/QtInstanceToggleButton.cxx b/vcl/qt5/QtInstanceToggleButton.cxx index 696a463a4d71..eca59aa95f4a 100644 --- a/vcl/qt5/QtInstanceToggleButton.cxx +++ b/vcl/qt5/QtInstanceToggleButton.cxx @@ -15,6 +15,8 @@ QtInstanceToggleButton::QtInstanceToggleButton(QAbstractButton* pButton) { assert(pButton); pButton->setCheckable(true); + + connect(&getButton(), &QAbstractButton::toggled, this, &QtInstanceToggleButton::signalToggled); } void QtInstanceToggleButton::set_active(bool bActive) @@ -46,4 +48,10 @@ bool QtInstanceToggleButton::get_inconsistent() const return false; }; +void QtInstanceToggleButton::signalToggled() +{ + SolarMutexGuard g; + signal_toggled(); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ commit 532618ae4e0f7bf8537c566421f59df473135d7d Author: Michael Weghorn <m.wegh...@posteo.de> AuthorDate: Sat Jan 18 18:51:59 2025 +0100 Commit: Michael Weghorn <m.wegh...@posteo.de> CommitDate: Sun Jan 19 21:35:17 2025 +0100 tdf#130857 qt weld: Support QtInstanceToggleButton::set_inconsistent(false) While QCheckBox supports an "inconsistent" state (see QCheckBox::tristate), I don't see that for QToolButton/QAbstractButton. Therefore, keep triggering an assert when trying to enable the indeterminate state (and reconsider what to do whenever encountering that example while working on support for more dialogs in the future). However, explicitly *disabling* the inconsistent state is fine: Don't do anything in that case. This gets called by the subclass, weld::Toggleable::set_state when setting the toggle button to checked or unchecked. [1] https://doc.qt.io/qt-6/qcheckbox.html#tristate-prop Change-Id: I4cb1475a4b5e3295ada7ed18dcbfcbf24baa53e9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180466 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.wegh...@posteo.de> diff --git a/vcl/qt5/QtInstanceToggleButton.cxx b/vcl/qt5/QtInstanceToggleButton.cxx index 38b1c40509fd..696a463a4d71 100644 --- a/vcl/qt5/QtInstanceToggleButton.cxx +++ b/vcl/qt5/QtInstanceToggleButton.cxx @@ -34,7 +34,11 @@ bool QtInstanceToggleButton::get_active() const return bActive; }; -void QtInstanceToggleButton::set_inconsistent(bool) { assert(false && "Not implemented yet"); }; +void QtInstanceToggleButton::set_inconsistent(bool bInconsistent) +{ + assert(!bInconsistent && "Inconsistent state not supported (yet?)"); + (void)bInconsistent; +}; bool QtInstanceToggleButton::get_inconsistent() const { commit a2f7ee2f7cdf39d48879843967983c4ba9debd5c Author: Michael Weghorn <m.wegh...@posteo.de> AuthorDate: Sat Jan 18 18:29:38 2025 +0100 Commit: Michael Weghorn <m.wegh...@posteo.de> CommitDate: Sun Jan 19 21:35:09 2025 +0100 tdf#130857 qt weld: Set GtkButton props for ToggleButton The GTK 3 GtkToggleButton [1] subclasses GtkButton [2]. Therefore, let QtBuilder apply the GtkButton properties for the QToolButton created for a "GtkToggleButton" object in a .ui file as well. This e.g. ensures that the icons for the toggle buttons in the "File" -> "Templates" -> "Manage Templates" dialog are set in a WIP branch where support for that dialog using native Qt widgets is declared. [1] https://docs.gtk.org/gtk3/class.ToggleButton.html [2] https://docs.gtk.org/gtk3/class.Button.html Change-Id: I1efedea116a799b8bc41fa81a27585af65893220 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180465 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.wegh...@posteo.de> diff --git a/vcl/qt5/QtBuilder.cxx b/vcl/qt5/QtBuilder.cxx index b84778288b60..30fddaa8ab7e 100644 --- a/vcl/qt5/QtBuilder.cxx +++ b/vcl/qt5/QtBuilder.cxx @@ -334,7 +334,9 @@ QObject* QtBuilder::makeObject(QObject* pParent, std::u16string_view sName, std: } else if (sName == u"GtkToggleButton") { - pObject = new QToolButton(pParentWidget); + QToolButton* pButton = new QToolButton(pParentWidget); + setButtonProperties(*pButton, rMap); + pObject = pButton; } else if (sName == u"GtkToolbar") {