我是 Blackberry 10 开发和整个 qt 信号槽机制的新手。 当用户单击我的 Blackberry 10 native 应用程序中的不同选项卡时,我正在尝试注册信号和插槽。我的 UI 有以下代码:
TabbedPane {
id: mainTabbedPane
showTabsOnActionBar: true
peekEnabled: true
sidebarState: SidebarState.VisibleFull
Tab {
...
} //End of first tab
Tab {
...
} //End of second tab
...
applicationui.cpp
AbstractPane *appPane = qmlDocument->createRootObject<AbstractPane>();
if (appPane) {
// Set the main application scene to NavigationPane.
Application::instance()->setScene(appPane);
}
TabbedPane* tabbedPane = appPane->findChild<TabbedPane*>("mainTabbedPane");
qDebug("Pane: %p", tabbedPane);
QObject::connect(tabbedPane, SIGNAL(activeTabChanged(bb::cascades::Tab*)), SLOT(sectionTriggered(bb::cascades::Tab*)));
我的问题是,尽管在 UI 中,但似乎找不到 TabbedPane。我做错了什么?另外,我是否正确实现了信号槽?
提前谢谢你。
最佳答案
您还可以在 QML 中使用 onTriggered,因此您可以通过这种方式获得它。取决于你想要什么
Tab {
title: "Tab name"
onTriggered: {
}
},
但是要直接解决您的问题,您缺少 objectName
TabbedPane {
id: mainTabbedPane
objectName: "mainTabbedPane"
showTabsOnActionBar: true
peekEnabled: true
sidebarState: SidebarState.VisibleFull
Tab {
...
} //End of first tab
Tab {
...
} //End of second tab
关于c++ - 用于 TabbedPane Blackberry 10 的信号槽,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34231136/