Questions tagged [qml]

QML (Qt Modeling Language) is a declarative language that allows user interfaces to be described in terms of their visual components and how they interact and relate with one another. It is a highly readable language, JSON-like syntax with support for imperative JavaScript expressions combined with dynamic property bindings. It can be used to build fluid animated user interfaces that can be connected to any backend C++ libraries.

QML is a declarative language that allows user interfaces to be described in terms of their visual components and how they interact and relate with one another. It is a highly readable language that was designed to enable components to be interconnected in a dynamic manner, and it allows components to be easily reused and customized within a user interface. Using the QtQuick module, designers and developers can easily build fluid animated user interfaces in QML, and have the option of connecting these user interfaces to any back-end C++ libraries.

Resources

11756 questions
24
votes
3 answers

How to design a multi-level fluid layout in QML

I have designed a layout in QML to learn more about its features and have some questions on the "Best Practices" in designing such layout. Here it is: It is essentially a ColumnLayout consisted of three RowLayouts, each one with some Rectangles.…
Isaac
  • 2,332
  • 6
  • 33
  • 59
24
votes
4 answers

How to declare list property in QML

How do I declare a list property in QML (for use with Qt.labs.settings in my case): Settings { property list recentFiles: [] } Does not work. I've tried many other options: list, string[], etc. None seem to work.
Timmmm
  • 88,195
  • 71
  • 364
  • 509
24
votes
6 answers

Can't load Image source in QML Image

This seems really basic but for some reason I can't get the image source to work in the ultra-simple QML app below. FYI, I'm running Mac OS-X 10.9.5, Qt Creator 3.2.1 based on Qt 5.3.2. import QtQuick 2.3 import QtQuick.Controls…
Bruce Dean
  • 2,798
  • 2
  • 18
  • 30
24
votes
2 answers

Run javascript function when a page loaded in QML

I want to run js function like this function setPersonalInfoValue(){ console.debug("setPersonalInfoValue()"); } when the page loaded in QML. I tried this: Rectangle { id: page2 width: 100 height: 62 function…
Vahid Kharazi
  • 5,723
  • 17
  • 60
  • 103
24
votes
2 answers

How to access the properties of a Repeater's children in QML?

Can you tell me for below code that is there any way to change the imgx element properties. I have to change imgx.x value using javascript. Or is there any other way? I search qt docs but not helpfull. Thanks. Row { Repeater { id:mmm …
serkan gezer
  • 429
  • 1
  • 5
  • 8
23
votes
2 answers

QML Code Coverage Analysis

Are there any tools for performing code coverage analysis on QML code? Is such a question even applicable to a declarative language like QML?
Paul Carlisle
  • 415
  • 1
  • 5
  • 11
23
votes
4 answers

QFile doesn't recognize file:/// url path format

I get the file path from Qml like this: mainView.projectFilePath = Qt.resolvedUrl(newProjectFileDlg.fileUrl).toString(); The above file path looks like this: file:///C:/uuuu.a3 But when this path is passed to QFile, it complains The filename,…
Dean Chen
  • 3,800
  • 8
  • 45
  • 70
22
votes
2 answers

How can I create a new window from within QML?

Is there a way to create a completely new window instance, as a child window of the main QML window in a QmlApplication? // ChildWindow.qml Rectangle { id: childWindow width: 100 height: 100 // stuff } // main.qml Rectangle { …
opatut
  • 6,708
  • 5
  • 32
  • 37
22
votes
3 answers

Can we declare global variable in QML file?

I want to do something similer to following code: //test.qml import QtQuick 1.0 Item { var globalforJs =10; function increment() // JavaScript function { globalforJs++; } .... QML Code Can we have global variable in…
psp1
  • 537
  • 2
  • 10
  • 19
22
votes
4 answers

QML console.log() and console.debug() don't write to console

I'm using Qt 5.6 on Fedora 23 and I noticed that console.log() and console.debug() don't write anything to console. My example code: import QtQuick 2.6 import QtQuick.Window 2.2 Window { visible: true Text { text: qsTr("Hello…
22
votes
2 answers

How to find the latest versions of all QML modules

Usually my QML files start with import QtQuick 2.4 and other imports. How can I know which is the latest version of the imported modules without having to guess by type and build?
Uga Buga
  • 1,724
  • 3
  • 19
  • 38
22
votes
1 answer

Qml: how to disable scrolling/swipe on ListView?

I implemented a master-detail in QML by using a horizontal list with snap, each list item being a view. Now I want to disable scrolling/swiping, how do I achieve that? There seems to be no useful ListView property for that.
Marco Piccolino
  • 814
  • 1
  • 7
  • 18
22
votes
7 answers

How to create a circular progress bar in pure QML+JS?

My application is made using QML+JS and I am looking to create a circular progress bar widget. I can create the circle using a QML Rectangle and settings its radius equal to its width/2 to make it into a circle. How do I create a progress bar out of…
Nik
  • 759
  • 3
  • 10
  • 24
22
votes
1 answer

Does QML support access specifiers like Private for properties?

I just want to know do we have any concept access specifiers like private property in QML as we have in C++. If not if would like to know in case i have about 10 properties in my QML component but i have to limit the access to only 2 properties. how…
DNamto
  • 1,342
  • 1
  • 21
  • 42
21
votes
3 answers

QML Connections: Implicitly defined onFoo properties in Connections are deprecated

I got the following error message when upgraded to Qt 5.15: QML Connections: Implicitly defined onFoo properties in Connections are deprecated. Use this syntax instead: function onFoo() { ... } The corresponding QML code is pasted…
Haozhe Xie
  • 3,438
  • 7
  • 27
  • 53