diff options
author | Janne Anttila <janne.anttila@digia.com> | 2010-02-05 12:01:17 (GMT) |
---|---|---|
committer | Janne Anttila <janne.anttila@digia.com> | 2010-02-05 12:04:36 (GMT) |
commit | 95012c3ca7ef52ea8f2a2ecb67987b8575758987 (patch) | |
tree | 3391a9a39ebc63ead89ab0ed8b0e7723e8cce89a | |
parent | fd12fbcf332878ab6a5b6ef8f09804b8598faced (diff) | |
download | Qt-95012c3ca7ef52ea8f2a2ecb67987b8575758987.zip Qt-95012c3ca7ef52ea8f2a2ecb67987b8575758987.tar.gz Qt-95012c3ca7ef52ea8f2a2ecb67987b8575758987.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
-rw-r--r-- | src/gui/kernel/qaction.cpp | 4 | ||||
-rw-r--r-- | src/gui/kernel/qsoftkeymanager_s60.cpp | 19 |
2 files changed, 12 insertions, 11 deletions
diff --git a/src/gui/kernel/qaction.cpp b/src/gui/kernel/qaction.cpp index 4b7d949..8ddd051 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 |