qtquickcontrols

BusyIndicator does not show up

青春壹個敷衍的年華 提交于 2019-11-30 21:12:10
I want to show a BusyIndicator while a long process is going on. The problem is it does not show up when I make it run and shows afterwards when the process is completed. According to the docs The busy indicator should be used to indicate activity while content is being loaded or the UI is blocked waiting for a resource to become available. I have created a minimal code that based upon the original code Window { id: win width: 300 height: 300 property bool run : false Rectangle { anchors.fill: parent BusyIndicator { anchors.centerIn: parent running: run } MouseArea { anchors.fill: parent

Qt Quick Controls 2 and TableView

霸气de小男生 提交于 2019-11-30 14:57:16
问题 Is it OK to use TableView in Quick Controls 2.0 application? This will require to have both imports: import QtQuick.Controls 1.4 import QtQuick.Controls 2.0 Will I get any side effects? Another related question: it seems that TableView belongs to Quick Controls 1.0 set. Is it? Does it mean that if it's possible to use TableView then it's possible to use all the Quick Controls 1.0 controls in Quick Controls 2.0 application? 回答1: While it is possible to mix Qt Quick Controls 1 and 2 in the same

How to apply opacity mask to a QML item?

丶灬走出姿态 提交于 2019-11-29 11:21:38
The look and feel I'm trying to go for is to have a solid color button, and text on it like "Hello World" where the text is completely transparent, and the background shows through the button. In other words, having text as a transparency mask on a button element. Here is one way to do it: // TB.qml MouseArea { width: txt.contentWidth + 20 height: txt.contentHeight + 10 property alias text: txt.text property alias color: sh.color ShaderEffect { id: sh anchors.fill: parent property color color: "red" property var source : ShaderEffectSource { sourceRect: Qt.rect(0, 0, sh.width, sh.height)

QML Form layout (GridLayout) troubles

折月煮酒 提交于 2019-11-29 07:38:47
I am trying now to convert my app UI from C++ to QML. At some step I need a login window so I created it in QML with code below: Window { id: loginWindow property string username: login.text; property string password: password.text; property bool issave: savePassword.checked; flags: Qt.Dialog modality: Qt.WindowModal width: 400 height: 160 minimumHeight: 160 minimumWidth: 400 title: "Login to program" GridLayout { columns: 2 anchors.fill: parent anchors.margins: 10 rowSpacing: 10 columnSpacing: 10 Label { text: "Login" } TextField { id: login text: Config.getParam("user") Layout.fillWidth:

How create shared library in QT/QML

雨燕双飞 提交于 2019-11-28 05:55:31
问题 I have 4 qml files and one main.cpp to load qml file. Is it possible for me to create 1 dll file for those 4 qml file. And use it in different application if so how to do that. 回答1: As already said, there is no need for embedding qml files only in a library. But of course you have the right to do all you want, even that. I know at least 2 ways to do that: 1. Create binary resource file Prepare resource file containing qml files and then compile it: rcc -binary plugin.qrc -o plugin.rcc Now you

Is it possible to use QAbstractTableModel with TableView from QtQuick.Controls?

人走茶凉 提交于 2019-11-28 02:06:04
I’m trying to implement following thing: There is 2d table with values. I need to implement UI for viewing data and editing it. To simplify synchronisation between edits from UI and table updates coming from the back-end, I want model to store uncommitted edited values and expose a couple of methods to accept/reject pending changes. From what I understand this is reasonably easy to do with QtWidgets + models: Base model on QAbstractTableModel. Add a few extra roles for storing/querying pending changes, etc. Use QTableView with custom item delegate, which can query model whether cell is

How to create an animated, variable size accordion component in QtQuick / QML

你离开我真会死。 提交于 2019-11-27 04:54:49
问题 I want to create an animated accordion-like element that expands on click. Here's how it should work. When the user clicks one of the red rectangles, the green rectangle which is the actual content, should expand. I want this expansion to be animated. The height of the contents of the green rectangles could be different for each red header. I have been able to implement the click-to-expand behavior, but there's no animation. Here is the code I currently have. AccordionElement.qml import

Is it possible to use QAbstractTableModel with TableView from QtQuick.Controls?

好久不见. 提交于 2019-11-26 21:56:00
问题 I’m trying to implement following thing: There is 2d table with values. I need to implement UI for viewing data and editing it. To simplify synchronisation between edits from UI and table updates coming from the back-end, I want model to store uncommitted edited values and expose a couple of methods to accept/reject pending changes. From what I understand this is reasonably easy to do with QtWidgets + models: Base model on QAbstractTableModel. Add a few extra roles for storing/querying