QT for Android 使用Item作为QML根对象
来源:互联网 发布:ip 80端口需要备案不 编辑:程序博客网 时间:2024/06/03 19:41
如果将main.qml中的Window替换为Rectangle,再将main.cpp修改成下面的样子;
#include<QGuiApplication>
//#include <QQmlApplicationEngine>
#include <QQuickView>
int main(int argc, char *argv[])
{
QGuiApplication app(argc, argv);
QQuickView viewer;
viewer.setResizeMode(QQuickView::SizeRootObjectToView);
viewer.setSource(QUrl("qrc:///main.qml"));
viewer.show();
return app.exec();
//QGuiApplication app(argc, argv);
//QQmlApplicationEngine engine;
//engine.load(QUrl(QStringLiteral("qrc:///main.qml")));
//return app.exec();
}
这样,在main.xml文件中就可以这样写;
importQtQuick 2.2
//import QtQuick.Window 2.1
Rectangle{
width:320;
height: 480;
color:"red";
MouseArea {
anchors.fill: parent
onClicked: {
Qt.quit();
}
}
Text {
text: qsTr("Hello World")
anchors.centerIn: parent
}
}
0 0
- QT for Android 使用Item作为QML根对象
- 使用QML 布局Qt for Android
- QML for QT 1
- Qt for android 截屏、Qml保存图片到本地
- Qt for android QML无法运行问题处理
- JavaScript for Qt Quick(QML)
- QT程序员使用QML
- qt中使用QML
- Qt:使用C++还是QML
- QT:使用C++还是QML
- Qt:使用C++还是QML
- Qt for Android 使用 手记
- Qt for Android QML实现缩放、拖拽、长按效果简单示例
- Qt QML 入门 — 使用C++定义QML类型
- 第二篇 QT程序员使用QML
- 详解 Qt Quick 开始使用QML编程
- Qt: 使用QML来创建界面
- QML如何结合Qt使用GridView
- [Java]集合架构分析
- 延迟初始化 beans
- IOS开发学习实例之微信消息页
- 分享GRE写作素材中的常用词
- 第一章,Hello World(Lua)
- QT for Android 使用Item作为QML根对象
- 微软100题(96)strcpy的实现
- virtualenv安装
- 寻找第K大的数
- sqlite数据库报错:database disk image is malformed
- 算法学习之数组元素查找
- Java相对路径读取文件
- ubuntu 下 eclipse Ctrl+Alt+Down 不工作
- sizeof与offsetof有关的结构体详解