qtquick2

Connect dynamically to signals of dynamically created objects

我的梦境 提交于 2019-12-12 01:48:32
问题 The title might be a bit confusing, but my intent is pretty simple: I have a [Repeater/Instantiator] which creates multiple instances of a arbitrary delegate. I want to react to all changes of the properties (only first-level, so no properties of properties) of the instances of the delegate, calling a function function update(index, propertyName) This seems to be easy, but I fail. This is my code TestObj.qml Repeater { onItemAdded: { var keys = Object.keys(item) console.log(keys) for (var k =

Qt Quick: Can I use the layout components for item layout, without the overhead of rendering the items to the window?

被刻印的时光 ゝ 提交于 2019-12-12 01:43:35
问题 I want to render a QML subtree manually to a Canvas3D by having all the subtree's items' be-texture-source flag ( layer.enabled ) enabled, and taking the geometry (x, y, width, height) of each item from the corresponding QML properties of each item (calculated by layouts, anchors, etc), so I know how to position and size each item with OpenGL calls. I have no problems with implementing this, except for a performance issue: since I'm drawing the items in OpenGL, I don't want Qt to also draw

Using checkboes in TableView

一曲冷凌霜 提交于 2019-12-12 01:36:19
问题 I am creating a TableView with custom delegate to have checkbox es in the columns and I have had some success with the following: // TableViewCheckBoxColumn.qml import QtQuick 2.2 import QtQuick.Controls 1.4 import QtQuick.Controls.Styles 1.4 TableViewColumn { title: "" role: "check" delegate: CheckBox { id: checkBox } } The table implementation is as follows: import QtQuick 2.2 import QtQuick.Controls 1.4 import QtQuick.Controls.Styles 1.4 Item { anchors.centerIn: parent ListModel { id:

QQuickFramebufferObject: When using an Item, whose parent has “visible: false”, as texture source, nothing is displayed

我与影子孤独终老i 提交于 2019-12-12 01:22:00
问题 This works fine in Canvas3D, but not in QQuickFramebufferObject. My code I've based my testcase on the textureinsgnode sample app bundled with Qt. Since mine is a derived work, I have to first post the license terms here: /**************************************************************************** ** ** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing/ ** ** This file is part of the examples of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:BSD$ ** You may use this file

How to implement Master Details View in Qt/QML (part 2)

99封情书 提交于 2019-12-12 00:57:00
问题 I previously asked how to implement a Master Details View in Qt/QML here: How to implement a master-details view Qt/QML on an Android tablet?. Having continued working on this, I came out with the following mockup QML layout: import QtQuick 2.7 import QtQuick.Controls 2.0 import QtQuick.Layouts 1.0 import QtQuick.Controls 1.4 Item { y: 50 Layout.fillHeight: true width: appWindow.width RowLayout { id: mainLayout anchors.fill: parent ListModel { id: navigation ListElement { item: "Item 1" }

How to load a QML file into a QGraphicsScene in Qt5

情到浓时终转凉″ 提交于 2019-12-12 00:33:32
问题 I tried to load a qml file into a QGraphicsScene using this code : QGraphicsScene* scene = new QGraphicsScene; QQmlEngine *engine = new QQmlEngine; QQmlComponent component(engine,"main.qml",QQmlComponent::PreferSynchronous); qDebug()<<component.errors(); QGraphicsObject *object = qobject_cast<QGraphicsObject *>(component.create()); scene->addItem(object); errors() returns nothing and the app output says : QGraphicsScene::addItem: cannot add null item 回答1: You can't use QtQuick2 (Qt5's new

Can't run application on some Android devices

纵饮孤独 提交于 2019-12-11 19:00:53
问题 I made a QtQuick program and I found that Qt uses OpenGL ES 2.0 library. I amble to build and deploy my application to all devices, I have including AVD. But on some devices I receive error log: W/Qt ( 1246): eglconvenience/qeglconvenience.cpp:289 (void* QEglConfigChooser::chooseConfig()): Cant find EGLConfig, returning null config W/Qt ( 1246): eglconvenience/qeglconvenience.cpp:289 (void* QEglConfigChooser::chooseConfig()): Cant find EGLConfig, returning null config W/Qt ( 1246): scenegraph

Exposing QML Components to each other in Qt Creator

时光总嘲笑我的痴心妄想 提交于 2019-12-11 16:58:14
问题 I'm developing a dashboard application using Qt-Quick with PySide2 and am having trouble exposing my QML components in Qt Creator's design mode. My folder structure looks something like this: myapp/ ├── mycomponents │ ├── component1.qml │ └── component2.qml │ └── etc.. ├── pages │ ├── page1.qml │ └── page2.qml └── app.qml I can use all components from myapp/mycomponents by importing the appropriate .qml files or it's parent directory using relative paths: // inside page1.qml import "..

WorkerScript access to Controller class

我们两清 提交于 2019-12-11 16:57:45
问题 I have a BusyIndicator which should spin while heavy computations are happening and stop when the computations are done. I thought WorkerScript was the right way to go but but from here, it seems that the secondary (computation thread) in the .js file does not have access to the objects of the primary .qml thread. This is problematic as all my computations are performed through a Controller C++ defined QObject instantiated by the primary thread. Here is my code: main.qml import QtQuick 2.7

C++ QQuickItem: How to trigger a function on item size change

一个人想着一个人 提交于 2019-12-11 10:46:18
问题 I have a QQuickItem in C++ which is instantiated in a QML application. I want to trigger a custom function on the c++ side if the width property of my QQuickItem changes. In QML I would do onWidthChanged: { my code}. How can I do this on the c++ side? 回答1: If you want to respond to size changes in a custom QQuickItem , reimplement the geometryChanged() function. This has the benefit of not creating extra signal-slot connections for each item, as would be necessary if you were to connect to