# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- # # 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/. # $(eval $(call gb_JunitTest_JunitTest,sc_unoapi_6)) $(eval $(call gb_JunitTest_set_unoapi_test_defaults,sc_unoapi_6)) # vim: set noet sw=4 ts=4: type='text'> 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>
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>