summaryrefslogtreecommitdiff
path: root/vcl/inc/qt6/QtInstanceToggleButton.hxx
diff options
context:
space:
mode:
authorMichael Weghorn <m.weghorn@posteo.de>2024-12-19 22:42:04 +0100
committerMichael Weghorn <m.weghorn@posteo.de>2024-12-20 07:15:11 +0100
commitfeaf080065bb904473cebfe31c0caf5539172ad0 (patch)
tree629a4a88794678a80a7b22c3eb68e68b30baf920 /vcl/inc/qt6/QtInstanceToggleButton.hxx
parenta441ba3f8eaff31c9d4ffdfbd0a251cdd838659c (diff)
tdf#130857 qt weld: Add a QtInstanceToggleButton
QAbstractButton, which is a base class for both, QPushButton and QToggleButton already provides the API needed for toggling. Use a QToggleButton, as the QPushButton doc [1] says: > As a general rule, use a push button when the application or dialog > window performs an action when the user clicks on it (such as Apply, > Cancel, Close and Help) and when the widget is supposed to have > a wide, rectangular shape with a text label. Small, typically square > buttons that change the state of the window rather than performing an > action (such as the buttons in the top-right corner of the QFileDialog) > are not command buttons, but tool buttons. Qt provides a special > class (QToolButton) for these buttons. > > If you need toggle behavior (see setCheckable()) or a button that > auto-repeats the activation signal when being pushed down like the > arrows in a scroll bar (see setAutoRepeat()), a command button is > probably not what you want. When in doubt, use a tool button. For the weld::Toggleable::{g,s}et_inconsistent overrides, it's a bit unclear to me what these should reasonably do for a button. Just let them trigger an assert for now. [1] https://doc.qt.io/qt-6/qpushbutton.html Change-Id: I51605ee02709bd78f77aeddf9c1993f930fcddd8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/178848 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
Diffstat (limited to 'vcl/inc/qt6/QtInstanceToggleButton.hxx')
-rw-r--r--vcl/inc/qt6/QtInstanceToggleButton.hxx12
1 files changed, 12 insertions, 0 deletions
diff --git a/vcl/inc/qt6/QtInstanceToggleButton.hxx b/vcl/inc/qt6/QtInstanceToggleButton.hxx
new file mode 100644
index 000000000000..83a0c7ecac77
--- /dev/null
+++ b/vcl/inc/qt6/QtInstanceToggleButton.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/QtInstanceToggleButton.hxx"
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */