【问题标题】:Standard notifications or alert styles in Symbian (Qt/S60)?Symbian (Qt/S60) 中的标准通知或警报样式?
【发布时间】:2009-10-28 14:36:55
【问题描述】:

我正在 Symbian/S60 平台上使用 Qt 构建一个应用程序,我想知道是否有一个标准的通知窗口可以用来向用户传递消息。以其他平台为例,我正在寻找与 Javascript 的 alert() 方法或 Cocoa 的 NSRunAlert* 方法等效的东西。

如果没有原生的 Symbian/S60 等价物,Qt 空间中是否有我应该关注的东西? QMessageBox 似乎没有像我预期的那样工作。

【问题讨论】:

    标签: c++ user-interface qt symbian s60


    【解决方案1】:

    显然没有办法从 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

    【讨论】:

      【解决方案2】:

      您可以从任何 Symbian 代码(以及 Qt 代码)中使用 RNotifier 类。此类甚至可以显示来自无窗口程序(如 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,如果选择了右键。

      希望这会有所帮助。

      【讨论】:

      • 我最终使用了这种方法的变体,但仍然感谢您的回答。 :-)
      猜你喜欢
      • 1970-01-01
      • 2023-03-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多