Logo Search packages:      
Sourcecode: kdenlive version File versions

void StatusBarMessageLabel::paintEvent ( QPaintEvent *  event  )  [protected, virtual]

See also:
QWidget::paintEvent()

Definition at line 137 of file statusbarmessagelabel.cpp.

References availableTextWidth().

                                                               {
    QPainter painter(this);

    // draw background
    QColor backgroundColor = palette().window().color();
    if (m_illumination > 0) {
        // at this point, a: we are a second label being drawn over the already
        // painted status area, so we can be translucent, and b: our palette's
        // window color (bg only) seems to be wrong (always black)
        KColorScheme scheme(palette().currentColorGroup(), KColorScheme::Window);
        backgroundColor = scheme.background(KColorScheme::NegativeBackground).color();
        backgroundColor.setAlpha(qMin(255, m_illumination*2));
    }
    painter.setBrush(backgroundColor);
    painter.setPen(Qt::NoPen);
    painter.drawRect(0, 0, width(), height());

    // draw pixmap
    int x = BorderGap;
    int y = (height() - m_pixmap.height()) / 2;

    if (!m_pixmap.isNull()) {
        painter.drawPixmap(x, y, m_pixmap);
        x += m_pixmap.width() + BorderGap * 2;
    }

    // draw text
    painter.setPen(palette().windowText().color());
    int flags = Qt::AlignVCenter;
    /*if (height() > m_minTextHeight) {
        flags = flags | Qt::TextWordWrap;
    }*/
    painter.drawText(QRect(x, 0, availableTextWidth(), height()), flags, m_text);
    painter.end();
}


Generated by  Doxygen 1.6.0   Back to index