//Using QQmlComponent
//QQmlEngine engine;
//QQmlComponent component(&engine,
// QUrl::fromLocalFile("main.qml"));
//QObject *object = XXXXXXXXXXXXeate();
// delete object;
//qml 根对象 Window
QQuickView view(QUrl::fromLocalFile("main.qml"));
XXXXXXXow();
QObject *object = XXXXXXXotObject();
//object = XXXXXXXotContext();
//qml 根对象 Rectangle 或 Item
//auto test_txt1 = object->findChild<QObject*>("test_text1");
//test_txt1->setProperty("text", "00000000");
object->findChild<QObject*>("test_text1"); 返回null
解决方法 qml 中的 控件名要使用 objectName 而不是 id
Text {
objectName:"test_text1" // 注意 必须使用 ""
id: element
x: 292
y: 271
text: qsTr("Text")
font.pixelSize: 28
}
时段 | 个数 |
---|---|
{{f.startingTime}}点 - {{f.endTime}}点 | {{f.fileCount}} |