I have a QTableWidget. In its cells I need to display 3-state QSliders, that must change their color, depending form their state. -1 = red, 0 – normal, 1 – green. I tried to set QPalette to QSlider – whitout success. I tried to place QSlider into QWidget with Layout and apply palette to QWidget – whitout success.
How to do that? I need any color sign (border or full background, e.t.c) How to do that?
I have a QTableWidget. In its cells I need to display 3-state QSliders, that
Share
You can use
QItemDelegate, then you’ll could to rule yourQSliderintoQTableWidget.Detail.
At first, you should derive from
QItemDelegate. A good docs presents bydoc.qt.digiaexample using qitemdelegateYou should substitute
QSpinBoxtoQSlider. And after reading this document, you can do needed with setting color yourQSlider.To
editorwas opened always, you should useopenPersistentEditor(). For example: