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
37
votes
4 answers

How to do a "is_a", "typeof" or instanceof in QML?

I want to run through a list of QML components and choose one type: for (var i = 0; i < controls.children.length; ++i) { if ( typeof (controls.children[i].height) == "QDeclarativeRectangle") { // do stuff } } How does one…
Scott Montgomerie
  • 1,780
  • 1
  • 16
  • 17
35
votes
7 answers

Different delegates for QML ListView

I would like to know if it's possible to use (several) different delegates for a QML ListView. Depending on the individual object in the ListView model, I would like to visualize the objects with different delegates. This piece of code explains…
dh1tw
  • 1,411
  • 2
  • 23
  • 29
34
votes
7 answers

QML Listview selected item highlight on click

Hi I want to put this code : highlight: Rectangle { color: "black" radius: 5 opacity: 0.7 focus: true } into mouseArea in onclick handler: MouseArea { id: mouse_area1 z: 1 hoverEnabled: false anchors.fill: parent …
user123_456
  • 5,635
  • 26
  • 84
  • 140
34
votes
3 answers

How to make QML items to grow to fit contents?

How to make ServerItem to grow to fit contents? Right now ServerItems just overlap each other. main.qml import Qt 4.7 import "Teeworlds" as Teeworlds Item { Column { Teeworlds.ServerItem { serverName: "InstaGib, lost [xyz]" …
lamefun
  • 3,862
  • 4
  • 20
  • 22
34
votes
6 answers

QML: List all object members/properties in console

Is there any way to list all object members/properties in QML & Qt 5.1? Such as: var obj=myQObject; console.log(obj) // expected output: // obj { x:123..... } This would be very helpful for debugging.
tirth
  • 813
  • 1
  • 8
  • 16
33
votes
7 answers

Include another QML file from a QML file

There's another question on Stackoverflow about this matter but I don't find the accepted solution possible. So I ask again because the old question is out of attention. The situation is this way. I have application screens defined by 'main.qml',…
jondinham
  • 8,271
  • 17
  • 80
  • 137
32
votes
3 answers

Resources to learn QML?

Can you please suggest resources to learn QML ( Qt Markup Language )?
SunnyShah
  • 28,934
  • 30
  • 90
  • 137
32
votes
2 answers

What is the difference between QQmlApplicationEngine and QQuickView?

I'm using QQmlApplicationEngine as follows: QGuiApplication app(argc, argv); QQmlApplicationEngine engine; engine.load(QUrl(QStringLiteral("qrc:/main.qml"))); app.exec(); But now I want to enable multisampling for my app, and…
Stefan Monov
  • 11,332
  • 10
  • 63
  • 120
32
votes
3 answers

Does Python go well with QML (Qt-Quick)?

I am a beginner in Qt-Quick. I am not aware of Qt which is a basis for QML. And also I'm not familiar with C++ which is again main supported language for both Qt and QML. I'm aware JS can do a lot of logic in QML layer itself. But if we need…
inblueswithu
  • 953
  • 2
  • 18
  • 29
32
votes
3 answers

QML Text element hyperlink

In my QML Text element I want to have a hyperlink to a website and managed to do so with it looking like one etc. but when I click or touch it nothing happens, the link is supposed to open in a the default browser. Text { id: link_Text text:…
Gerharddc
  • 3,921
  • 8
  • 45
  • 83
31
votes
3 answers

Stretching element to contain all children

How is it possible in QML to automatically stretch element so that all its childs fit in it? And how to specify spacing? For example, I would like to have a rectangle around a text. The rectangle should have some internal spacing. If I write the…
Juraj Blaho
  • 13,301
  • 7
  • 50
  • 96
31
votes
5 answers

Qt5 QML module is not installed

I'm confused about modules in Qt QML. I've read all the docs, but it doesn't make clear some basic ideas. I understand that i can put a bunch of QML files into a directory and add a qmldir file to describe an identified module. When i do this and…
jkj yuio
  • 2,543
  • 5
  • 32
  • 49
31
votes
5 answers

QML - Control border width and color on any one side of Rectangle element

Currently i had a requirement of drawing a delegate rectangle with the help of ListView control. I was able to draw a series of rectangle either horizontal or vertical within the list view but the problem is with the border of the rectangle. The…
Santhosh
  • 637
  • 1
  • 7
  • 19
31
votes
9 answers

Accessing C++ QLists from QML

If I've got a list of things in C++, how do I expose that to QML (in Qt5 / QtQuick 2)? It seems like QML can only understand QObject-derived classes, which is an issue because QObjects can't be put in a QList or copied. How do I do this: struct…
Timmmm
  • 88,195
  • 71
  • 364
  • 509
31
votes
5 answers

How to define a "template" with child placeholders in QML?

I really like QML. I like how I can define components (comparable to classes) and their properties, and instantiate them from somewhere else (comparable to objects). I can define, let's say, a button, having some look and feel, and a label text on…
leemes
  • 44,967
  • 21
  • 135
  • 183