summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJanne Anttila <janne.anttila@digia.com>2010-02-05 12:01:17 (GMT)
committerJason McDonald <jason.mcdonald@nokia.com>2010-02-08 18:47:26 (GMT)
commitb08bb490821ae9337d5bcf18d5d547e81a0982d2 (patch)
tree5299867f304bb1f1bee827f9554a84d26e970cd5
parent952a5d0ce1d734a649d89c78b1adb3ebfd50ca75 (diff)
downloadQt-b08bb490821ae9337d5bcf18d5d547e81a0982d2.zip
Qt-b08bb490821ae9337d5bcf18d5d547e81a0982d2.tar.gz
Qt-b08bb490821ae9337d5bcf18d5d547e81a0982d2.tar.bz2
Fix to S60 softkey pressed down image.
On Symbian the icons which are passed to softkeys, i.e. to actions with softkey role, need to use pixmap alpha channel instead of mask. Otherwise S60 CBA framework fails to create 50% transparent pressed down mask for softkey icon. Task-number: QTBUG-7314 Review-By: Sami Merila (cherry picked from commit 95012c3ca7ef52ea8f2a2ecb67987b8575758987)
-rw-r--r--src/gui/kernel/qaction.cpp4
-rw-r--r--src/gui/kernel/qsoftkeymanager_s60.cpp19
2 files changed, 12 insertions, 11 deletions
diff --git a/src/gui/kernel/qaction.cpp b/src/gui/kernel/qaction.cpp
index ad38cf9..21cc5b5 100644
--- a/src/gui/kernel/qaction.cpp
+++ b/src/gui/kernel/qaction.cpp
@@ -715,6 +715,10 @@ QActionGroup *QAction::actionGroup() const
it is displayed to the left of the menu text. There is no default
icon.
+ On Symbian the icons which are passed to softkeys, i.e. to actions with
+ softkey role, need to have pixmap alpha channel correctly set otherwise
+ drawing artifacts will appear when softkey is pressed down.
+
If a null icon (QIcon::isNull() is passed into this function,
the icon of the action is cleared.
*/
diff --git a/src/gui/kernel/qsoftkeymanager_s60.cpp b/src/gui/kernel/qsoftkeymanager_s60.cpp
index a72d16c..af84a8f 100644
--- a/src/gui/kernel/qsoftkeymanager_s60.cpp
+++ b/src/gui/kernel/qsoftkeymanager_s60.cpp
@@ -237,21 +237,18 @@ bool QSoftKeyManagerPrivateS60::setSoftkeyImage(CEikButtonGroupContainer *cba,
// prepareSoftkeyPixmap creates a new pixmap with requiredIconSize and blits the 'pmWihtAspectRatio'
// to correct location of it
QPixmap softkeyPixmap = prepareSoftkeyPixmap(pmWihtAspectRatio, position, requiredIconSize);
- QBitmap softkeyMask = softkeyPixmap.mask();
- if (softkeyMask.isNull()) {
- softkeyMask = QBitmap(softkeyPixmap.size());
- softkeyMask.fill(Qt::color1);
- }
- // Softkey mask in > SV_S60_5_1 has to be inverted
- if(QSysInfo::s60Version() > QSysInfo::SV_S60_5_1) {
- QImage maskImage = softkeyMask.toImage();
- maskImage.invertPixels();
- softkeyMask = QPixmap::fromImage(maskImage);
+ QPixmap softkeyAlpha = softkeyPixmap.alphaChannel();
+ // Alpha channel in 5.1 and older devices need to be inverted
+ // TODO: Switch to use toSymbianCFbsBitmap with invert when available
+ if(QSysInfo::s60Version() <= QSysInfo::SV_S60_5_1) {
+ QImage alphaImage = softkeyAlpha.toImage();
+ alphaImage.invertPixels();
+ softkeyAlpha = QPixmap::fromImage(alphaImage);
}
CFbsBitmap* nBitmap = softkeyPixmap.toSymbianCFbsBitmap();
- CFbsBitmap* nMask = softkeyMask.toSymbianCFbsBitmap();
+ CFbsBitmap* nMask = softkeyAlpha.toSymbianCFbsBitmap();
CEikImage* myimage = new (ELeave) CEikImage;
myimage->SetPicture( nBitmap, nMask ); // nBitmap and nMask ownership transfered