开发者

Standard notifications or alert styles in Symbian (Qt/S60)?

开发者 https://www.devze.com 2022-12-09 12:28 出处:网络
I\'m building a an application using Qt on the Symbian/S60 platform and I was wondering if there was a standard notification window that I could use to pass messages to users. Using other platforms as

I'm building a an application using Qt on the Symbian/S60 platform and I was wondering if there was a standard notification window that I could use to pass messages to users. Using other platforms as examples, I'm looking for something equivalent to Javascript's alert() method or Cocoa's NSRunAlert* methods.

If there is not a native Symbian/S开发者_Python百科60 equivalent, is there something in the Qt space that I should be looking at? QMessageBox didn't seem to work as I might expect.


Apparently there is not a way to access the native notification windows from Qt proper. I did find the following:

//Create warning message box
QMessageBox::warning(0,"Warning", "Warning message text");
//Create information message box
QMessageBox::information(0, "Information", "Information message text");
//Create critical message box
QMessageBox::critical(0, "Critical", "Critical message text");

Still not what I'm looking for, but it will have to do.

Source: Nokia


You can use RNotifier class from any Symbian code (and from Qt too). This class can show notifications even from window-less programs, like Symbian servers. It is simple to use:

    RNotifier notifier;
    User::LeaveIfError(notifier.Connect());
    TInt buttonVal;
    TRequestStatus lStatus;
    notifier.Notify(_L("First line of notification"), _L("Second line of notification"), _L("Left button text"), _L("Right button text"), buttonVal, lStatus);
    User::WaitForRequest(lStatus);
    notifier.Close();

After User::WaitForRequest(lStatus) completes you can inspect value of buttonVal to know which button was pressed. It is set to: 0, if the left button is selected; 1, if the right button is selected.

Hope this helps.

0

精彩评论

暂无评论...
验证码 换一张
取 消