08 2020 档案

摘要:1、代码 void QJInterface::closeEvent(QCloseEvent *event) { QDialog* log = new QDialog(this); log->setObjectName("log"); log->setStyleSheet("#log{backgrou 阅读全文
posted @ 2020-08-30 00:41 朱小勇 阅读(1170) 评论(0) 推荐(0)
摘要:1、官网 https://sourceforge.net/projects/qroundprogressbar/ 2、下载并加入到工程 3、在ui里拖一个widget,提升为QRoundProgressBar 4、直接使用 ui->round_1->setFormat("%v"); ui->roun 阅读全文
posted @ 2020-08-30 00:15 朱小勇 阅读(849) 评论(0) 推荐(0)
摘要:1、环境准备 .pro里: QT += charts 头文件: #include <QtCharts> 2、在mainwindow.h里定义饼图变量 QPieSeries *series; 3、mainwindow.cpp series = new QPieSeries(); series->app 阅读全文
posted @ 2020-08-29 21:27 朱小勇 阅读(1502) 评论(0) 推荐(1)
摘要:1、效果 2、与swipview一起使用 //index提示器 PageIndicator { id: indicator count: swipeView.count currentIndex: swipeView.currentIndex anchors.bottom: parent.botto 阅读全文
posted @ 2020-08-21 12:50 朱小勇 阅读(430) 评论(0) 推荐(0)
摘要:1、效果 2、自定义路径qml import QtQuick 2.0 Item { property point startPoint: Qt.point(0, 0) property point endPoint: Qt.point(0, 0) property var lineColor: "# 阅读全文
posted @ 2020-08-21 12:44 朱小勇 阅读(909) 评论(0) 推荐(0)
摘要:1、简单的json MouseArea { anchors.fill: parent; onClicked: { var json = '{"result":true, "count":42}'; var obj = JSON.parse(json); console.log(obj.count); 阅读全文
posted @ 2020-08-21 11:33 朱小勇 阅读(2989) 评论(0) 推荐(0)
摘要:QObject的拷贝构造函数是私有的,当把其子类放入容器时无法完成构造其副本。 如下代码便会报错: Mydata data("item1", "red"); QList<QObject> datalist; datalist.append(data); 解决,以指针形式存储: QList<QObje 阅读全文
posted @ 2020-08-09 00:50 朱小勇 阅读(533) 评论(0) 推荐(0)
摘要:一、适用情况 在C++里将数据生成,然后将这个数据设置为qml的上下文属性,在qml里就能使用了 二、传递基础类型 1、main.cpp QQuickWidget *m_widget = new QQuickWidget(this); m_widget->setGeometry(0, 0, this 阅读全文
posted @ 2020-08-08 23:03 朱小勇 阅读(7443) 评论(0) 推荐(0)
摘要:MouseArea { anchors.fill: parent; hoverEnabled: true; cursorShape: (containsMouse? (pressed? Qt.ClosedHandCursor: Qt.OpenHandCursor): Qt.ArrowCursor); 阅读全文
posted @ 2020-08-07 17:39 朱小勇 阅读(1057) 评论(0) 推荐(0)
摘要:1、代码 import QtQuick 2.0 import QtQuick.Controls 2.0 Rectangle { id:root; color: "#19192C"; property int rect_width: 80; property int rect_height: 20; 阅读全文
posted @ 2020-08-07 16:42 朱小勇 阅读(692) 评论(0) 推荐(0)
摘要:1、全等于 2、不等于 !== 阅读全文
posted @ 2020-08-07 14:56 朱小勇 阅读(111) 评论(0) 推荐(0)
摘要:1、var uiRecord: [];//QML语法 2、删除并返回最后一个元素 uiRecord.pop(); 3、清空所有 uiRecord.splice(0,uiRecord.length); uiRecord = []; uiRecord.length = 0; 4、删除第一个元素并返回 u 阅读全文
posted @ 2020-08-07 14:47 朱小勇 阅读(159) 评论(0) 推荐(0)
摘要:SwipeView { id: swipeView z:0; width: parent.width-listView.width; height: parent.height; anchors.left: listView.right; interactive: false;//禁止手拖动 cur 阅读全文
posted @ 2020-08-07 11:40 朱小勇 阅读(1867) 评论(0) 推荐(0)
摘要:RadioButton { id:root2 checked: false property color checkedColor: "#E5F012" property int node_id: 2; onClicked: { if(root2.checked) { swipeView.curre 阅读全文
posted @ 2020-08-07 10:52 朱小勇 阅读(622) 评论(0) 推荐(0)
摘要:1、例子1 import QtQuick 2.7 import QtQuick.Controls 2.0 import QtQuick.Layouts 1.0 import QtQuick.Window 2.2 Window { visible: true width: 300 height: 45 阅读全文
posted @ 2020-08-07 09:53 朱小勇 阅读(1889) 评论(0) 推荐(0)
摘要:import QtQuick 2.0 import QtQuick.Controls 2.0 Rectangle { id:root; color: "#19192C"; property int rect_width: 50; property int rect_height: 20; prope 阅读全文
posted @ 2020-08-06 11:49 朱小勇 阅读(1055) 评论(0) 推荐(0)
摘要:一、静态生成两个界面 import QtQuick.Controls 2.2 import QtQml 2.2 import QtQuick 2.9 ApplicationWindow { title: qsTr("Hello World") width: 640 height: 480 visib 阅读全文
posted @ 2020-08-05 16:59 朱小勇 阅读(3219) 评论(0) 推荐(0)