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

void QWidget::setStyle ( QStyle style  )  [inherited]

Sets the widget's GUI style to style. The ownership of the style object is not transferred.

If no style is set, the widget uses the application's style, QApplication::style() instead.

Setting a widget's style has no effect on existing or future child widgets.

Warning:
This function is particularly useful for demonstration purposes, where you want to show Qt's styling capabilities. Real applications should avoid it and use one consistent GUI style instead.
See also:
style(), QStyle, QApplication::style(), QApplication::setStyle()

Definition at line 2123 of file qwidget.cpp.

References QWidget::setAttribute().

{
    Q_D(QWidget);
    setAttribute(Qt::WA_SetStyle, style != 0);
    d->createExtra();
#ifndef QT_NO_STYLE_STYLESHEET
    // if we have an application stylesheet or have a proxy already, propagate
    if (qobject_cast<QStyleSheetStyle *>(d->extra->style) || !qApp->styleSheet().isEmpty())
        d->setStyle_helper(new QStyleSheetStyle(style), true);
    else
#endif
        d->setStyle_helper(style, false);
}


Generated by  Doxygen 1.6.0   Back to index