summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason Barron <jbarron@trolltech.com>2009-04-30 13:24:55 (GMT)
committerJason Barron <jbarron@trolltech.com>2009-04-30 13:24:55 (GMT)
commit32493498dcf3aa1ab9973aab381c5ca99d9ba9fd (patch)
treecb46e87a358289adbc5c58d74521676add50435e
parentb20ca123c521a1dae695045211c253c221ed604a (diff)
parent4b1137345a0bbfedc348b020ad0ad6e5720eb6d1 (diff)
downloadQt-32493498dcf3aa1ab9973aab381c5ca99d9ba9fd.zip
Qt-32493498dcf3aa1ab9973aab381c5ca99d9ba9fd.tar.gz
Qt-32493498dcf3aa1ab9973aab381c5ca99d9ba9fd.tar.bz2
Merge commit 'private/translucentWindows'
Conflicts: src/gui/styles/qs60style_symbian.cpp
-rw-r--r--src/gui/image/qpixmap_s60.cpp2
-rw-r--r--src/gui/kernel/qapplication_s60.cpp5
-rw-r--r--src/gui/kernel/qt_s60_p.h6
-rw-r--r--src/gui/kernel/qwidget.cpp18
-rw-r--r--src/gui/kernel/qwidget.h1
-rw-r--r--src/gui/kernel/qwidget_p.h4
-rw-r--r--src/gui/kernel/qwidget_s60.cpp38
-rw-r--r--src/gui/painting/qwindowsurface_s60.cpp46
-rw-r--r--src/gui/styles/qs60style.cpp92
-rw-r--r--src/gui/styles/qs60style.h3
-rw-r--r--src/gui/styles/qs60style_p.h2
-rw-r--r--src/gui/styles/qs60style_symbian.cpp42
-rw-r--r--tests/auto/qwidget/tst_qwidget.cpp4
13 files changed, 171 insertions, 92 deletions
diff --git a/src/gui/image/qpixmap_s60.cpp b/src/gui/image/qpixmap_s60.cpp
index 6246592..625988a 100644
--- a/src/gui/image/qpixmap_s60.cpp
+++ b/src/gui/image/qpixmap_s60.cpp
@@ -27,7 +27,7 @@ QPixmap QPixmap::grabWindow(WId winId, int x, int y, int w, int h )
// Find out if this is one of our windows.
QSymbianControl *sControl;
sControl = winId->MopGetObject(sControl);
- if (sControl && sControl->widget()->windowType() & Qt::Desktop) {
+ if (sControl && sControl->widget()->windowType() == Qt::Desktop) {
// Grabbing desktop widget
srcSize = screenSize;
} else {
diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp
index c7bbcdb..06e47a7 100644
--- a/src/gui/kernel/qapplication_s60.cpp
+++ b/src/gui/kernel/qapplication_s60.cpp
@@ -540,7 +540,10 @@ void QSymbianControl::Draw(const TRect& r) const
if (engine->type() == QPaintEngine::Raster) {
QS60WindowSurface *s60Surface = static_cast<QS60WindowSurface *>(qwidget->windowSurface());
CFbsBitmap *bitmap = s60Surface->symbianBitmap();
- SystemGc().BitBlt(r.iTl, bitmap, r);
+ CWindowGc &gc = SystemGc();
+ if (qwidget->d_func()->isOpaque)
+ gc.SetDrawMode(CGraphicsContext::EDrawModeWriteAlpha);
+ gc.BitBlt(r.iTl, bitmap, r);
} else {
surface->flush(qwidget, QRegion(qt_TRect2QRect(r)), QPoint());
}
diff --git a/src/gui/kernel/qt_s60_p.h b/src/gui/kernel/qt_s60_p.h
index 6261e4b..35755c3 100644
--- a/src/gui/kernel/qt_s60_p.h
+++ b/src/gui/kernel/qt_s60_p.h
@@ -227,12 +227,14 @@ static inline QImage::Format qt_TDisplayMode2Format(TDisplayMode mode)
format = QImage::Format_RGB666;
break;
case EColor16MU:
- case EColor16MA:
format = QImage::Format_RGB32;
break;
+ case EColor16MA:
+ format = QImage::Format_ARGB32;
+ break;
#ifdef __S60_50__
case EColor16MAP:
- format = QImage::Format_ARGB32;
+ format = QImage::Format_ARGB32_Premultiplied;
break;
#endif
default:
diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp
index 7eaebbb..f5deb96 100644
--- a/src/gui/kernel/qwidget.cpp
+++ b/src/gui/kernel/qwidget.cpp
@@ -1991,6 +1991,9 @@ void QWidgetPrivate::setOpaque(bool opaque)
#ifdef Q_WS_WIN
winUpdateIsOpaque();
#endif
+#ifdef Q_WS_S60
+ s60UpdateIsOpaque();
+#endif
}
void QWidgetPrivate::updateIsTranslucent()
@@ -2004,6 +2007,9 @@ void QWidgetPrivate::updateIsTranslucent()
#ifdef Q_WS_WIN
winUpdateIsOpaque();
#endif
+#ifdef Q_WS_S60
+ s60UpdateIsOpaque();
+#endif
}
/*!
@@ -2038,19 +2044,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/kernel/qwidget.h b/src/gui/kernel/qwidget.h
index 8ecf758..2b584eb 100644
--- a/src/gui/kernel/qwidget.h
+++ b/src/gui/kernel/qwidget.h
@@ -746,6 +746,7 @@ private:
#endif
#ifdef Q_WS_S60
friend class QSymbianControl;
+ friend class QS60WindowSurface;
#endif
#ifdef Q_WS_X11
friend void qt_net_update_user_time(QWidget *tlw, unsigned long timestamp);
diff --git a/src/gui/kernel/qwidget_p.h b/src/gui/kernel/qwidget_p.h
index ec64b6e..19f4b98 100644
--- a/src/gui/kernel/qwidget_p.h
+++ b/src/gui/kernel/qwidget_p.h
@@ -270,6 +270,10 @@ public:
void applyMaxAndMinSizeConstraints(int &w, int &h);
#endif
+#ifdef Q_WS_S60
+ void s60UpdateIsOpaque();
+#endif
+
void raise_sys();
void lower_sys();
void stackUnder_sys(QWidget *);
diff --git a/src/gui/kernel/qwidget_s60.cpp b/src/gui/kernel/qwidget_s60.cpp
index ec80a18..f424e93 100644
--- a/src/gui/kernel/qwidget_s60.cpp
+++ b/src/gui/kernel/qwidget_s60.cpp
@@ -99,7 +99,7 @@ void QWidgetPrivate::setGeometry_sys(int x, int y, int w, int h, bool isMove)
// disable it for this particular widget.
if (inTopLevelResize)
tlwExtra->inTopLevelResize = false;
- if (!isResize)
+ if (!isResize && maybeBackingStore())
moveRect(QRect(oldPos, oldSize), x - oldPos.x(), y - oldPos.y());
else
invalidateBuffer_resizeHelper(oldPos, oldSize);
@@ -202,8 +202,16 @@ void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool destroyO
topExtra->rwindow->PointerFilter(EPointerFilterEnterExit
| EPointerFilterMove | EPointerFilterDrag, 0);
topExtra->rwindow->EnableVisibilityChangeEvents();
+
+ if (!isOpaque) {
+ RWindow *rwindow = static_cast<RWindow*>(topExtra->rwindow);
+ TDisplayMode gotDM = (TDisplayMode)rwindow->SetRequiredDisplayMode(EColor16MA);
+ if (rwindow->SetTransparencyAlphaChannel() == KErrNone)
+ rwindow->SetBackgroundColor(TRgb(255, 255, 255, 0));
+ }
}
+
id = (WId)control;
setWinId(id);
@@ -429,6 +437,30 @@ void QWidgetPrivate::setConstraints_sys()
}
+
+void QWidgetPrivate::s60UpdateIsOpaque()
+{
+ Q_Q(QWidget);
+
+ if (!q->testAttribute(Qt::WA_WState_Created) || !q->testAttribute(Qt::WA_TranslucentBackground))
+ return;
+
+ if ((data.window_flags & Qt::FramelessWindowHint) == 0)
+ return;
+
+ if (!isOpaque) {
+ QTLWExtra *topExtra = topData();
+ RWindow *rwindow = static_cast<RWindow*>(topExtra->rwindow);
+ TDisplayMode gotDM = (TDisplayMode)rwindow->SetRequiredDisplayMode(EColor16MA);
+ if (rwindow->SetTransparencyAlphaChannel() == KErrNone)
+ rwindow->SetBackgroundColor(TRgb(255, 255, 255, 0));
+ } else {
+ QTLWExtra *topExtra = topData();
+ RWindow *rwindow = static_cast<RWindow*>(topExtra->rwindow);
+ rwindow->SetTransparentRegion(TRegionFix<1>());
+ }
+}
+
CFbsBitmap* qt_pixmapToNativeBitmapL(QPixmap pixmap, bool invert)
{
CFbsBitmap* fbsBitmap = new(ELeave)CFbsBitmap;
@@ -574,9 +606,9 @@ void QWidgetPrivate::scroll_sys(int dx, int dy, const QRect &r)
TRANSPARENCY
To a line in the wsini.ini file.
*/
-void QWidgetPrivate::setWindowOpacity_sys(qreal level)
+void QWidgetPrivate::setWindowOpacity_sys(qreal)
{
-
+ // ### TODO: Implement uniform window transparency
}
void QWidgetPrivate::updateFrameStrut()
diff --git a/src/gui/painting/qwindowsurface_s60.cpp b/src/gui/painting/qwindowsurface_s60.cpp
index b262cb2..2618ce2 100644
--- a/src/gui/painting/qwindowsurface_s60.cpp
+++ b/src/gui/painting/qwindowsurface_s60.cpp
@@ -12,9 +12,10 @@
#include <qglobal.h> // for Q_WS_WIN define (non-PCH)
#include <QtGui/qpaintdevice.h>
-#include <QtGui/qwidget.h>
+#include <private/qwidget_p.h>
#include "qwindowsurface_s60_p.h"
#include "qt_s60_p.h"
+#include "private/qdrawhelper_p.h"
QT_BEGIN_NAMESPACE
@@ -35,12 +36,17 @@ QS60WindowSurface::QS60WindowSurface(QWidget* widget)
d_ptr->bytes = 0;
d_ptr->bitmap = 0;
- TSize size(0, 0);
TDisplayMode mode = S60->screenDevice()->DisplayMode();
+ bool isOpaque = qt_widget_private(widget)->isOpaque;
+ if (mode == EColor16MA && isOpaque)
+ mode = EColor16MU; // Faster since 16MU -> 16MA is typically accelerated
+ else if (mode == EColor16MU && !isOpaque)
+ mode = EColor16MA; // Try for transparency anyway
- // We create empty CFbsBitmap here -> it will be resized in setGeometry
+
+ // We create empty CFbsBitmap here -> it will be resized in setGeometry
d_ptr->bitmap = new (ELeave) CFbsBitmap;
- User::LeaveIfError( d_ptr->bitmap->Create( size, mode ) );
+ User::LeaveIfError( d_ptr->bitmap->Create(TSize(0, 0), mode ) );
updatePaintDeviceOnBitmap();
@@ -56,7 +62,7 @@ QS60WindowSurface::~QS60WindowSurface()
delete d_ptr;
}
-void QS60WindowSurface::beginPaint(const QRegion &)
+void QS60WindowSurface::beginPaint(const QRegion &rgn)
{
if(!d_ptr->bitmap)
return;
@@ -64,6 +70,26 @@ void QS60WindowSurface::beginPaint(const QRegion &)
Q_ASSERT(!QS60WindowSurfacePrivate::lockedSurface);
QS60WindowSurfacePrivate::lockedSurface = this;
lockBitmapHeap();
+
+ if (!qt_widget_private(window())->isOpaque) {
+ QRgb *data = reinterpret_cast<QRgb *>(d_ptr->device.bits());
+ const int row_stride = d_ptr->device.bytesPerLine() / 4;
+
+ const QVector<QRect> rects = rgn.rects();
+ for (QVector<QRect>::const_iterator it = rects.begin(); it != rects.end(); ++it) {
+ const int x_start = it->x();
+ const int width = it->width();
+
+ const int y_start = it->y();
+ const int height = it->height();
+
+ QRgb *row = data + row_stride * y_start;
+ for (int y = 0; y < height; ++y) {
+ qt_memfill(row + x_start, 0U, width);
+ row += row_stride;
+ }
+ }
+ }
}
void QS60WindowSurface::flush(QWidget *widget, const QRegion &region, const QPoint &)
@@ -118,12 +144,13 @@ void QS60WindowSurface::setGeometry(const QRect& rect)
if (rect == geometry())
return;
+ QWindowSurface::setGeometry(rect);
+
TRect nativeRect(qt_QRect2TRect(rect));
User::LeaveIfError(d_ptr->bitmap->Resize(nativeRect.Size()));
- updatePaintDeviceOnBitmap();
-
- QWindowSurface::setGeometry(rect);
+ if (!rect.isNull())
+ updatePaintDeviceOnBitmap();
}
void QS60WindowSurface::lockBitmapHeap()
@@ -143,6 +170,9 @@ void QS60WindowSurface::lockBitmapHeap()
// Get some values for QImage creation
TDisplayMode mode = bitmap->DisplayMode();
+ if (mode == EColor16MA
+ && qt_widget_private(QS60WindowSurfacePrivate::lockedSurface->window())->isOpaque)
+ mode = EColor16MU;
QImage::Format format = qt_TDisplayMode2Format( mode );
TSize bitmapSize = bitmap->SizeInPixels();
int bytesPerLine = CFbsBitmap::ScanLineLength( bitmapSize.iWidth, mode);
diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp
index f3213e9..d88b9ee 100644
--- a/src/gui/styles/qs60style.cpp
+++ b/src/gui/styles/qs60style.cpp
@@ -479,7 +479,7 @@ int QS60StylePrivate::focusRectPenWidth()
return pixelMetric(QS60Style::PM_DefaultFrameWidth);
}
-void QS60StylePrivate::setThemePalette(QWidget *widget) const
+void QS60StylePrivate::setThemePalette(QApplication *app) const
{
QPalette widgetPalette = QPalette(Qt::white);
@@ -502,7 +502,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.setBrush(QPalette::Window, QS60StylePrivate::backgroundTexture());
widgetPalette.setColor(QPalette::Base, Qt::transparent);
// set button and tooltipbase based on pixel colors
QColor buttonColor = colorFromFrameGraphics(QS60StylePrivate::SF_ButtonNormal);
@@ -515,31 +515,14 @@ void QS60StylePrivate::setThemePalette(QWidget *widget) const
QColor toolTipColor = colorFromFrameGraphics(QS60StylePrivate::SF_ToolTip);
widgetPalette.setColor(QPalette::ToolTipBase, toolTipColor );
- // widget specific colors
- if (QSlider *slider = qobject_cast<QSlider *>(widget)){
- widgetPalette.setColor(QPalette::All, QPalette::WindowText,
- QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnLineColors, 8, 0));
- } else if (QPushButton *button = qobject_cast<QPushButton *>(widget)){
- widgetPalette.setColor(QPalette::Active, QPalette::ButtonText,
- QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnTextColors, 6, 0));
- widgetPalette.setColor(QPalette::Inactive, QPalette::ButtonText,
- QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnTextColors, 6, 0));
- } else if (QHeaderView *table = qobject_cast<QHeaderView *>(widget)){
- widgetPalette.setColor(QPalette::Active, QPalette::ButtonText,
- QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnTextColors, 23, 0));
- } else if (QMenuBar *menuBar = qobject_cast<QMenuBar *>(widget)){
- widgetPalette.setColor(QPalette::All, QPalette::ButtonText,
- QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnTextColors, 8, 0));
- } else if (QTabBar *tabBar = qobject_cast<QTabBar *>(widget)){
- widgetPalette.setColor(QPalette::Active, QPalette::WindowText,
- QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnTextColors, 4, 0));
- } else if (QTableView *table = qobject_cast<QTableView *>(widget)){
- widgetPalette.setColor(QPalette::All, QPalette::Text,
- QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnTextColors, 22, 0));
- }
+ app->setPalette(widgetPalette);
+}
- if (widget)
- widget->setPalette(widgetPalette);
+void QS60Style::polish(QApplication *application)
+{
+ Q_D(const QS60Style);
+ originalPalette = application->palette();
+ d->setThemePalette(application);
}
void QS60Style::polish(QWidget *widget)
@@ -547,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
@@ -574,25 +546,45 @@ void QS60Style::polish(QWidget *widget)
widget->setAttribute(Qt::WA_StyledBackground);
}
- if (widget){
- d->setThemePalette(widget);
+ QPalette widgetPalette = widget->palette();
+
+ // widget specific colors
+ if (QSlider *slider = qobject_cast<QSlider *>(widget)){
+ widgetPalette.setColor(QPalette::All, QPalette::WindowText,
+ QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnLineColors, 8, 0));
+ QApplication::setPalette(widgetPalette, "QSlider");
+ } else if (QPushButton *button = qobject_cast<QPushButton *>(widget)){
+ widgetPalette.setColor(QPalette::Active, QPalette::ButtonText,
+ QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnTextColors, 6, 0));
+ widgetPalette.setColor(QPalette::Inactive, QPalette::ButtonText,
+ QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnTextColors, 6, 0));
+ QApplication::setPalette(widgetPalette, "QPushButton");
+ } else if (QHeaderView *table = qobject_cast<QHeaderView *>(widget)){
+ widgetPalette.setColor(QPalette::Active, QPalette::ButtonText,
+ QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnTextColors, 23, 0));
+ QApplication::setPalette(widgetPalette, "QHeaderView");
+ } else if (QMenuBar *menuBar = qobject_cast<QMenuBar *>(widget)){
+ widgetPalette.setColor(QPalette::All, QPalette::ButtonText,
+ QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnTextColors, 8, 0));
+ QApplication::setPalette(widgetPalette, "QMenuBar");
+ } else if (QTabBar *tabBar = qobject_cast<QTabBar *>(widget)){
+ widgetPalette.setColor(QPalette::Active, QPalette::WindowText,
+ QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnTextColors, 4, 0));
+ QApplication::setPalette(widgetPalette, "QTabBar");
+ } else if (QTableView *table = qobject_cast<QTableView *>(widget)){
+ widgetPalette.setColor(QPalette::All, QPalette::Text,
+ QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnTextColors, 22, 0));
+ QApplication::setPalette(widgetPalette, "QTableView");
}
+}
+void QS60Style::unpolish(QApplication *application)
+{
+ application->setPalette(originalPalette);
}
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.h b/src/gui/styles/qs60style.h
index 253eb61..945e182 100644
--- a/src/gui/styles/qs60style.h
+++ b/src/gui/styles/qs60style.h
@@ -45,6 +45,8 @@ public:
QRect subElementRect(SubElement element, const QStyleOption *opt, const QWidget *widget = 0) const;
void polish(QWidget *widget);
void unpolish(QWidget *widget);
+ void polish(QApplication *application);
+ void unpolish(QApplication *application);
void setStyleProperty(const char *name, const QVariant &value);
QVariant styleProperty(const char *name) const;
@@ -69,6 +71,7 @@ protected slots:
private:
Q_DISABLE_COPY(QS60Style)
friend class QStyleFactory;
+ QPalette originalPalette;
};
#endif // QT_NO_STYLE_S60
diff --git a/src/gui/styles/qs60style_p.h b/src/gui/styles/qs60style_p.h
index 8839866..5afe702 100644
--- a/src/gui/styles/qs60style_p.h
+++ b/src/gui/styles/qs60style_p.h
@@ -342,7 +342,7 @@ public:
// calculates average color based on button skin graphics (minus borders).
QColor colorFromFrameGraphics(QS60StylePrivate::SkinFrameElements frame) const;
- void setThemePalette(QWidget *widget) const;
+ void setThemePalette(QApplication *application) const;
static int focusRectPenWidth();
diff --git a/src/gui/styles/qs60style_symbian.cpp b/src/gui/styles/qs60style_symbian.cpp
index ab1deb0..154cf29 100644
--- a/src/gui/styles/qs60style_symbian.cpp
+++ b/src/gui/styles/qs60style_symbian.cpp
@@ -410,21 +410,29 @@ bool QS60StylePrivate::isToolBarBackground()
return (QSysInfo::s60Version() == QSysInfo::SV_S60_3_1 || QSysInfo::s60Version() == QSysInfo::SV_S60_3_2);
}
-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());
}
}
@@ -1005,18 +1013,18 @@ void QS60Style::handleDynamicLayoutVariantSwitch()
d->setActiveLayout();
#endif // QT_S60STYLE_LAYOUTDATA_SIMULATED
d->refreshUI();
+ d->setThemePalette(qApp);
foreach (QWidget *widget, QApplication::allWidgets())
- d->setThemePalette(widget);
+ widget->ensurePolished();
}
void QS60Style::handleSkinChange()
{
Q_D(QS60Style);
d->clearCaches();
- foreach (QWidget *topLevelWidget, QApplication::allWidgets()){
- d->setThemePalette(topLevelWidget);
- topLevelWidget->update();
- }
+ d->setThemePalette(qApp);
+ foreach (QWidget *topLevelWidget, QApplication::allWidgets())
+ topLevelWidget->ensurePolished();
}
QT_END_NAMESPACE
diff --git a/tests/auto/qwidget/tst_qwidget.cpp b/tests/auto/qwidget/tst_qwidget.cpp
index d493219..110a4e0 100644
--- a/tests/auto/qwidget/tst_qwidget.cpp
+++ b/tests/auto/qwidget/tst_qwidget.cpp
@@ -8790,8 +8790,8 @@ void tst_QWidget::toplevelLineEditFocus()
#endif
QTest::qWait(200);
- QCOMPARE(QApplication::activeWindow(), &w);
- QCOMPARE(QApplication::focusWidget(), &w);
+ QCOMPARE(QApplication::activeWindow(), (QWidget*)&w);
+ QCOMPARE(QApplication::focusWidget(), (QWidget*)&w);
}
QTEST_MAIN(tst_QWidget)