summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJani Hautakangas <ext-jani.hautakangas@nokia.com>2010-01-22 09:08:08 (GMT)
committerJani Hautakangas <ext-jani.hautakangas@nokia.com>2010-01-22 09:11:00 (GMT)
commitb22b06debf9d7e964244a0a613354be0ea9e07b7 (patch)
tree7feb63a4fc260dc886cfda15b9d26d922a78a6fb
parente575816cd618841e90e8933ff52e40a8581d3328 (diff)
downloadQt-b22b06debf9d7e964244a0a613354be0ea9e07b7.zip
Qt-b22b06debf9d7e964244a0a613354be0ea9e07b7.tar.gz
Qt-b22b06debf9d7e964244a0a613354be0ea9e07b7.tar.bz2
Fix for symbian dialog background transparency.
If Avkon components support transparency then dialog background is transparent enabling rounded corners. Reviewed-by: Sami Merila
-rw-r--r--mkspecs/common/symbian/symbian.conf2
-rw-r--r--src/gui/dialogs/qdialog.cpp16
-rw-r--r--src/gui/kernel/qt_s60_p.h31
-rw-r--r--src/gui/kernel/qwidget.cpp8
-rw-r--r--src/gui/styles/qs60style.cpp12
-rw-r--r--src/gui/styles/qs60style_s60.cpp1
6 files changed, 63 insertions, 7 deletions
diff --git a/mkspecs/common/symbian/symbian.conf b/mkspecs/common/symbian/symbian.conf
index 0f06b92..a2933e9 100644
--- a/mkspecs/common/symbian/symbian.conf
+++ b/mkspecs/common/symbian/symbian.conf
@@ -65,7 +65,7 @@ QMAKE_LINK_OBJECT_SCRIPT=
QMAKE_LIBS = -llibc -llibm -leuser -llibdl
QMAKE_LIBS_CORE = $$QMAKE_LIBS -llibpthread -lefsrv
-QMAKE_LIBS_GUI = $$QMAKE_LIBS_CORE -lfbscli -lbitgdi -lhal -lgdi -lws32 -lapgrfx -lcone -leikcore -lmediaclientaudio -leikcoctl -leiksrv -lapparc
+QMAKE_LIBS_GUI = $$QMAKE_LIBS_CORE -lfbscli -lbitgdi -lhal -lgdi -lws32 -lapgrfx -lcone -leikcore -lmediaclientaudio -leikcoctl -leiksrv -lapparc -lcentralrepository
QMAKE_LIBS_NETWORK =
QMAKE_LIBS_EGL = -llibEGL
QMAKE_LIBS_OPENGL =
diff --git a/src/gui/dialogs/qdialog.cpp b/src/gui/dialogs/qdialog.cpp
index 3650051..9e11ebf 100644
--- a/src/gui/dialogs/qdialog.cpp
+++ b/src/gui/dialogs/qdialog.cpp
@@ -265,6 +265,14 @@ QDialog::QDialog(QWidget *parent, Qt::WindowFlags f)
if (!qt_wince_is_smartphone())
setWindowFlags(windowFlags() | Qt::WindowOkButtonHint | QFlag(qt_wince_is_mobile() ? 0 : Qt::WindowCancelButtonHint));
#endif
+
+#ifdef Q_WS_S60
+ if (S60->avkonComponentsSupportTransparency()) {
+ bool noSystemBackground = testAttribute(Qt::WA_NoSystemBackground);
+ setAttribute(Qt::WA_TranslucentBackground); // also sets WA_NoSystemBackground
+ setAttribute(Qt::WA_NoSystemBackground, noSystemBackground); // restore system background attribute
+ }
+#endif
}
#ifdef QT3_SUPPORT
@@ -294,6 +302,14 @@ QDialog::QDialog(QDialogPrivate &dd, QWidget *parent, Qt::WindowFlags f)
if (!qt_wince_is_smartphone())
setWindowFlags(windowFlags() | Qt::WindowOkButtonHint | QFlag(qt_wince_is_mobile() ? 0 : Qt::WindowCancelButtonHint));
#endif
+
+#ifdef Q_WS_S60
+ if (S60->avkonComponentsSupportTransparency()) {
+ bool noSystemBackground = testAttribute(Qt::WA_NoSystemBackground);
+ setAttribute(Qt::WA_TranslucentBackground); // also sets WA_NoSystemBackground
+ setAttribute(Qt::WA_NoSystemBackground, noSystemBackground); // restore system background attribute
+ }
+#endif
}
/*!
diff --git a/src/gui/kernel/qt_s60_p.h b/src/gui/kernel/qt_s60_p.h
index b417065..2c733b9 100644
--- a/src/gui/kernel/qt_s60_p.h
+++ b/src/gui/kernel/qt_s60_p.h
@@ -74,6 +74,7 @@
#include <akncontext.h> // CAknContextPane
#include <eikspane.h> // CEikStatusPane
#include <aknpopupfader.h> // MAknFadedComponent and TAknPopupFader
+#include <centralrepository.h>
#endif
QT_BEGIN_NAMESPACE
@@ -133,8 +134,14 @@ public:
static inline CAknTitlePane* titlePane();
static inline CAknContextPane* contextPane();
static inline CEikButtonGroupContainer* buttonGroupContainer();
+ static inline bool avkonComponentsSupportTransparency();
TTrapHandler *s60InstalledTrapHandler;
+
+private:
+
+ bool transparencyChecked;
+ bool transparencyEnabled;
#endif
};
@@ -305,6 +312,30 @@ inline CEikButtonGroupContainer* QS60Data::buttonGroupContainer()
{
return CEikonEnv::Static()->AppUiFactory()->Cba();
}
+
+inline bool QS60Data::avkonComponentsSupportTransparency()
+{
+ if(!S60->transparencyChecked) {
+ S60->transparencyChecked = true;
+ S60->transparencyEnabled = false;
+
+ TUid KCRUidAvkon = { 0x101F876E };
+ TUint32 KAknAvkonTransparencyEnabled = 0x0000000D;
+
+ CRepository* repository = 0;
+ TRAPD(err, repository = CRepository::NewL(KCRUidAvkon));
+
+ if(err == KErrNone) {
+ TInt value = 0;
+ err = repository->Get(KAknAvkonTransparencyEnabled, value);
+ if(err == KErrNone) {
+ S60->transparencyEnabled = (value==1) ? true : false;
+ }
+ }
+ }
+
+ return S60->transparencyEnabled;
+}
#endif // Q_WS_S60
static inline QFont qt_TFontSpec2QFontL(const TFontSpec &fontSpec)
diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp
index 81a9a80..542da5e 100644
--- a/src/gui/kernel/qwidget.cpp
+++ b/src/gui/kernel/qwidget.cpp
@@ -2026,6 +2026,14 @@ void QWidgetPrivate::updateIsOpaque()
}
#endif
+#ifdef Q_WS_S60
+ if (q->windowType() == Qt::Dialog && q->testAttribute(Qt::WA_TranslucentBackground)
+ && S60->avkonComponentsSupportTransparency()) {
+ setOpaque(false);
+ return;
+ }
+#endif
+
if (q->testAttribute(Qt::WA_OpaquePaintEvent) || q->testAttribute(Qt::WA_PaintOnScreen)) {
setOpaque(true);
return;
diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp
index ca0b8c7..100303e 100644
--- a/src/gui/styles/qs60style.cpp
+++ b/src/gui/styles/qs60style.cpp
@@ -3056,11 +3056,13 @@ bool qt_s60_fill_background(QPainter *painter, const QRegion &rgn, const QBrush
const QPaintDevice *target = painter->device();
if (target->devType() == QInternal::Widget) {
const QWidget *widget = static_cast<const QWidget *>(target);
- const QVector<QRect> &rects = rgn.rects();
- for (int i = 0; i < rects.size(); ++i) {
- const QRect rect(rects.at(i));
- painter->drawPixmap(rect.topLeft(), backgroundTexture,
- rect.translated(qt_s60_fill_background_offset(widget)));
+ if (!widget->testAttribute(Qt::WA_TranslucentBackground)) {
+ const QVector<QRect> &rects = rgn.rects();
+ for (int i = 0; i < rects.size(); ++i) {
+ const QRect rect(rects.at(i));
+ painter->drawPixmap(rect.topLeft(), backgroundTexture,
+ rect.translated(qt_s60_fill_background_offset(widget)));
+ }
}
}
return true;
diff --git a/src/gui/styles/qs60style_s60.cpp b/src/gui/styles/qs60style_s60.cpp
index be61073..d03574f 100644
--- a/src/gui/styles/qs60style_s60.cpp
+++ b/src/gui/styles/qs60style_s60.cpp
@@ -731,7 +731,6 @@ QPixmap QS60StyleModeSpecifics::createSkinnedGraphicsLX(QS60StylePrivate::SkinFr
MAknsSkinInstance* skinInstance = AknsUtils::SkinInstance();
QPixmap result;
-// QS60WindowSurface::unlockBitmapHeap();
static const TDisplayMode displayMode = S60->supportsPremultipliedAlpha ? Q_SYMBIAN_ECOLOR16MAP : EColor16MA;
static const TInt drawParam = S60->supportsPremultipliedAlpha ? KAknsDrawParamDefault : KAknsDrawParamNoClearUnderImage|KAknsDrawParamRGBOnly;