【发布时间】:2014-06-14 23:57:14
【问题描述】:
我一直在尝试使用 Qt Quick Application 在 Qt Designer 中制作一个简单的测试应用程序。但是,当我运行它时,我在 Qt 设计器中实现的任何内容都不会显示。例如,“Testing Qt Designer”文本没有出现,因为我在设计器中实现了它。我试图清理构建,并再次构建它。我还删除了整个构建文件夹并尝试再次构建它,但这不起作用。谁能帮我让 Qt Designer 工作?
我在 Windows 8.1 64 位上使用 Qt Creator 5.3。
main.qml:
import QtQuick 2.2
import QtQuick.Controls 1.1
ApplicationWindow {
visible: true
width: 640
height: 480
title: qsTr("Hello World")
menuBar: MenuBar {
Menu {
title: qsTr("File")
MenuItem {
text: qsTr("Exit")
onTriggered: Qt.quit();
}
}
}
Text {
text: qsTr("Hello World")
anchors.centerIn: parent
}
Text {
id: text1
x: -258
y: -151
width: 264
height: 76
text: qsTr("Testing Qt Designer")
font.pixelSize: 25
}
}
main.cpp:
#include <QApplication>
#include <QQmlApplicationEngine>
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QQmlApplicationEngine engine;
engine.load(QUrl(QStringLiteral("qrc:///main.qml")));
return app.exec();
}
testApp5.pro:
TEMPLATE = app
QT += qml quick widgets
SOURCES += main.cpp
RESOURCES += qml.qrc
# Additional import path used to resolve QML modules in Qt Creator's code model
QML_IMPORT_PATH =
# Default rules for deployment.
include(deployment.pri)
deployment.pri:
android-no-sdk {
target.path = /data/user/qt
export(target.path)
INSTALLS += target
} else:android {
x86 {
target.path = /libs/x86
} else: armeabi-v7a {
target.path = /libs/armeabi-v7a
} else {
target.path = /libs/armeabi
}
export(target.path)
INSTALLS += target
} else:unix {
isEmpty(target.path) {
qnx {
target.path = /tmp/$${TARGET}/bin
} else {
target.path = /opt/$${TARGET}/bin
}
export(target.path)
}
INSTALLS += target
}
export(INSTALLS)
【问题讨论】: