qml

Q_GADGET vs an accessor object for manipulating a polymorphic tree of C++ objects from QML

回眸只為那壹抹淺笑 提交于 2020-01-17 06:14:09
问题 I have a polymorphic tree of C++ types that I need to work with from QML. Memory usage and performance are key here, so I wonder which approach would be more efficient: Q_GADGET - without a doubt the easier and faster way to do it. I can directly use properties (without notifications so no bindings either) and slots to access each object's members. It relies on meta data generation and some kind of object identification in the qtquick runtime. Use an global accessor object for accessing

Rendering a section of a non-smooth QImage using QSGImageNode

假装没事ソ 提交于 2020-01-17 05:51:12
问题 I'm trying to render individual tiles from a tileset. For example, I want to display the grey tile in the tileset below: In the real use case, these would be e.g. water, grass, etc. tiles in a game. There are some requirements for rendering these tiles: They are 32x32 pixels and will be rendered fullscreen, so performance is important. They should not be smoothed when scaled. None of the built-in Qt Quick types meet these requirements (rendering a section of an image that's not smoothed), as

Install OpenSSL for MSVC2017 on 64-bit Windows 10

两盒软妹~` 提交于 2020-01-16 19:33:32
问题 .pro LIBS += -LC:\Qt\Tools\OpenSSL\Win_x86\lib -llibssl LIBS += -LC:\Qt\Tools\OpenSSL\Win_x86\lib -llibcrypto INCLUDEPATH += C:\Qt\Tools\OpenSSL\Win_x86\include main.qml import QtQuick 2.12 import QtQuick.Window 2.12 import QtQuick.Controls 2.0 Window { visible: true width: 640 height: 480 Component.onCompleted: getPage(logResults) function logResults(results) { console.log("RESULTS: " + results) } function getPage(callback) { var xhttp = new XMLHttpRequest(); var url = "https://www.google

How to set a basic GridLayout with Buttons, GroupBox, Text and ProgressBar in QML

試著忘記壹切 提交于 2020-01-16 08:37:08
问题 Sorry if this question is simple but I am reviewing the official documentation on how to set up a GridLayout with Buttons , Text , GroupBox and a ProgressBar in QML . The layout I am trying to achieve is the following below: The problem I have is that I am struggling to achieve the layout above. I am having some problems understanding how to position the elements in the correct way inside the page. What I have done so far: 1) I found a very useful example which I replicated successfully in

Unable to assign QList<QUrl> to QString

雨燕双飞 提交于 2020-01-16 08:14:09
问题 I'm encountering this error: Unable to assign QList<QUrl> to QString when trying to directly assign the result of drop.urls (obtained from DropArea 's onDropped handler) to a Label's text property in Python. Based on this doc, I tried Qt.resolvedUrl (to convert the type to a string) as shown in the following code. However, it results in an empty text label. The urls I'm working with start with " file:/// ". What am I doing wrong? import QtQuick.Window 2.2 import QtQuick 2.2 import QtQuick

Change order of visible items

好久不见. 提交于 2020-01-16 05:51:07
问题 Is it possible to move up/down the visual items in order to change its overlapping? currently, the child hides its parent, but i'd like to have the reverse, i.e. the parent hides the child. Maybe some properties exists? 回答1: Yes it's possible. You will need to change the z property of the involved items. According to the documentation: Sets the stacking order of sibling items. By default the stacking order is 0. Items with a higher stacking value are drawn on top of siblings with a lower

TextField text field doesn't return value on QML | QT 5.12

寵の児 提交于 2020-01-16 04:50:29
问题 i need an help. So this is my code: TextField { id: passwordIDText placeholderText: "Insert text..." color: "Black" font.bold: true font.pixelSize: 21 anchors.top: parent.top anchors.topMargin: parent.height / 10 anchors.horizontalCenter: parent.horizontalCenter text: "aaa" } I use Android 8 (P20), QT 12.4, Android NDK 20 and Android SDK 28. So when i click the button on the android screen (i'm using 20 to testing), in debug, for get the passwordIDText.text, the field is empty, why ?? But if

ListView.model does not work well

冷暖自知 提交于 2020-01-16 02:55:10
问题 In the following code I have a ListView which I feed with JSON data. I use the parse function to extract data and assign it to the model, i.e. : view.model = JSON.parse(io.text) However, it seems that view.model don't get the data so that my application can't show anything. Here is my full code. import QtQuick 2.0 import FilesIO 1.0 import QtQuick.Window 2.2 import QtQuick.Controls 1.3 import QtQml 2.2 ApplicationWindow{ id: root width: 320 height: 410 title:"LOLLLLL" color: "white" visible:

ListView.model does not work well

我是研究僧i 提交于 2020-01-16 02:55:01
问题 In the following code I have a ListView which I feed with JSON data. I use the parse function to extract data and assign it to the model, i.e. : view.model = JSON.parse(io.text) However, it seems that view.model don't get the data so that my application can't show anything. Here is my full code. import QtQuick 2.0 import FilesIO 1.0 import QtQuick.Window 2.2 import QtQuick.Controls 1.3 import QtQml 2.2 ApplicationWindow{ id: root width: 320 height: 410 title:"LOLLLLL" color: "white" visible:

Why does XMLHttpRequest responseText not exist? [duplicate]

∥☆過路亽.° 提交于 2020-01-15 11:37:09
问题 This question already has an answer here : Install OpenSSL for MSVC2017 on 64-bit Windows 10 (1 answer) Closed 5 days ago . Reproducible example in QML: main.cpp #include <QSsl> main.qml import QtQuick 2.12 import QtQuick.Window 2.12 import QtQuick.Controls 2.0 Window { visible: true width: 640 height: 480 Component.onCompleted: getPage(logResults) function logResults(results) { console.log("RESULTS: " + results) } function getPage(callback) { var xhttp = new XMLHttpRequest(); var url =