c++ - 来自 C++ BB10 的导航 Pane 弹出

标签 c++ blackberry-10

我现在仅使用 C++ 创建我的应用程序,我创建了 NavigationPane 并添加了包含我需要的 View 的容器。它工作正常,但我想捕获一个单击的按钮,以使导航 Pane 弹出当前页面并推送不同的(在运行时创建的)页面。

如何实现它,我尝试使用信号,但我认为我不明白信号和 QT_SLOTS 是如何工作的,在 NavigationPane 的情况下,它没有 QT_SLOT 那样的方法。

如有任何建议,我们将不胜感激。

最佳答案

您首先需要将 Buttonclicked() 信号连接到 NavigationPane< 的 pop() 插槽。它应该看起来像这样:

// Connect the button's clicked() signal to the navigation pane's
//  pop() slot. 
bool connectResult = QObject::connect(myButton, 
     SIGNAL(clicked()), 
     myPane, 
     SLOT(pop()));

// Use the Q_ASSERT() function to test the return value and 
// generate a warning message if the signal slot connection 
// wasn’t successful.
Q_ASSERT(connectResult);

// Indicate that the variable connectResult isn't used in the 
// rest of the app to prevent a compiler warning.
Q_UNUSED(connectResult);

此页面关于 buttons可能会帮助您了解如何处理这个问题。为了更好地理解如何将对象连接在一起,您可能还需要查看信号和槽文档。

然后,您必须在弹出后创建并推送新页面。为此,您只需将 NavigationPanepopTransitionEnded (bb::cascades::Page *page) 插槽连接到将完成这项工作的自定义函数。

bool connectResult = QObject::connect(myPane, 
     SIGNAL(popTransitionEnded(bb::cascades::Page*)), 
     this,
     SLOT(createNewPageAndPushIt(bb::cascades::Page*)));

Q_ASSERT(connectResult);
Q_UNUSED(connectResult);

参见this page有关使用 NavigationPane 堆叠页面的更多详细信息。

关于c++ - 来自 C++ BB10 的导航 Pane 弹出,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18496569/

相关文章:

c++ - 内存中分配的SQL小表

c++ - 红黑树~1子删除

blackberry - 在 Android、Windows、IOS 上使用 webworks sdk 获取 BBM Pin

cordova - "cordova emulate blackberry10"时出错

c++ - C++ 字符串文字的安全性和可靠性如何?

c++ - 追溯先前遵循的路径

c++ - 在作为参数传递的数组上使用 sizeof

c++ - 在 BB10 应用程序开发的 cpp 文件中包含 <QNetworkAccessManager>、<QNetworkReply> 时出错

c++ - BB 10 解析后导航页面

c++ - 路径定位错误: Program "make" not found in PATH?