Symbian-Developers

The Official Developers Section => Symbian Software Development Discussions => The Developers Section => Qt Application Development => Topic started by: huellif on August 26, 2013, 11:15:02 pm

Title: CAknDiscreetpopup from Qt/QML
Post by: huellif on August 26, 2013, 11:15:02 pm
You don't like the QML info banner?

Well what about a native CAknDiscreetpopup?
It's visible in all other apps, not only in your app.

Add to your .pro:
Code: [Select]
LIBS += -lavkon\

to your class:
Code: [Select]
#include <akndiscreetpopup.h>
and also if you want a long popup
Code: [Select]
#include <aknnotewrappers.h>

so now everything is read for the 4 possible methods:


1.)use this simple method to call the popup for 1.5 seconds:
Code: [Select]
TRAP_IGNORE(CAknDiscreetPopup::ShowGlobalPopupL((_L("title")), (_L("message")),KAknsIIDNone, KNullDesC));


2.) for 3.0 seconds:
Code: [Select]
TRAP_IGNORE(CAknDiscreetPopup::ShowGlobalPopupL((_L("title")), (_L("message")),KAknsIIDNone, KNullDesC, 0, 0, KAknDiscreetPopupDurationLong, 0, NULL));

If you touch this popup nothing happen, but I guess you want to bring your app in forgound when the user does touch it.

3) for 3 seconds popup:
Code: [Select]
TRAP_IGNORE(CAknDiscreetPopup::ShowGlobalPopupL((_L("title")), (_L("message")),KAknsIIDNone, KNullDesC, 0, 0, KAknDiscreetPopupDurationLong, 0, NULL, {0xXXXXXXX}));


4)for 1.5 seconds popup:
Code: [Select]
TRAP_IGNORE(CAknDiscreetPopup::ShowGlobalPopupL((_L("title")), (_L("message")),KAknsIIDNone, KNullDesC, 0, 0, 0, 0, NULL, {0xXXXXXXX}));

for 0xXXXXXXX set the UID of your app.

of course you can use QStrings instead of native _L
convert them via:
Code: [Select]
QString qtitle = "Title";
TPtrC16 stitle(reinterpret_cast<const TUint16*>(qtitle.utf16()));

QString qmessage = "Message";
TPtrC16 smessage(reinterpret_cast<const TUint16*>(qmessage.utf16()));

TRAP_IGNORE(CAknDiscreetPopup::ShowGlobalPopupL(stitle, smessage,KAknsIIDNone, KNullDesC));

thanks Il.Socio for your help :)
Title: Re: CAknDiscreetpopup from Qt/QML
Post by: Allstar12345 on August 31, 2013, 04:38:52 pm
Any chance of a little built example ?
Left me with a billion errors ::)
Title: Re: CAknDiscreetpopup from Qt/QML
Post by: huellif on September 01, 2013, 12:16:14 am
sure wait a bit :)
Title: Re: CAknDiscreetpopup from Qt/QML
Post by: huellif on September 02, 2013, 08:21:45 pm
an easy example is attached:

[attachment deleted by admin]
Title: Re: CAknDiscreetpopup from Qt/QML
Post by: huellif on September 03, 2013, 02:21:58 am
I got a request, here's a new example.
Changelog:
- you can enter title and content from QtQuick
- you can directly set both from QtQuick

[attachment deleted by admin]
Title: Re: CAknDiscreetpopup from Qt/QML
Post by: yeatse on November 25, 2013, 11:27:56 am
Thanks for your nice share. It really helped me a lot.
What's more, can I add a icon, my app's desktop icon for example, into this popup ?
Title: Re: CAknDiscreetpopup from Qt/QML
Post by: huellif on November 29, 2013, 01:52:18 am
yes it's possible :)
But I never tried to, maybe you could have a look at the header file: http://pastebin.com/zfXGWfeF