PyQt5: How To Align The Elements Of The Status Bar?
I've created a status bar which looks like this: def initStatusbar(self): self.zoomSlider = QSlider(Qt.Horizontal) self.zoomSlider.setMaximumWidth(200) self.zoomSlider.
Solution 1:
An initial solution would be to use a stretch greater than zero, but this would make the QProgressBar stretch without limits, in this case it is best to include it inside another widget and embed this in the QStatusBar.
def initStatusbar(self):
self.zoomSlider = QSlider(Qt.Horizontal)
self.zoomSlider.setMaximumWidth(200)
self.zoomSlider.setRange(1, 200)
self.zoomSlider.setSingleStep(10)
self.zoomSlider.setValue(100)
self.progressbar = QProgressBar()
self.progressbar.setMaximumWidth(400)
widget = QWidget(self)
widget.setLayout(QHBoxLayout())
widget.layout().addWidget(self.progressbar)
widget.layout().addWidget(self.zoomSlider)
self.statusBar().addWidget(widget, 1)
Screenshot:
Post a Comment for "PyQt5: How To Align The Elements Of The Status Bar?"