Ask for create a tutorial for Switch Button

You may not know it, but QT provides a Switch button widget that is becoming quite common on GUIs these days. It replaces the QcheckButton and QRadioButton quite gracefully in most cases. Indeed, it is of the bool cad type either it is active or it is inactive.

However, even if it is available in Qt, it is only available for QML but not for PyQt5 and Pyside2. Normally, it should have arrived for Pyside6 for years. As for PyQt5, there is nothing planned to my knowledge.

The tutorial on Dashboard has revived my interest for this kind of widget, especially since I will need it soon. However, with an on / off button and a switch button, the choice is quickly made. I vote for the switch button.
But since he is not present, it will be difficult. Would everything be lost? No.

I came across this subject (it is the only one I found while surfing the web) which allows you to create a QPushButton in subclass. The result as you can see is superb (and even customizable).

However, I found its implementation complicated. Explanations would be welcome.
I wonder if Martin (or John Li) could not redo this hand tutorial based on the type of button. It would also make it possible to approach QPainter still differently.

1 Like

We have a bunch of custom widgets here https://github.com/learnpyqt/python-qtwidgets (on the site here https://www.learnpyqt.com/widgets/ ) … I can add something like this to there? Once it’s in the library you can just import + use it as for any other widget.

1 Like

I vote in favour. This widget is highly sought after and interests a lot of people but it is quite complex to understand and implement.