Solved Tri states checkable button
-
Hello,
I would like to make a Tri states checkable button.
How can I achieve this ?My goal here is to have a picture and when the user click on it, it change and show different functions and I want to be able to switch between 3 different mode at only one place. Maybe I have a bad idea of how doing it, if so please tell me the best solution.
Thanks
-
Hi,
use a QCheckBox it is a tri-state button. -
@Alain38-0
What does the checkState() method on this kind of checkbox ? -
If you create a QCheckBox, and then set it as tri-state button (you have to call the function setTriState as explained in the class documentation), the checkState returns three possible values: Checked, Unchecked, and PartiallyChecked. For more details, please refer to the documentation of QCheckBox
-
@Alain38-0
Thank you for your answer and your time.If you still have time for me is there a way to make a X-states button/checkbox ? (Just because I'm interested)
-
QCheckBox is derived from QAbstractButton. As QAbstractButton is normally for two-states buttons and QCheckBox adds a new state, I think that it should be possible to create its own x-state button. For this you will have to override the protected function nextCheckState.
-
Ok if one day I have to do something like this I'll try. Thank you