QML
zhaoyong8871
擅长C/C++ Qt4 Qt5 QML 嵌入式
展开
-
QML坑记 - ListView GridView
cacheBuffer 属性:此属性将会额外的在现实区域之外,加载并实例化delegate,delegate 的数量由delegate 的高度以及cacheBuffer 的大小决定。官方描述:提示:这里描述项目中遇到的问题:例如:数据传输过程中数据不时出现丢失的情况,偶尔会丢失一部分数据APP 中接收数据代码:cacheBuffer : intThis property determines whether delegates are retained outside the visib原创 2020-12-04 14:47:24 · 818 阅读 · 0 评论 -
QML 坑记 - RowLayout
RowLayoutRowLayout 坑1:RowLayout 坑1:此问题为我项目中遇到的问题记录,可能不具备普适性,特此说明。使用clip 属性会覆盖RowLayout的内容,界面一片空白。错误代码如下:Item { width: GridView.view.width height: 150 //clip: true //don't use the clip property when using the RowLayou原创 2020-12-01 14:17:37 · 1186 阅读 · 0 评论 -
QML 磁盘缓冲文件 - The QML Disk Cache
当Qt App 加载一个QML文件或者一个javascript 文件时,QML引擎会将文件编译成字节码的形式,并运行它。这个编译过程是耗时的,而且后续的加载同样的文件也会产生同样的效果。为了优化这个步骤,QML引擎可以缓存该文件。它将字节码缓存到磁盘上的某个位置,具体位置由QStandardPaths::CacheLocation/qmlcache 决定。同样的你也可以在pro文件中指定CONFIG += qtquickcompiler ,它会将字节码预先编译出来,并集成到你的二进制文件中去,这样可加原创 2020-11-19 11:01:41 · 667 阅读 · 0 评论 -
QML 如何区分平台类型 例如:linux ,windows, wasm ...
QML 区分平台类型的属性:Qt.platform.osQML 获取可执行文件的路径:在cpp 文件中添加:view.rootContext()->setContextProperty("gAppPath", QApplication::applicationDirPath());然后在QML中使用gAppPath 即可。实例代码:property FontLoader digitFontLoader: FontLoader { id: digitalFont原创 2020-11-09 10:56:03 · 1124 阅读 · 0 评论 -
QML控件之 RowLayout
水平布局管理器:RowLayout 与之对应的是 ColumnLayout可以改变RowLayout 的如下四个属性,从而改变Item的位置: Layout.alignment: Qt.AlignBottom Layout.topMargin: 15 Layout.bottomMargin: -25 Layout.leftMargin:-5原创 2020-10-20 22:16:45 · 3978 阅读 · 0 评论 -
QML控件之 Repeater
有多个重复的控件时,使用Repeater 效果比较好,如下是代码示例以及运行效果Repeater { model: ListModel { ListElement { color4: "lightgreen";text4: qsTr("LL"); value4: "2"; } ListElement { color4: "mediumseagreen";text4:原创 2020-10-20 22:08:56 · 840 阅读 · 0 评论 -
Qt QML signal slots
C++的中的信号与槽使用Qt5 的C++ 在头文件中 signal and slots 声明如下:signals: void signal1xxx(); void signal2xxx();slots: void slots1(); void slots2();信号与槽的链接必须使用connect 函数将其关联。QObject::connect(sender,signal,receiver,slot)QML 中的信号与槽在QML文件中,定义与使用如下:import Qt原创 2020-07-29 18:09:03 · 401 阅读 · 0 评论 -
Choosing the Correct Integration Method Between C++ and QML
To quickly determine which integration method is appropriate for your situation, the following flowchart can be used:原创 2020-07-27 16:27:38 · 144 阅读 · 0 评论 -
plugin cannot be loaded for module “QtQuick.Controls“: Cannot load library
环境:vs2019 + Qt5.15.0 + Win10使用命令行终端:windeployqt app.exe 的形式部署QML的程序后,再将qml目录全部拷贝到app.exe 目录下,双击执行程序,出现如下错误:qrc:/main.qml:2:1: plugin cannot be loaded for module “QtQuick.Controls”: Cannot load library C:\Users\sesa547092\Desktop\hmi_rmd_vs2019\qml\QtQui原创 2020-07-14 20:47:46 · 5195 阅读 · 0 评论 -
QML Object 自定义的QML组件,首字母必须大写
A QML object type is a type from which a QML object can be instantiated.In syntactic terms, a QML object type is one which can be used to declare an object by specifying the type name followed by a set of curly braces that encompasses the attributes of th原创 2020-05-26 11:02:31 · 657 阅读 · 0 评论