qml

Calling qmlRegisterType() in the registered class on debug crashes application

我怕爱的太早我们不能终老 提交于 2019-12-13 16:27:13
问题 I want to use qmlRegiterType() in registered class itself. I tried to use method from this topic but whenever I try to run application in debug mode it crashes the application with error read access violation at 0x0 Crashes on macro QML_GETTYPENAMES inside qqml.h (235 line). TestClass.h : class RegisterQmlTest : public QObject { Q_OBJECT public: explicit RegisterQmlTest(QObject *parent = 0); }; TestClass.cpp : QML_REGISTER(RegisterQmlTest); RegisterQmlTest::RegisterQmlTest(QObject *parent) :

QT/QML c++ Program crash on access a QList from QML

筅森魡賤 提交于 2019-12-13 14:42:12
问题 I have 2 classes for datahandling (CGameList and CGame). I define one GameList (_gamelist) object in qml to work with it. I have a Listviews with show the the games from this GameList (editGames_open()). If I click on one entry of this list, it open a new list with a detailed view of this game (editGame_open(index)). This work works like expected. Now my problem: If I go back to the list and try open it again, my program crash (not every time, sometimes its work 20x times). The crash appear

Need help doing simple rendering with Qt5 Qml + OpenGL

旧城冷巷雨未停 提交于 2019-12-13 14:18:42
问题 I need to make it so part of my Qml view is “taken over” by some non-Qt OpenGL rendering, and I was having issues getting a texture to display properly so I thought I would just draw a line and get that to work before moving on to more complicated code. For those not familiar with Qt5, the entire window is drawn using OpenGL, and I'm hooking into Qt's OpenGL drawing mechanism using their QQuickWindow::beforeRendering() signal which means my painting code is executed every redraw (every

QML: Lambda function works unexpectedly

左心房为你撑大大i 提交于 2019-12-13 12:02:08
问题 I thought QML supported lambda functions because of JavaScript's support of anonymous functions and the fact that functions are first class objects, but they don't work how I expected. Take this code: Item { property var items: [] function handler( item ) { console.log( item ); } Component.onCompleted: { for ( var i = 0; i < 3; ++i ) { var item = someObj.createObject(); item.someValueChanged.connect( function() { handler( item ); } ); items.push( item ); console.log( "Adding:", item ); } }

how to create components dynamically in qml

删除回忆录丶 提交于 2019-12-13 11:19:51
问题 How to dynamically add components in QML? I refered this link to add a component(Rectangle component) into main.qml window upon a button click in same window. 'Ubuntu.Components' is not installed in my qt. I don't know javascript. "componentCreation.js"is refered here. What does it means? i am beginner in qml . i need to know is there a way to load qml comonents dynamically by using qml only. 回答1: main.qml import QtQuick 2.6 import QtQuick.Window 2.2 import QtQuick.Controls 1.4 Window { id

Qt5-QML: How to handle a combobox in QML via JavaScript

╄→尐↘猪︶ㄣ 提交于 2019-12-13 10:52:06
问题 I am accessing to my own robots via wi-fi using a third party router. I wrote a small application that automatically log-in to the router, navigate through the tab of the router interface all using JavaScript inside a QML application. The small problem I have is that I have to trigger a relays to turn on/off the robot and inside the router GUI I need to trigger a combobox as shown in the print screen below. After clicking on the I/O tab, the address of the router page is https://123.456.789

Update ImageView in QML

大兔子大兔子 提交于 2019-12-13 09:55:20
问题 I am processing an image using opencv during runtime and want to display the updated version of this image in QML using imageView, i currently am creating a new image file at runtime and reassigning its path to the imageView in QML, is there any better method for this? 回答1: If I understand the question correctly, I do this by connecting a changed signal emitted from the c++ code and connect it to a receiver that forces a reload on the qml side : // MyImage.qml Image { cache: false function

How to set a pure C++ object instance in a QQuickItem [duplicate]

只愿长相守 提交于 2019-12-13 09:01:20
问题 This question already has answers here : How to get a valid instance of a QQuickItem on C++ side (2 answers) Closed 3 years ago . I have QtApp & a pure C++ library. The C++ library exposes a one simple class called MyCppLibApiClass . The QtApp has a class which is embedded on main.qml . Following is the class: class MyQuickItem : public QQuickItem { MyQuickItem(); } Following the qml code for the quick item : import MyQuickItem 1.0 MyQuickItem { id: myQuickItemID visible: true objectName:

setMainQmlFile`, rootObject and showExpanded are not members of QQmlApplicationEngine

社会主义新天地 提交于 2019-12-13 07:35:12
问题 I've written this piece of code following some guys tutorial but I can't get it to run. The error says: setMainQmlFile`, rootObject and showExpanded are not members of QQmlApplicationEngine What it's supposed to do is get a signal from QML and print out a message (in console). Basically I'm trying to integrate C++ and QML. EDIT I've tried to replace some of the functions with some others that seemed appropriate (at least to me). I've also tried to find what to include so that these functions

Rasterize QML SVG Image in Alpha8 format

落爺英雄遲暮 提交于 2019-12-13 07:27:12
问题 Importing a set of 80 icons in QML as non-visible images to be used for shader sources (for arbitrary colorization): property Image action: Image { sourceSize.width: 512; sourceSize.height: 512; source: "icons/action.svg"; mipmap: true; antialiasing: true } // 79 more of those I discover that my memory consumption has skyrocketed, from 45 mb to 128 mb, a whooping ~185% increase, thats 83 extra mb for the 80 icons. It was expected, after all, 512 * 512 * 4 / 1024 / 1024 makes up for exactly 1