我正在Symbian/S60平台上使用Qt构建一个应用程序,我想知道是否有一个标准的通知窗口可以用来向用户传递消息。以其他平台为例,我正在寻找与Javascript的alert()方法或Cocoa的NSRunAlert*方法等效的方法。
如果没有原生的Symbian/S60等效项,Qt空间中是否有我应该查看的内容?QMessageBox似乎并没有像我预期的那样工作。
发布于 2010-06-25 18:15:32
您可以在任何Symbian代码中使用RNotifier类(也可以从Qt中使用)。这个类甚至可以显示来自无窗口程序的通知,比如Symbian服务器。它使用起来很简单:
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();在User::WaitForRequest(lStatus)完成之后,您可以检查buttonVal的值,以了解按下了哪个按钮。如果选择左按钮,则设置为: 0;如果选择右按钮,则设置为1。
希望这能有所帮助。
发布于 2009-10-30 02:50:40
显然,没有一种方法可以从Qt中访问本地通知窗口。我确实发现了以下内容:
//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");仍然不是我想要的,但它将不得不这样做。
来源:Nokia
https://stackoverflow.com/questions/1637671
复制相似问题