qquickitem

How to paint sequential image in efficient way in QQuickPaintedItem

a 夏天 提交于 2019-12-05 04:29:50
问题 For some reason, I needs to wrap opencv VideoCapture in a class which will be used in Qt Quick. There are two classes, one is Camera, other is CameraView. CameraView inheritd from QQuickPaintedItem. Camera class will get image periodically. It achieved by QObject::startTimer(int interval). (e.g. If fps of the webcam is 30, the timer interval is 1000 / 30 - 8, 8 is deviation of time). Once Camera has get image, it notifies CameraView to repaint by calling CameraView::Update(). And in

How to expose C++ structs for computations to Qml

ぃ、小莉子 提交于 2019-12-04 16:41:49
问题 I have the following problem. I am developing a model in C++ and a View in Qml, connecting them via Controllers. In my model I perform multiple calculations. I also offer users of my application the possibility, to write custom event handlers, written in qml. Now I came across a point, where I decided to use Fixed point notation and I have written a corresponding C++ class. Now I want offer the FixedPoint class - including all its operators - to developers, who decide to extend my application

How to paint sequential image in efficient way in QQuickPaintedItem

China☆狼群 提交于 2019-12-03 17:16:40
For some reason, I needs to wrap opencv VideoCapture in a class which will be used in Qt Quick. There are two classes, one is Camera, other is CameraView. CameraView inheritd from QQuickPaintedItem. Camera class will get image periodically. It achieved by QObject::startTimer(int interval). (e.g. If fps of the webcam is 30, the timer interval is 1000 / 30 - 8, 8 is deviation of time). Once Camera has get image, it notifies CameraView to repaint by calling CameraView::Update(). And in CameraView::paint(QPainter *), CameraView will get an copy of image from Camera class and paints this image by

How to expose C++ structs for computations to Qml

我与影子孤独终老i 提交于 2019-12-03 10:43:51
I have the following problem. I am developing a model in C++ and a View in Qml, connecting them via Controllers. In my model I perform multiple calculations. I also offer users of my application the possibility, to write custom event handlers, written in qml. Now I came across a point, where I decided to use Fixed point notation and I have written a corresponding C++ class. Now I want offer the FixedPoint class - including all its operators - to developers, who decide to extend my application in Qml. So far, I offered all data as QProperties, which is required by coding guidelines. But I am

How to get a valid instance of a QQuickItem on C++ side

给你一囗甜甜゛ 提交于 2019-12-02 05:26:54
问题 Alright. I have searched a lot but haven't got a good solution yet. I am new to Qt . I have a class which is a QQuickItem like so, class MyQuickItemClass : public QQuickItem { Q_OBJECT SetInfo(SomeCppClass object) }; I do a qmlRegisterType in my main.cpp to register it on the qml side like this, qmlRegisterType< MyQuickItemClass >("MyQuickItemClass", 1, 0, "MyQuickItemClass"); All fine till here. But -> I want to set an object instance & some properties in MyQuickItemClass which some C++

How to get a valid instance of a QQuickItem on C++ side

百般思念 提交于 2019-12-02 01:09:48
Alright. I have searched a lot but haven't got a good solution yet. I am new to Qt . I have a class which is a QQuickItem like so, class MyQuickItemClass : public QQuickItem { Q_OBJECT SetInfo(SomeCppClass object) }; I do a qmlRegisterType in my main.cpp to register it on the qml side like this, qmlRegisterType< MyQuickItemClass >("MyQuickItemClass", 1, 0, "MyQuickItemClass"); All fine till here. But -> I want to set an object instance & some properties in MyQuickItemClass which some C++ logic in it as well & then pass the MyQuickItemClass object to qml . Or, get a valid instance of

How to make a resizable rectangle in QML?

跟風遠走 提交于 2019-11-28 20:49:20
I'm looking for a simple way to create a rectangle in a QQuickItem . I want to resize, and drag the borders of this rectangle like this (found at resizable QRubberBand ) Has someone an idea? There are probably several ways to achieve the desired result. Since I've considered the implementation of a similar Component for a cropping tool software of mine, I'm going to share a toy example which uses part of that code. Differently from the rubber band in the example, my Rectangle is resizable only on a single axis at a time. I'm confident that you can build on that and customise the code to meet