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
30
votes
2 answers

QML: Component vs Item as a container

What is the difference between Component and Item in QML ? The documentation is not absolutely clear here. What is the preferred type to use as a container for several widgets? Can it be replacable by Rectangle? For example, what is the difference…
Dmitry
  • 1,912
  • 2
  • 18
  • 29
29
votes
4 answers

How to include child mouse hover events in the parent MouseArea using QML?

I want to implement the following scenario in QML. Here is a sample/simplified delegate for ListView element: Component { Item { id: container MouseArea { anchors.fill: parent hoverEnabled: true …
S.M.Mousavi
  • 5,013
  • 7
  • 44
  • 59
28
votes
3 answers

Use of colon after class name in c++

This is a header file extracted from a blackberry 10 helloworld program. #ifndef ApplicationUI_HPP_ #define ApplicationUI_HPP_ #include namespace bb { namespace cascades { class Application; class LocaleHandler; …
DesirePRG
  • 6,122
  • 15
  • 69
  • 114
27
votes
5 answers

QML Keys.onEnterPressed issue

I have a QtQuick project for Desktop. It is very simple: // import QtQuick 1.0 // to target S60 5th Edition or Maemo 5 import QtQuick 1.1 Rectangle { width: 360 height: 360 Grid { id: xGrid width: parent.width …
nvcnvn
  • 4,991
  • 8
  • 49
  • 77
27
votes
2 answers

What is the difference between Clicked and Pressed in Qt?

Can you give me some help about how to distinguish Clicked and Pressed ? Thank you .. and What does Released means? would you give me a sample ?
Mr.Tu
  • 2,633
  • 8
  • 31
  • 47
27
votes
3 answers

Get the path from a QML url

FileDialog gives a QML url variable. theurl.toString() gives something like file:///c:\foo\bar.txt. How do I get c:\foo\bar.txt? I want to do it in a cross-platform way, and ideally without relying on regex-style hacks. QUrl provides a path()…
Timmmm
  • 88,195
  • 71
  • 364
  • 509
27
votes
5 answers

QML change image color

I searched for how to colorize an image (with the format svg or png ...). I tried covering my image with a rectangle that fills the image, but as my image is not a rectangle it colorizes the whole rectangle and not just the image. Is it possible to…
helene
  • 1,201
  • 2
  • 18
  • 30
26
votes
2 answers

What is the difference between Row and RowLayout?

This works as intended with Row, but not with RowLayout. Why? What is the difference between the two? ApplicationWindow { title: "Testing" width: 640 height: 480 //RowLayout { Row { anchors.fill: parent …
Patric
  • 763
  • 1
  • 8
  • 17
26
votes
2 answers

Clear QML anchor

I have a MouseArea that I want to start off centered and then have an absolute position once the up/down/left/right keys are pressed. My problem is that I don't know how to clear the anchor on the MouseArea so that I can specify an absolute…
Mitch
  • 23,716
  • 9
  • 83
  • 122
25
votes
4 answers

How to make a transparent window with Qt Quick?

Is there a way to make the window of a qml application transparent? I'm looking for a detailed description on how to draw simple shapes with qml while making the window of the application transparent, as well as the background. A working source code…
karlphillip
  • 92,053
  • 36
  • 243
  • 426
25
votes
4 answers

How can we declare enumerations in QML, without any JavaScript?

Does QML allow us to define enums? If so, how we can declare enumerations in QML? I want to declare an enum in QML like the following C++ enum. If possible, I want to do this without any JavaScript. enum Color { RED, GREEN, BLUE }; Color r =…
user4569486
25
votes
1 answer

Rectangle in QML that is transparent, except for the borders

Is there a way in QML to create a Rectangle with opacity: 0 that still have visible borders? If not, any suggestions on how to work around it? Thanks
Troels Folke
  • 917
  • 2
  • 9
  • 12
25
votes
6 answers

What is the equivalence for QString::arg() in QML

I'm wondering How I can have a string in QML that will be occupied with some arguments? Some thing like this in Qt: QString str("%1 %2"); str = str.arg("Number").arg(12);//str = "Number 12"
s4eed
  • 7,173
  • 9
  • 67
  • 104
24
votes
3 answers

How do you access the roles of the currentItem from a listview in QML?

I'm trying to access a role from a ListView in QML. Essentially, I have this in my QML: ListView { id: myId model: myModel delegate: Item { Text { text: model.text } Text { text:…
Jack Benson
  • 645
  • 2
  • 6
  • 8
24
votes
1 answer

What is the use of the ui.qml files in Qt5 (QML)?

As far as I can see the .qml files can be used to define the UI, which seems to override whatever is written in ui.qml file. So, what exactly is the use of the ui.qml file? I'm using Qt5 with Qt Creator.
user3927312
  • 814
  • 2
  • 13
  • 27