QSlider color
Unsolved
Qt for Python
-
In the example below when I set the slider value, the slider bar below the indicator appears orange. How can I set it to a different color?
import sys from PyQt6 import QtWidgets, QtCore class MainWindow(QtWidgets.QMainWindow): def __init__(self): super().__init__() self.setFixedWidth(400) self.setFixedHeight(400) self.setStyleSheet("background-color: silver") slider = QtWidgets.QSlider(QtCore.Qt.Orientation.Vertical) slider.setFixedHeight(400) slider.setValue(50) self.layout().addWidget(slider) if __name__ == '__main__': app = QtWidgets.QApplication(sys.argv) ex = MainWindow() ex.show() sys.exit(app.exec())
-
@Captain-Haddock
Try setting the stylesheet on the slider.
I think per https://doc.qt.io/qt-6/stylesheet-examples.html#customizing-qslider you need to select the::groove
?