qml

ComboBox disable an item at a particular index

我只是一个虾纸丫 提交于 2020-03-02 08:56:06
问题 I have a combobox in qml in a as a TableViewColummn and I define it as follows: import QtQuick 2.3 import QtQuick.Window 2.2 import QtQuick.Layouts 1.1 import QtQuick.Controls 1.4 import QtQuick.Controls.Styles 1.4 ListModel { id: comboModel ListElement { text: "" Index: -1 Dims: -1 } } TableViewColumn { id: imageTypeList role: "ImageType" title: "Image Type" width: 100 delegate: Rectangle { ComboBox { anchors.verticalCenter: parent.verticalCenter anchors.margins: 2 model: comboModel

QML开发——键盘响应事件

空扰寡人 提交于 2020-03-01 22:38:57
效果动图 关键注意转移属性值元素的写法 KeyNavigation.tab: play //按下tab键后转到属性值为play的元素上来 源码 import QtQuick 2.12 import QtQuick.Window 2.12 import QtQuick.VirtualKeyboard 2.4 Window { id: window visible: true width: 640 height: 400 title: qsTr("Keyboard") Rectangle{ MouseArea{ id: mouseArea anchors.fill: parent } Row{ //水平布局 x: 50 y: 50 Rectangle{ id: music width: 100 height: 100 radius: 6 color: focus ? "red" : "lightgray" //没有被选中时显示为灰色;没有被选中时显示灰色 scale: focus ? 1 : 0.8 //被选中时图标变大;没有被选中时图标正常大小 focus: true //初始时为选中状态 KeyNavigation.tab: play //按下tab键后转到属性值为play的元素上来 Keys.onUpPressed: music.y -= 10 //上移 Keys

qml+opencv(一)

对着背影说爱祢 提交于 2020-03-01 21:04:23
前言 突然想起opencv,一直想做人脸识别,可是理论基础太水,只能慢慢来,去年学习了一会,然后公司让我去搞app和网络,就一直搁着,现在学习qml,突然想能不能在qml里面使用opencv,所以就有了这篇文章。 QQuickItem和QObject 在QML中,可视化的基础组件是Item,不可视化的就是QtObject,它们对应C++中的QQuickItem和QObject类,扩展QML组件一个继续基于QML中的Item扩张,还有就是继承QQuickItem,我们想把opencv加到QML中,那么只有继承QQuickItem了。 怎么使用,那还要看QML新的渲染机制,Qt5的QML渲染基于OpenGL,其场景的渲染在单独的线程进行,我们需要需要QQuickItem返回能够描述场景的对象,就是QSGNode。实现QQuick的updatePaintNode函数就OK了,我们在updatePaintNode,描述怎么渲染。 类的关系 OpenCVcapture继承QOjbect,其是图像捕获的基类,OpenCVcamera是OpenCVcapture子类,完成从摄像头捕获数据。OpenCVaction类封装了opencv图像算法操作。OpenCVshowFrame继承QQuickItem,实现可视化。 #include <QApplication> #include

qml无边框窗口拖动时晃动解决方法

穿精又带淫゛_ 提交于 2020-03-01 12:06:24
百度到的qml无边框窗口拖动的解决办法基本都是根据鼠标点击位置和当前窗口位置来计算移动路径。但是窗口在拖动时会出现晃动,根据打印信息可以看出,qml中获取的当前鼠标坐标数值异常,解决办法是增加一个简单的类为qml提供当前鼠标坐标,具体实现如下: 光标提供类 class CursorPosProvider : public QObject { Q_OBJECT public: explicit CursorPosProvider(QObject *parent = nullptr) : QObject(parent) { } virtual ~CursorPosProvider() = default; Q_INVOKABLE QPointF cursorPos() { return QCursor::pos(); } }; 注册该类为qml属性 int main(int argc, char *argv[]) { QGuiApplication app(argc, argv); QQuickView view; CursorPosProvider mousePosProvider; view.rootContext()->setContextProperty("mousePosition", &mousePosProvider); view.setSource(QUrl

新手建站教程

廉价感情. 提交于 2020-03-01 02:53:27
准确来说是穷孩子建站。 准备东西有,电脑、域名、虚拟主机/服务器、做好的网站、备案 1、买一个域名,通常一块钱一年。(买不买都行) 2、找一个免费虚拟主机,在这推荐一下三 丰 云,注册实名一下就可以用。 3、有需求的话还可以找个免费云服务器,同样里面也有。 4、到了这里就可以用ftp把自己做好的网站上传到虚拟主机上了。 5、主机上有自带的域名,不过又长又臭,喜欢的话还可以省下一块钱。 6、如果用系统带的域名的话这里就可以访问自己的网站了。 关于用户体验方面也是不错的,主要是能自己动手做一个网站出来,很有成就感。 是不是很简单啊!喜欢的话就点个赞呗! 来源: CSDN 作者: Im_Qml 链接: https://blog.csdn.net/Im_Qml/article/details/104579158

QML: Attach scrollbar to ListView

≡放荡痞女 提交于 2020-03-01 01:58:51
问题 I'm having an issue with ListView. ListView is too long and part of it appears outside of the window but I can't attach a scrollbar. I tried many different combination. I think that problem lies in height parameter but if remove it ListView displays only first entry. Column{ anchors.fill: parent Row{ id: buttonsRow Button{ text: "Open dump file" onClicked: fileDialog.visible = true } Button{ text: "Copy raw data to clipboard" } } ListView{ id: listView anchors.top: buttonsRow.bottom height:

How to apply 'Qt.WA_X11NetWmWindowTypeDesktop' attribute to my QML window by using PyQt5

好久不见. 提交于 2020-02-29 06:31:45
问题 I am working on a desktop environment and I want my QML window as my main desktop window. I am integrating QML with PyQt5. here is my code import sys from PyQt5 import* from PyQt5.QtCore import* from PyQt5.QtWidgets import* from PyQt5.QtQuick import* from PyQt5.QtQml import* from threading import Thread import os import importlib import subprocess import tempfile import re import random import os.path from os import path dir_path = os.path.dirname(os.path.realpath(__file__)) if __name__ == '_

Qt QML Base Types

帅比萌擦擦* 提交于 2020-02-28 07:02:39
Qt QML Base Types https://doc.qt.io/qt-5/qtqml-qmlmodule.html This QML module contains basic QML types. To use the types in this module, import the module with the following line: import QtQml 2.14 Binding Enables the arbitrary creation of property bindings Component Encapsulates a QML component definition Connections Describes generalized connections to signals Date Provides date functions Locale Provides locale specific properties and formatted data LoggingCategory Defines a logging category in QML Number Object provides represents a number value Qt Provides a global object with useful enums

QML. How to change MapPolyline path from C++?

主宰稳场 提交于 2020-02-27 03:33:27
问题 Here is a QML map: Map { anchors.fill: parent plugin: osmMapPlugin center: QtPositioning.coordinate(56.006355, 92.860984) zoomLevel: 14 MapPolyline { line.width: 3 line.color: 'red' path: [ { latitude: -27, longitude: 153.0 }, { latitude: -27, longitude: 154.1 }, { latitude: -28, longitude: 153.5 }, { latitude: -29, longitude: 153.5 } ] } } How to change path from C++/qt ? I tried this: QML: Map { anchors.fill: parent plugin: osmMapPlugin center: QtPositioning.coordinate(56.006355, 92.860984)

QML. How to change MapPolyline path from C++?

落花浮王杯 提交于 2020-02-27 03:33:27
问题 Here is a QML map: Map { anchors.fill: parent plugin: osmMapPlugin center: QtPositioning.coordinate(56.006355, 92.860984) zoomLevel: 14 MapPolyline { line.width: 3 line.color: 'red' path: [ { latitude: -27, longitude: 153.0 }, { latitude: -27, longitude: 154.1 }, { latitude: -28, longitude: 153.5 }, { latitude: -29, longitude: 153.5 } ] } } How to change path from C++/qt ? I tried this: QML: Map { anchors.fill: parent plugin: osmMapPlugin center: QtPositioning.coordinate(56.006355, 92.860984)