Hello Friend,
I am working with QT application in which i have to show icon of application which installed of device .
can any one help me .How to get icon of application.
I will be very thankful for replay
amit sharma
Hello Friend,
I am working with QT application in which i have to show icon of application which installed of device .
can any one help me .How to get icon of application.
I will be very thankful for replay
amit sharma
You are trying to do a very complex application.
I believe you would need AllFiles capability to read the icon files, and even then it might not be possible - I have not done this my self.
Also the icons are stored in .MIF file format which you can't show in Qt by default.
And if you are thinking of actually launching the application and showing the icon before that - that would be very difficult, if not impossible, to do as well.
And just to clarify; you can launch other applications. But showing the icons is most likely impossible.
Please see:
http://wiki.forum.nokia.com/index.ph...ications_in_Qt
And also this deprecated example:
http://wiki.forum.nokia.com/index.ph..._its_UID_in_Qt
AFAIK no API is available in Qt for getting application icons of installed applications. But if i am not wrong then you can get it using Symbian API without AllFiles capability.
1)Get UID's of installed applications.
2)Using UID get icon of that application using RApaLsSession::GetAppIcon().
I stand corrected
Still I believe showing the icon in Qt might be problematic?
No, it should work fine. I'd prefer creating the app icon with AknsUtils::CreateAppIconLC to get CFbsBitmaps for mask and actual icon separately,
then call QPixmap::fromSymbianCFbsBitmap to convert those to QPixmaps. AFAIK, there is no direct conversion method for CAknMaskedBitmaps.
For example (un-tested code):
Code://here uid is the appUID you wish to have the icon from MAknsSkinInstance* skin = AknsUtils::SkinInstance(); TSize targetSize(10,10); CFbsBitmap *icon = 0; CFbsBitmap *mask = 0; AknsUtils::CreateAppIconLC(skin, uid, EAknsAppIconTypeList , icon, mask); QPixmap pixmap = 0; if (icon) { AknIconUtils::DisableCompression(icon); TInt error = AknIconUtils::SetSize(icon, targetSize, EAspectRatioNotPreserved); if (!error) pixmap = QPixmap::fromSymbianCFbsBitmap(icon); } if (mask && !pixmap.isNull) { AknIconUtils::DisableCompression(mask); TInt error = AknIconUtils::SetSize(mask, targetSize, EAspectRatioNotPreserved); if (!error) pixmap.setAlphaChannel(QPixmap::fromSymbianCFbsBitmap(mask)); }
Thanks for reply....
but given code having error like :
"undefiend refference to AknIconUtils:isableCompression(icon)"
do you have any solution of this error ?
i will be very thankful for your reply...
is liker error have you added the libs to pro file."undefiend refference to AknIconUtils:isableCompression(icon)"
thank you very much Fuzzbender. now i am getting icon of application.
Thanks for reply ,
now i am getting icon image of application.
here is the code
--------------------------------------
//--------------new implementation-----------------
TUid uid ={0xA89FA522};
MAknsSkinInstance* skin = AknsUtils::SkinInstance();
TSize targetSize(80,80);
CFbsBitmap *icon = 0;
CFbsBitmap *mask = 0;
AknsUtils::CreateAppIconLC(skin, uid, EAknsAppIconTypeList , icon, mask);
QPixmap pixmap = 0;
if (icon) {
AknIconUtils:isableCompression(icon);
TInt error = AknIconUtils::SetSize(icon, targetSize, EAspectRatioNotPreserved);
if (!error)
pixmap = QPixmap::fromSymbianCFbsBitmap(icon);
}
if (mask && !pixmap.isNull()) {
AknIconUtils:isableCompression(mask);
TInt error = AknIconUtils::SetSize(mask, targetSize, EAspectRatioNotPreserved);
if (!error)
pixmap.setAlphaChannel(QPixmap::fromSymbianCFbsBitmap(mask));
}
label->setPixmap(pixmap);
// here your icon is in pixmap and now you can put this pixmap into lable to show icon of application.