qml

Setting object type property in QML from C++

让人想犯罪 __ 提交于 2020-02-25 13:38:08
问题 (Editted to add more context) I've started using QML and I'd like to set some sort of reference property on a QML type, linking two QML objects (ideally, without a parent/child relationship as I'd like to connect multiple QML objects). For example, I have the following files. qmldir: A 1.0 A.qml A.qml import QtQuick 2.2 Rectangle { width: 100 height: 100 color: 'red' // Other stuff later } main.qml: import QtQuick 2.2 import QtQuick.Window 2.1 import "qrc:/" Rectangle { objectName: "Main

QML RTSP Stream from a network camera

孤者浪人 提交于 2020-02-25 13:30:29
问题 I have a question about the RTSP Stream. How can I display a RTSP Stream from a netwok camera in qml? the settings: Qt5.10 Camera: LunaIP L-DA-5203-V2 OS: Windows 7 Things I have tested: QML: Camera, MediaPlayer, VideoOutput Until now I didn't found any things how I can solve it in QML? 回答1: There are 2 ways, which worked for me: 1.) In my form.ui.qml I'm using the MediaPlayer and the VideoOutput components MediaPlayer { id: videoPlayer source: "rtsp://184.72.239.149/vod/mp4:BigBuckBunny_115k

QML RTSP Stream from a network camera

家住魔仙堡 提交于 2020-02-25 13:29:13
问题 I have a question about the RTSP Stream. How can I display a RTSP Stream from a netwok camera in qml? the settings: Qt5.10 Camera: LunaIP L-DA-5203-V2 OS: Windows 7 Things I have tested: QML: Camera, MediaPlayer, VideoOutput Until now I didn't found any things how I can solve it in QML? 回答1: There are 2 ways, which worked for me: 1.) In my form.ui.qml I'm using the MediaPlayer and the VideoOutput components MediaPlayer { id: videoPlayer source: "rtsp://184.72.239.149/vod/mp4:BigBuckBunny_115k

How to pan QML Map as soon as one press and start dragging mouse pointer on it?

若如初见. 提交于 2020-02-25 07:07:15
问题 I have enabled gestures like this: gesture.enabled: true but the map doesn't start panning as soon as I press and start moving the mouse pointer instead the map start panning when I have already dragged the mouse pointer over 10 pixels or so! Can somebody please help me to let me start panning the map as soon as the mouse pointer start dragging instead waiting for the 10 or so pixels drag wait? 回答1: If the MapGestureArea source code is analyzed then it is observed that the threshold used

How to pan QML Map as soon as one press and start dragging mouse pointer on it?

徘徊边缘 提交于 2020-02-25 07:06:07
问题 I have enabled gestures like this: gesture.enabled: true but the map doesn't start panning as soon as I press and start moving the mouse pointer instead the map start panning when I have already dragged the mouse pointer over 10 pixels or so! Can somebody please help me to let me start panning the map as soon as the mouse pointer start dragging instead waiting for the 10 or so pixels drag wait? 回答1: If the MapGestureArea source code is analyzed then it is observed that the threshold used

QML MapPolygon from C++ model

我的未来我决定 提交于 2020-02-24 06:37:28
问题 I want to dynamically add/remove/edit MapPolygon in QML Map application. I have some others jobs with created polygons (file export/import etc.) so I think that I should use MapItemView with C++ model sotirng Polygons data. I tried to create my own model with my own QObject based objects: Object: class MODELSHARED_EXPORT Polygon : public QObject { Q_OBJECT Q_PROPERTY(QList<QGeoCoordinate> coordinates READ coordinates WRITE setCoordinates NOTIFY coordinatesChanged) public: explicit Polygon

QML MapPolygon from C++ model

醉酒当歌 提交于 2020-02-24 06:37:08
问题 I want to dynamically add/remove/edit MapPolygon in QML Map application. I have some others jobs with created polygons (file export/import etc.) so I think that I should use MapItemView with C++ model sotirng Polygons data. I tried to create my own model with my own QObject based objects: Object: class MODELSHARED_EXPORT Polygon : public QObject { Q_OBJECT Q_PROPERTY(QList<QGeoCoordinate> coordinates READ coordinates WRITE setCoordinates NOTIFY coordinatesChanged) public: explicit Polygon

QML: referencing root window by parent reference is unreliable

北战南征 提交于 2020-02-24 04:19:52
问题 Qt/QML question. Using Qt 5.7. Take the following simple QML program that displays a red rectangle and a blue rectangle aligned vertically. Click handlers for both rectangles attempt to change the color of the parent host window. But with a subtle difference. The red rectangle references the host window directly by it's id ( rootWindow ). The blue click handler changes color via a parent reference. The former case works fine. The latter case does not work. It seems like the root window is

Is there a native data model from TreeView in QML?

烈酒焚心 提交于 2020-02-23 04:12:57
问题 The QT document had implied that any implementation of QAbstractItemModel can be used for TreeView. These models are usually in C++, which is inconvenient for now. So is there an native QML model which can be utilized in treeview? Can I set a QStandardItemModel model from C++, and use this model in qml? 回答1: The QStandardItemModel reference gives an example of how to use it for a TreeView: QStandardItemModel model; QStandardItem *parentItem = model.invisibleRootItem(); for (int i = 0; i < 4;

Is there a native data model from TreeView in QML?

拟墨画扇 提交于 2020-02-23 04:12:44
问题 The QT document had implied that any implementation of QAbstractItemModel can be used for TreeView. These models are usually in C++, which is inconvenient for now. So is there an native QML model which can be utilized in treeview? Can I set a QStandardItemModel model from C++, and use this model in qml? 回答1: The QStandardItemModel reference gives an example of how to use it for a TreeView: QStandardItemModel model; QStandardItem *parentItem = model.invisibleRootItem(); for (int i = 0; i < 4;