Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Align text left and center in QProgressBar?



  • I have a progress bar where I want the text to be in the left side and centered height wise, not width wise.

    I tried this:

    self.ram = QProgressBar(self)
    self.ram.setAlignment(Qt.AlignLeft | Qt.
    self.ram.setFixedWidth(
    self.ram.setValue(100)
    

    But that doesn't give me the results wanted.

    Is it even possible?
    I'm looking for results like this: 0_1541797064950_14232c5c-d518-45b1-b2db-277febd07e0e-image.png


  • Lifetime Qt Champion

    Hi,

    setAlignment, as stated, in the doc, is for the progress bar alignment.

    If you want to change the text position, you should look into QProxyStyle.


Log in to reply