QPixmap JobModel::statusImage(JobInfo::State state) const
{
    QColor color;
    if ( state == JobInfo::Running )
        color = ( QTime::currentTime().msec() < 500 ) ?  Qt::gray : Qt::green;
    else if ( state == JobInfo::Completed )
        color = Qt::red;
    else
        color = QColor(Qt::yellow).darker();

    KLed led;
    led.setColor(color);

    QPalette pal = led.palette();
    pal.setColor(QPalette::Window, Qt::white);
    led.setPalette(pal);

    return QPixmap::grabWidget(&led);
}
示例#2
0
QPixmap JobModel::statusImage(JobInfo::State state) const
{
    QColor color;
    if ( state == JobInfo::Running )
        color = blinkStateOn ?  Qt::green : Qt::gray;
    else if ( state == JobInfo::Completed )
        color = Qt::red;
    else
        color = QColor(Qt::yellow).darker();

    KLed led;
    led.setColor(color);

    QPalette pal = led.palette();
    pal.setColor(QPalette::Window, Qt::white);
    led.setPalette(pal);

    return led.grab();
}