qml入门学习(一):hello world
自动生成:
day1.pro
QT += quick
CONFIG += c++11# The following define makes your compiler emit warnings if you use
# any Qt feature that has been marked deprecated (the exact warnings
# depend on your compiler). Refer to the documentation for the
# deprecated API to know how to port your code away from it.
DEFINES += QT_DEPRECATED_WARNINGS# You can also make your code fail to compile if it uses deprecated APIs.
# In order to do so, uncomment the following line.
# You can also select to disable deprecated APIs only up to a certain version of Qt.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0SOURCES += \main.cppRESOURCES += qml.qrc# Additional import path used to resolve QML modules in Qt Creator's code model
QML_IMPORT_PATH =# Additional import path used to resolve QML modules just for Qt Quick Designer
QML_DESIGNER_IMPORT_PATH =# Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target
main.cpp
#include <QGuiApplication>
#include <QQmlApplicationEngine>int main(int argc, char *argv[])
{QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);QGuiApplication app(argc, argv);QQmlApplicationEngine engine;engine.load(QUrl(QStringLiteral("qrc:/main.qml")));if (engine.rootObjects().isEmpty())return -1;return app.exec();
}
main.qml
import QtQuick 2.12
import QtQuick.Window 2.12Window {visible: truewidth: 640height: 480title: qsTr("Hello World")
}
运行
qml入门学习(一):hello world相关推荐
- qml入门学习(八):通过loader对象动态加载和移除组件
DynamicBtn.qml: import QtQuick 2.7 import QtQuick.Controls 2.0Button {id: btnproperty var backColor: ...
- qml入门学习(七):单独文件自定义组件
自定义组件:DateTimeLabel.qml import QtQuick 2.12 import QtQuick.Window 2.12 import QtQuick.Controls 2.12L ...
- qml入门学习(六):Component组件
代码 import QtQuick 2.12 import QtQuick.Window 2.12 import QtQuick.Controls 2.12 import QtQuick.Layout ...
- qml入门学习(二):引入js文件
运行结果: day1.pro QT += quick CONFIG += c++11# The following define makes your compiler emit warnings i ...
- qml入门学习(五):alias
例: 运行结果:
- qml入门学习(四):附加信号Component.onCompleted和Component.onDestruction
例1: 例2:类似于构造函数和析构函数,一个在组件加载完成时调用,一个在组件消解(这里是程序关闭时)调用 例3:例2的升级版 例3运行结果:
- qml入门学习(三):Item
例1: 例2:Item结合外部图片加载使用 例3: 例4:
- python速成要多久2019-8-28_2019最全Python入门学习路线,不是我吹,绝对是最全
近几年Python的受欢迎程度可谓是扶摇直上,当然了学习的人也是愈来愈多.一些学习Python的小白在学习初期,总希望能够得到一份Python学习路线图,小编经过多方汇总为大家汇总了一份Python学 ...
- MAYA 2022基础入门学习教程
流派:电子学习| MP4 |视频:h264,1280×720 |音频:AAC,48.0 KHz 语言:英语+中英文字幕(根据原英文字幕机译更准确)|大小解压后:3.41 GB |时长:4.5小时 包含 ...
最新文章
- 设计模式在外卖营销业务中的实践
- Eclipse插件安装的三种方法
- [云炬python3玩转机器学习] 5-7,8 多元线性回归正规解及其实现
- C/C++还能混合编程
- Basler相机SDK相关问题收集与知识汇总
- JavaOne 2016 Essentials:7个您不容错过的事件和会话
- java imageview的使用_Android使用控件ImageView加载图片的方法
- gitlab设置邮件服务器_如何设置您自己的一次性电子邮件服务器
- ListView实现多种item布局的方法和注意事项
- 利用存储过程录入连续的素数序列
- java 连接eureka_在同一应用程序中的配置服务器和eureka服务器:尝试连接到localhost:8761...
- git 移除项目版本控制_Git - .gitignore怎么忽略已经被版本控制的文件
- 【升级到Java 17】switch 表达式
- GNU Make 使用手册!
- 天池竞赛 | 中医药领域的问题生成冠军方案
- 计算机视觉项目实战-图像特征检测harris、sift、特征匹配
- Win8系统鼠标右键突然失灵怎么办 win8桌面右键菜单失效怎么修复
- 网络安全法实施 个人信息保护立法还需做什么?
- 在谷歌搜索中胜出的视频缩略图
- 华为校招前端开发一面