qt 利用qml编写控制程序
2017-01-10 14:48
447 查看
TEMPLATE = app QT += qml quick CONFIG += c++11 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)
import QtQuick 2.5
import QtQuick.Controls 1.3
import QtQuick.Window 2.2
//window containing the application
ApplicationWindow {
//title of the application
visible: true
title: qsTr("Hello World")
width: 640
height: 480
//menu containing two menu items
menuBar: MenuBar {
Menu {
title: qsTr("File")
MenuItem {
text: qsTr("&Open")
onTriggered: console.log("Open action triggered");
}
MenuItem {
text: qsTr("Exit")
onTriggered: Qt.quit();
}
}
}
//Content Area
//a button in the middle of the content area
Button {
text: qsTr("Hello World")
anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter
}
}
#include <QGuiApplication>
#include <QQmlApplicationEngine>
int main(int argc, char *argv[])
{
QGuiApplication app(argc, argv);
QQmlApplicationEngine engine;
engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
return app.exec();
}
相关文章推荐
- 利用a、s、w、d来控制移动 按下空格会发射子弹 最简单的语法用心编写也会有好的程序
- 问题:利用 C++的各种控制语句编写一个万年历程序。 要求:显示任何年份的日历,日历以月份顺序排列,每月以星期顺序排列,类似于一 般挂历上的格式。
- 利用QT编写一个简单爬虫程序
- Windows操作系统下面利用C++语言进行内存共享程序的编写
- 编写一个最有代表意义的qt程序
- 利用socket编写windows和linux通讯程序
- 如何利用VB编写NT服务程序
- 利用Delphi编写Socket通信程序
- 用QTDesigner编写Linux的图形界面程序
- 利用Delphi编写Socket通信程序
- 利用Delphi编写Socket通信程序
- 利用pcap编写自己的sniffer程序
- 利用热键控制鼠标移动的一个程序
- 编写云台控制程序
- 利用socket编写windows和linux通讯程序
- 利用delphi编写Socket通讯程序
- 利用Java编写HTML文件分析程序
- Java中利用JMF编写摄像头拍照程序(转自:天极开发者网络)
- 利用java编写网络通信程序
- 编写VB打印控制程序