3 State QPushbutton (solved)
-
I understood Qt Qpushbutton have 2 state: click and unclick. Is it possible to have additional state in QPushbutton?
How to achieve the third state?
-
Hi,
Do you mean something like QCheckBox's tristate property ?
-
How can this apply to qpushbutton?
-
You would need to create your own button from QAbstractButton and take some inspiration from QCheckBox. But first, why do you need a tristate push button ? It's not something that follows known guidelines
-
Many thanks for your expertise
-
@houmingc Even easier would be to make use of the nextCheckState() function. It allows you to create any number of states, see http://doc.qt.io/qt-5/qabstractbutton.html#nextCheckState
-
@Jakob that's what is used for QCheckBox internally, it's a good example on how to use nextCheckState