How to change the color of the text of a QProgressBar with its value?

Too lazy to write working example code, much less making a screenshot. Not even for 50 reps. :-)

However, the question was somewhat interesting. I had no idea how such a two colored text could be done. So I checked: http://qt.gitorious.org/qt/qtbase/blobs/stable/src/widgets/styles/qfusionstyle.cpp Line 1450ff (http://qt.gitorious.org/qt/qtbase/blobs/stable/src/widgets/styles/qfusionstyle.cpp#line1450).

    QRegion rightRect = rect;
    rightRect = rightRect.subtracted(leftRect);
    painter->setClipRegion(rightRect);
    painter->setPen(flip ? alternateTextColor : textColor);
    painter->drawText(rect,
                      bar->text,
                      QTextOption(Qt::AlignAbsolute|
                                   Qt::AlignHCenter|
                                   Qt::AlignVCenter));
    if (!leftRect.isNull()) 
    {
        painter->setPen(flip ? textColor : alternateTextColor);
        painter->setClipRect(leftRect);
        painter->drawText(rect,
                 bar->text,
                 QTextOption(Qt::AlignAbsolute|
                              Qt::AlignHCenter|
                              Qt::AlignVCenter));
    }

Basically the text is drawn two times into the same rectangle. Each time with an appropriate clipping. Easy if you know how. :-)