Logo Search packages:      
Sourcecode: qt4-x11 version File versions

QPalette::ColorRole QWidget::backgroundRole (  )  const [inherited]

Returns the background role of the widget.

The background role defines the brush from the widget's palette that is used to render the background.

If no explicit background role is set, the widget inherts its parent widget's background role.

See also:
setBackgroundRole(), foregroundRole()

Definition at line 3861 of file qwidget.cpp.

References QWidget::isWindow(), QWidget::parentWidget(), and QWidget::windowType().

Referenced by QCleanlooksStyle::drawComplexControl(), QPlastiqueStyle::drawComplexControl(), QWindowsXPStyle::drawComplexControl(), QPlastiqueStyle::drawControl(), QCleanlooksStyle::drawControl(), QPlastiqueStyle::drawPrimitive(), QWidget::foregroundRole(), QPainter::initFrom(), Q3ListBox::paintCell(), Q3CheckListItem::paintCell(), Q3ListViewItem::paintCell(), QGraphicsView::paintEvent(), QGraphicsView::scrollContentsBy(), QGLWidget::setContext(), and Q3ListBox::viewportPaintEvent().

{

    const QWidget *w = this;
    do {
        QPalette::ColorRole role = w->d_func()->bg_role;
        if (role != QPalette::NoRole)
            return role;
        if (w->isWindow() || w->windowType() == Qt::SubWindow)
            break;
        w = w->parentWidget();
    } while (w);
    return QPalette::Window;
}


Generated by  Doxygen 1.6.0   Back to index