diff options
author | Bjørn Erik Nilsen <bjorn.nilsen@nokia.com> | 2009-05-12 15:46:52 (GMT) |
---|---|---|
committer | Bjørn Erik Nilsen <bjorn.nilsen@nokia.com> | 2009-05-12 19:41:50 (GMT) |
commit | 8a4fbf2edfd88128aeead769adb9842338e09623 (patch) | |
tree | 812f90ad481cf00b62187766e5741f869c07e4a9 /src/gui/kernel/qwidget_x11.cpp | |
parent | 4ffda2918b3f5c789ef325cdeaac72e5e7ef2c0c (diff) | |
download | Qt-8a4fbf2edfd88128aeead769adb9842338e09623.zip Qt-8a4fbf2edfd88128aeead769adb9842338e09623.tar.gz Qt-8a4fbf2edfd88128aeead769adb9842338e09623.tar.bz2 |
Cleanup private QWidget functions.
I actually found a few functions that were not even implemented, only
declared. Those should obviously not be in the header file. I've also
removed a few functions not in use / not belonging to QWidgetPrivate.
Reviewed-by: Olivier
Diffstat (limited to 'src/gui/kernel/qwidget_x11.cpp')
-rw-r--r-- | src/gui/kernel/qwidget_x11.cpp | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/src/gui/kernel/qwidget_x11.cpp b/src/gui/kernel/qwidget_x11.cpp index 906500e..b35740a 100644 --- a/src/gui/kernel/qwidget_x11.cpp +++ b/src/gui/kernel/qwidget_x11.cpp @@ -906,6 +906,44 @@ void QWidgetPrivate::x11UpdateIsOpaque() #endif } +/* + Returns true if the background is inherited; otherwise returns + false. + + Mainly used in the paintOnScreen case. +*/ +bool QWidgetPrivate::isBackgroundInherited() const +{ + Q_Q(const QWidget); + + // windows do not inherit their background + if (q->isWindow() || q->windowType() == Qt::SubWindow) + return false; + + if (q->testAttribute(Qt::WA_NoSystemBackground) || q->testAttribute(Qt::WA_OpaquePaintEvent)) + return false; + + const QPalette &pal = q->palette(); + QPalette::ColorRole bg = q->backgroundRole(); + QBrush brush = pal.brush(bg); + + // non opaque brushes leaves us no choice, we must inherit + if (!q->autoFillBackground() || !brush.isOpaque()) + return true; + + if (brush.style() == Qt::SolidPattern) { + // the background is just a solid color. If there is no + // propagated contents, then we claim as performance + // optimization that it was not inheritet. This is the normal + // case in standard Windows or Motif style. + const QWidget *w = q->parentWidget(); + if (!w->d_func()->isBackgroundInherited()) + return false; + } + + return true; +} + void QWidget::destroy(bool destroyWindow, bool destroySubWindows) { Q_D(QWidget); |