BB10-将QML标题从C++; 我对C++和QML很陌生,所以我想教我自己的方法!我正在尝试更改QML标头对象的“title”属性。我目前正在GitHub上开发pushCollector cascades示例背后的应用程序
我在其他地方读到过,我可以指定一个属性别名并以这种方式进行BB10-将QML标题从C++; 我对C++和QML很陌生,所以我想教我自己的方法!我正在尝试更改QML标头对象的“title”属性。我目前正在GitHub上开发pushCollector cascades示例背后的应用程序,c++,qml,blackberry-10,C++,Qml,Blackberry 10,我在其他地方读到过,我可以指定一个属性别名并以这种方式进行 NavigationPane { id: navPane property alias connectionText:connectionStatus.title Page { Container { Header { id: connectionStatus title: "Connection Status:" verticalAlig
NavigationPane {
id: navPane
property alias connectionText:connectionStatus.title
Page {
Container {
Header {
id: connectionStatus
title: "Connection Status:"
verticalAlignment: VerticalAlignment.Bottom
bottomMargin: 0.0
topMargin: 0.0
visible: true
subtitle: ""
}
我的问题是,如何创建一个void函数,该函数可以在调用该函数时动态更改标题。我需要这样的东西
void App:changeConnectionText(const QString new Text)
{
//change object title in QML
}
谢谢 将此添加到.cpp中
#include <bb/cascades/Header>
和QML
Header {
id: connectionStatus
objectName: "connectionStatus" //add this!!!
title: "Connection Status:"
verticalAlignment: VerticalAlignment.Bottom
bottomMargin: 0.0
topMargin: 0.0
visible: true
subtitle: ""
}
经过测试,它是有效的
changeConnectionText("Yay, connected!");
Header {
id: connectionStatus
objectName: "connectionStatus" //add this!!!
title: "Connection Status:"
verticalAlignment: VerticalAlignment.Bottom
bottomMargin: 0.0
topMargin: 0.0
visible: true
subtitle: ""
}