Commit 95012c3ca7ef52ea8f2a2ecb67987b8575758987

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
src/gui/kernel/qaction.cpp
(4 / 0)
  
715715 it is displayed to the left of the menu text. There is no default
716716 icon.
717717
718 On Symbian the icons which are passed to softkeys, i.e. to actions with
719 softkey role, need to have pixmap alpha channel correctly set otherwise
720 drawing artifacts will appear when softkey is pressed down.
721
718722 If a null icon (QIcon::isNull() is passed into this function,
719723 the icon of the action is cleared.
720724*/
src/gui/kernel/qsoftkeymanager_s60.cpp
(8 / 11)
  
237237 // prepareSoftkeyPixmap creates a new pixmap with requiredIconSize and blits the 'pmWihtAspectRatio'
238238 // to correct location of it
239239 QPixmap softkeyPixmap = prepareSoftkeyPixmap(pmWihtAspectRatio, position, requiredIconSize);
240 QBitmap softkeyMask = softkeyPixmap.mask();
241 if (softkeyMask.isNull()) {
242 softkeyMask = QBitmap(softkeyPixmap.size());
243 softkeyMask.fill(Qt::color1);
244 }
245240
246 // Softkey mask in > SV_S60_5_1 has to be inverted
247 if(QSysInfo::s60Version() > QSysInfo::SV_S60_5_1) {
248 QImage maskImage = softkeyMask.toImage();
249 maskImage.invertPixels();
250 softkeyMask = QPixmap::fromImage(maskImage);
241 QPixmap softkeyAlpha = softkeyPixmap.alphaChannel();
242 // Alpha channel in 5.1 and older devices need to be inverted
243 // TODO: Switch to use toSymbianCFbsBitmap with invert when available
244 if(QSysInfo::s60Version() <= QSysInfo::SV_S60_5_1) {
245 QImage alphaImage = softkeyAlpha.toImage();
246 alphaImage.invertPixels();
247 softkeyAlpha = QPixmap::fromImage(alphaImage);
251248 }
252249
253250 CFbsBitmap* nBitmap = softkeyPixmap.toSymbianCFbsBitmap();
254 CFbsBitmap* nMask = softkeyMask.toSymbianCFbsBitmap();
251 CFbsBitmap* nMask = softkeyAlpha.toSymbianCFbsBitmap();
255252
256253 CEikImage* myimage = new (ELeave) CEikImage;
257254 myimage->SetPicture( nBitmap, nMask ); // nBitmap and nMask ownership transfered

Comments

Add a new comment:

Login or create an account to post a comment

Add your comment