qt-quick

How to modify a QML Text from C++

时间秒杀一切 提交于 2020-05-08 14:49:15
问题 I'm new to Qt and I'm trying to modify a QML Text (showed in the screen) from the C++ code. I get the text modified but it is not updated on the screen, so I have the text variable modified but the first text on the screen. Here is the code: //main.cpp #include <QApplication> #include <QDeclarativeEngine> #include <QDeclarativeComponent> #include <QDeclarativeItem> #include <QDebug> #include "qmlapplicationviewer.h" Q_DECL_EXPORT int main(int argc, char *argv[]) { QScopedPointer<QApplication>

What's the difference between QQuickView and QQuickWindow?

旧街凉风 提交于 2020-04-09 05:18:53
问题 I am currently working with Qt 5.2.1... and I have a (maybe stupid?) question: What is the difference between QQuickView and QQuickWindow ? I read the documentation but it is still not clear to me... 回答1: From the Qt documentation: The QQuickView class provides a window for displaying a Qt Quick user interface. QQuickView is a convenience subclass of QQuickWindow which will automatically load and display a QML scene when given the URL of the main source file. So QQuickView is a subclass of

Camera Not saving the captured image

£可爱£侵袭症+ 提交于 2020-02-06 08:22:47
问题 I Use Qt 5.12.5 and I have qt quick controls 2 project that I run it on my Android Device. Now I have a problem,the signal imageSaved of Camera Not trigger? In below when I click button Camera should capture Button{ onClicked: { camera.imageCapture.capture(); } } After Clicking the Button imageCaptured signal runs, the photoPrevew shows the captured image ,But onImageSaved Not running and I don't see any captured image in my Gallery! Camera { id: camera position: Camera.BackFace

Warning when connecting c++ signal to qml slot

半腔热情 提交于 2020-01-25 15:50:05
问题 I connect a c++ signal to qml function in qt4.8.4. It's working fine but makes warning in application output as below: Object::connect: No such slot QDeclarativeItem_QML_9::onValue_changed(double) Object::connect: (sender name: 'MyWidget') I have defined qml slot like this : import QtQuick 1.0 Item { id: root property real value : 0 Connections { target: controllerObject onValue_changed : { root.value = value } } } And this is my c++ Signal and how it is connected to qml slot : ui->view-

How to hide an image using transparent rectangle in QML?

妖精的绣舞 提交于 2020-01-17 09:11:41
问题 In the below code I want to hide the image using transparent rectangle. Please give me some solutions. I have used z value but it is not working. The image is still visible. main.qml import QtQuick 2.5 import QtQuick.Window 2.2 Window { visible: true width: 640 height: 480 title: qsTr("Hello World") Image { id:underlyingImage width: 400 height: 400 x:0; y:0; source:"qrc:/Jellyfish.jpg" z:1 } Rectangle { id:hiding_rect width: 400 height: 400 x:0; y:0; color:"transparent" z:100 } } 回答1: You can

I want to set a Qt QML Combobox to a PyQt5 object property

*爱你&永不变心* 提交于 2020-01-14 09:32:31
问题 I am writing a small program which uses Qt5 QML as the GUI layer and Python3-PyQt5 to implement the data model. I now want to display a ComboBox in QML and set its model to a list of enums. How would I export the enum as a property of the python class so that I can reference it in QML? Preferably I would write this in QML: ComboBox { model: mymodel.car_manufacturers onCurrentIndexChanged: mymodel.selected_manufacturer = currentIndex } 回答1: Here is my solution which works good enough for me.

I want to set a Qt QML Combobox to a PyQt5 object property

╄→尐↘猪︶ㄣ 提交于 2020-01-14 09:32:28
问题 I am writing a small program which uses Qt5 QML as the GUI layer and Python3-PyQt5 to implement the data model. I now want to display a ComboBox in QML and set its model to a list of enums. How would I export the enum as a property of the python class so that I can reference it in QML? Preferably I would write this in QML: ComboBox { model: mymodel.car_manufacturers onCurrentIndexChanged: mymodel.selected_manufacturer = currentIndex } 回答1: Here is my solution which works good enough for me.

I want to set a Qt QML Combobox to a PyQt5 object property

怎甘沉沦 提交于 2020-01-14 09:32:08
问题 I am writing a small program which uses Qt5 QML as the GUI layer and Python3-PyQt5 to implement the data model. I now want to display a ComboBox in QML and set its model to a list of enums. How would I export the enum as a property of the python class so that I can reference it in QML? Preferably I would write this in QML: ComboBox { model: mymodel.car_manufacturers onCurrentIndexChanged: mymodel.selected_manufacturer = currentIndex } 回答1: Here is my solution which works good enough for me.

QML Screen Coordinates of Component

自作多情 提交于 2020-01-11 05:31:07
问题 If I have a simple, self-contained QML application, I can get the absolute screen coordinates of a component by saying Component.onCompeted: { var l = myThing.mapToItem(null, 0, 0) console.log("X: " + l.x + " y: " + l.y) } where myThing is the id of any other component in the file. However, if this file gets incorporated into another QML file and the component it defines is reused, I don't get the screen coordinates anymore; I get the local coordinates relative to the component where the

How to Remove a dynamically created item from Column QML Element

依然范特西╮ 提交于 2020-01-05 03:34:10
问题 [EDIT] : I want to remove some controls which are created in Column QML type dynamically and also how to access the children of a layout? .Following is the code which is not dynamic and is just for reference: import QtQuick 2.6 import QtQuick.controls 2.2 Item { Column { id:col spacing: 2 //Initially Adding controls. Rectangle { color: "red"; width: 50; height: 50 } Rectangle { color: "green"; width: 20; height: 50 } Rectangle { color: "blue"; width: 50; height: 20 } } Button { id:button