Toggle Switch in Qt

后端 未结 10 2206
臣服心动
臣服心动 2020-12-12 17:31

I am trying to use an element which is the equivalent of Android Switches in Qt. I have found a ToggleSwitch in QML, but nothing in the actual C++ Qt libs. Am I just missing

10条回答
  •  醉酒成梦
    2020-12-12 17:54

    You could also do this with a QSlider control in a horizontal orientation that has a range of 0 to 1. You'd probably want to set its max width to something like 50 or so, to keep it from stretching across the width of the dialog. You could then tweak it with a style sheet to improve the appearance, or subclass it and draw the controls yourself. It might not take too much code to make it look good.

提交回复
热议问题