qml

Inner shadow on QML Rectangle

ぃ、小莉子 提交于 2020-01-02 04:15:07
问题 How do I implement a Rectangle in QML with an inner shadow? See example in link below: Create inner shadow in UIView UPDATE: Here's a simplified version of what I'm trying to do (which does not show any shadow): import QtQuick 2.0 import QtGraphicalEffects 1.0 Item { width: 400 height: 400 Item { anchors.fill: parent Rectangle { id: myRectangle anchors.centerIn: parent width: 200 height: 200 color: "grey" } } InnerShadow { anchors.fill: myRectangle cached: true visible: true horizontalOffset:

Measuring elapsed time in QML

跟風遠走 提交于 2020-01-02 03:40:07
问题 Let's consider the following example: we have a Qt Quick Controls Button . The user clicks it twice within 5 seconds. After pushing the Button for the first time, the QML Timer is running for these 5 seconds. We want to measure the time elapsed between two clicks, with a millisecond accuracy. Unfortunately, the QML Timer can't show us the elapsed time. As suggested on the BlackBerry forums, it would be possible to compare the dates. This isn't very handy, though, since the first click might

Unit testing for Qt Quick

ⅰ亾dé卋堺 提交于 2020-01-02 01:35:53
问题 I am very new to Qt and Qt Quick. I am validating the Qt Test unit testing framework for Qt Quick and I am not able to understand how to run the tests. Here's what I have, I have created a SUBDIRS project with the following structure: ProjectSolution ProjectSolution.pro Project Project.pro Sources/main.cpp Resources/qml.qrc/main.qml ProjectTest ProjectTest.pro Sources/main.cpp Resources/qml.qrc/main.qml Resources/qml.qrc/tst_gui.qml "Project" is the application to be tested and my test cases

How can I display a QStringList in C++ to a QML ListView

[亡魂溺海] 提交于 2020-01-01 19:27:08
问题 So I'm new to Qt and I'm trying to improve my C++ skills, so I decided to start a project where I can search items in a QStringList using a textfield. I got the search function working and I was able to move the result of the search into another QStringList , where I can use it to display to the user in a function that is declared as a "public slot". The main Idea is that the list will auto update as soon as the user enters a character into the textfield, which it already does. So I managed

QML drag one component as if it has the top stacking order (largest z)

▼魔方 西西 提交于 2020-01-01 10:44:27
问题 QT5.5, QML: I am using the example "Qt Quick Examples - Drag and Drop" In this example, you could see that if we drag the red tile "1", it appears under other tiles when we drag it. I don't like this effect since when we drag one item, I hope it always appears on the top of whole GUI. What I tried is: Once the mouse is pressed, we set the item's z as the largest value. And when the mouse is released, set the z to the small value (or better we could save the original value and reset it back to

QML drag one component as if it has the top stacking order (largest z)

断了今生、忘了曾经 提交于 2020-01-01 10:42:50
问题 QT5.5, QML: I am using the example "Qt Quick Examples - Drag and Drop" In this example, you could see that if we drag the red tile "1", it appears under other tiles when we drag it. I don't like this effect since when we drag one item, I hope it always appears on the top of whole GUI. What I tried is: Once the mouse is pressed, we set the item's z as the largest value. And when the mouse is released, set the z to the small value (or better we could save the original value and reset it back to

QML drag one component as if it has the top stacking order (largest z)

限于喜欢 提交于 2020-01-01 10:42:07
问题 QT5.5, QML: I am using the example "Qt Quick Examples - Drag and Drop" In this example, you could see that if we drag the red tile "1", it appears under other tiles when we drag it. I don't like this effect since when we drag one item, I hope it always appears on the top of whole GUI. What I tried is: Once the mouse is pressed, we set the item's z as the largest value. And when the mouse is released, set the z to the small value (or better we could save the original value and reset it back to

64 bit integers in QML

五迷三道 提交于 2020-01-01 10:13:26
问题 How do I deal with 64 bit integers in QML? I know that useless Javascript can't handle them normally as it uses doubles for everything, and if I try to use them in a signal, everything gets set to undefined . Is there a way around this? Perhaps I have to use a QVariant or something? 回答1: Create your own Integer64 class derived from QObject and give it the functions you need, like class Integer64 : public QObject { Q_OBJECT public: // ... Q_PROPERTY(QString value READ value WRITE setValue

Qt QML dropdown list like in HTML

為{幸葍}努か 提交于 2020-01-01 09:22:32
问题 Simple thing, but can't get find it. I want a simple dropdown selection box with a couple of selections. Like in HTML <select> <option>1</option> <option>2</option> </select> what is the code for QML for that ? 回答1: Here's a simple example that could maybe be used as a starting point: import QtQuick 1.0 Rectangle { width:400; height: 400; Rectangle { id:comboBox property variant items: ["Item 1", "Item 2", "Item 3"] property alias selectedItem: chosenItemText.text; property alias

Qt QML dropdown list like in HTML

萝らか妹 提交于 2020-01-01 09:22:03
问题 Simple thing, but can't get find it. I want a simple dropdown selection box with a couple of selections. Like in HTML <select> <option>1</option> <option>2</option> </select> what is the code for QML for that ? 回答1: Here's a simple example that could maybe be used as a starting point: import QtQuick 1.0 Rectangle { width:400; height: 400; Rectangle { id:comboBox property variant items: ["Item 1", "Item 2", "Item 3"] property alias selectedItem: chosenItemText.text; property alias