Qt World Summit: Register Today!

Wobbling effect in a QLabel

  • I have a problem with a QLabel displaying the processing time of my program. When the times changes between a 2 or 3 numbers values, it produce a wobbling label.
    @Processing time 95 msec.
    Processing time 105 msec.@
    I tried to use tab and also padding with spaces:
    @QString("Processing took\t%1\tmsec.").arg(elapsedTime)
    QString("Processing took %1 msec.").arg(elapsedTime, -3)@
    But it is still wobbling. I would avoid using a constant width font, so is there any way to avoid this wobbling effect?

  • I would put the "XY msec" text in another label, and set it's alignment to Qt::AlignRight.

  • I had this idea in mind but found it a bit dirty :p

Log in to reply