summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason Barron <jbarron@trolltech.com>2009-04-24 14:13:56 (GMT)
committerJason Barron <jbarron@trolltech.com>2009-04-28 14:40:57 (GMT)
commit76d46a2deedc69108cefce811e8dc6a65f9151e6 (patch)
treefe730eefe7a9d49bd5399563385ac4ef22d3e9f4
parent27e57ccd327fbc1edbb23d9959c5388023974dfc (diff)
downloadQt-76d46a2deedc69108cefce811e8dc6a65f9151e6.zip
Qt-76d46a2deedc69108cefce811e8dc6a65f9151e6.tar.gz
Qt-76d46a2deedc69108cefce811e8dc6a65f9151e6.tar.bz2
Fix background painting.
This is a reverted patch that has been rebased on to another branch and then caused conflicts so it might contain an error or two. Basically we need to store the background texture from the style into the palette so that it can be replaced by applications that don't want it.
-rw-r--r--src/gui/kernel/qwidget.cpp12
-rw-r--r--src/gui/styles/qs60style.cpp24
-rw-r--r--src/gui/styles/qs60style_symbian.cpp32
3 files changed, 26 insertions, 42 deletions
diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp
index 7eaebbb..9015182 100644
--- a/src/gui/kernel/qwidget.cpp
+++ b/src/gui/kernel/qwidget.cpp
@@ -2038,19 +2038,17 @@ static inline void fillRegion(QPainter *painter, const QRegion &rgn, const QPoin
// Defined in qmacstyle_mac.cpp
extern void qt_mac_fill_background(QPainter *painter, const QRegion &rgn, const QPoint &offset, const QBrush &brush);
qt_mac_fill_background(painter, rgn, offset, brush);
+#elif defined(Q_WS_S60)
+ // Defined in qs60style_symbian.cpp
+ extern void qt_s60_fill_background(QPainter *painter, const QRegion &rgn,
+ const QPoint &offset, const QBrush &brush);
+ qt_s60_fill_background(painter, rgn, offset, brush);
#else
const QRegion translated = rgn.translated(offset);
const QRect rect(translated.boundingRect());
painter->setClipRegion(translated);
painter->drawTiledPixmap(rect, brush.texture(), rect.topLeft());
#endif
-#if defined(Q_WS_S60) && !defined(QT_NO_STYLE_S60)
- } if (!brush.isOpaque()) {
- // QS60Style knows it's background and does not store its texture in a palette
- // Defined in qs60style.cpp
- extern void qt_s60_fill_background(QPainter *painter, const QRegion &rgn, const QPoint &offset);
- qt_s60_fill_background(painter, rgn, offset);
-#endif
} else {
const QVector<QRect> &rects = rgn.rects();
for (int i = 0; i < rects.size(); ++i)
diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp
index 58dcb98..65ce104 100644
--- a/src/gui/styles/qs60style.cpp
+++ b/src/gui/styles/qs60style.cpp
@@ -485,7 +485,7 @@ void QS60StylePrivate::setThemePalette(QWidget *widget) const
QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnHighlightColors, 2, 0));
// set these as transparent so that styled full screen theme background is visible
widgetPalette.setColor(QPalette::AlternateBase, Qt::transparent);
- widgetPalette.setColor(QPalette::Window, Qt::transparent);
+ widgetPalette.setColor(QPalette::Window, QS60StylePrivate::backgroundTexture());
widgetPalette.setColor(QPalette::Base, Qt::transparent);
// set button and tooltipbase based on pixel colors
QColor buttonColor = colorFromFrameGraphics(QS60StylePrivate::SF_ButtonNormal);
@@ -530,17 +530,6 @@ void QS60Style::polish(QWidget *widget)
Q_D(const QS60Style);
QCommonStyle::polish(widget);
- if (QAbstractScrollArea *scrollArea = qobject_cast<QAbstractScrollArea *>(widget)){
- scrollArea->viewport()->setAutoFillBackground(false);
- }
-
- if (false
-#ifndef QT_NO_SCROLLBAR
- || qobject_cast<QScrollBar *>(widget)
-#endif
- ) {
- widget->setAttribute(Qt::WA_OpaquePaintEvent, false);
- }
if (QS60StylePrivate::isSkinnableDialog(widget)) {
widget->setAttribute(Qt::WA_StyledBackground);
} else if (false
@@ -565,17 +554,6 @@ void QS60Style::polish(QWidget *widget)
void QS60Style::unpolish(QWidget *widget)
{
- if (QAbstractScrollArea *scrollArea = qobject_cast<QAbstractScrollArea *>(widget)){
- scrollArea->viewport()->setAutoFillBackground(true);
- }
-
- if (false
-#ifndef QT_NO_SCROLLBAR
- || qobject_cast<QScrollBar *>(widget)
-#endif
- ) {
- widget->setAttribute(Qt::WA_OpaquePaintEvent);
- }
if (QS60StylePrivate::isSkinnableDialog(widget)) {
widget->setAttribute(Qt::WA_StyledBackground, false);
} else if (false
diff --git a/src/gui/styles/qs60style_symbian.cpp b/src/gui/styles/qs60style_symbian.cpp
index a1e7800..083e3b9 100644
--- a/src/gui/styles/qs60style_symbian.cpp
+++ b/src/gui/styles/qs60style_symbian.cpp
@@ -372,21 +372,29 @@ bool QS60StylePrivate::isTouchSupported()
return bool(AknLayoutUtils::PenEnabled());
}
-void qt_s60_fill_background(QPainter *painter, const QRegion &rgn, const QPoint &offset)
+void qt_s60_fill_background(QPainter *painter, const QRegion &rgn, const QPoint &offset,
+ const QBrush &brush)
{
const QPixmap backgroundTexture(QS60StylePrivate::backgroundTexture());
- const QPaintDevice *target = painter->device();
- if (target->devType() == QInternal::Widget) {
- const QWidget *widget = static_cast<const QWidget *>(target);
- const CCoeControl *control = widget->effectiveWinId();
- const TPoint globalPos = control ? control->PositionRelativeToScreen() : TPoint(0,0);
- const QRegion translated = rgn.translated(offset);
- const QVector<QRect> &rects = translated.rects();
- for (int i = 0; i < rects.size(); ++i) {
- const QRect rect(rects.at(i));
- painter->drawPixmap(rect.topLeft(), backgroundTexture,
- rect.translated(globalPos.iX, globalPos.iY));
+ if (backgroundTexture.cacheKey() == brush.texture().cacheKey()) {
+ const QPaintDevice *target = painter->device();
+ if (target->devType() == QInternal::Widget) {
+ const QWidget *widget = static_cast<const QWidget *>(target);
+ CCoeControl *control = widget->effectiveWinId();
+ TPoint globalPos = control ? control->PositionRelativeToScreen() : TPoint(0,0);
+ const QRegion translated = rgn.translated(offset);
+ const QVector<QRect> &rects = translated.rects();
+ for (int i = 0; i < rects.size(); ++i) {
+ const QRect rect(rects.at(i));
+ painter->drawPixmap(rect.topLeft(), backgroundTexture,
+ rect.translated(globalPos.iX, globalPos.iY));
+ }
}
+ } else {
+ const QRegion translated = rgn.translated(offset);
+ const QRect rect(translated.boundingRect());
+ painter->setClipRegion(translated);
+ painter->drawTiledPixmap(rect, brush.texture(), rect.topLeft());
}
}