Questions tagged [qtquick2]

Qt Quick is a modern user interface technology that separates the declarative UI design and the imperative programming logic. Instead of the traditional C++ APIs of Qt, the presentation layer of the application is written with a Qt-specific declarative language called QML.

The Qt Quick module is the standard library for writing QML applications. While the Qt QML module provides the QML engine and language infrastructure, the Qt Quick module provides all the basic types necessary for creating user interfaces with QML. It provides a visual canvas and includes types for creating and animating visual components, receiving user input, creating data models and views and delayed object instantiation.

The Qt Quick module provides both a QML API which supplies QML types for creating user interfaces with the QML language, and a C++ API for extending QML applications with C++ code.

For more details, see the introduction to Qt Quick page in the Qt reference documentation.

2305 questions
20
votes
5 answers

QML - tracking global position of a component

I would like to track a global position of an object (or relative to one of it's ancestors) and bind it to some other item's position. I was thinking about using mapFromItem as follows: SomeObject { x: ancestor.mapFromItem(trackedObject,…
Konrad Madej
  • 1,271
  • 1
  • 11
  • 19
19
votes
1 answer

What's the difference between QQuickView and QQuickWindow?

I am currently working with Qt 5.2.1... and I have a (maybe stupid?) question: What is the difference between QQuickView and QQuickWindow? I read the documentation but it is still not clear to me...
Morix Dev
  • 2,700
  • 1
  • 28
  • 49
18
votes
4 answers

QML: how to specify image file path relative to application folder

We are developing our first Qt/QML application (trying technology). While technology looks very promising at a glance, we have faced so many unexpected weird issues that almost give up at very beginning. Here one of such issue. We want the following…
Alexey Kryshen
  • 1,067
  • 2
  • 11
  • 15
18
votes
1 answer

When starting off with Qt Framework, what to choose - Widgets or QT Quick?

I have a project in mind and want to take on it and have chosen QT as the preferred framework to begin with. I have been trying to figure out how to start and have Qt package (SDK and Qt Creator) installed. The problem is - I am not able to figure…
Vaibhav Kaushal
  • 340
  • 1
  • 6
  • 16
17
votes
2 answers

Spacer Item in QML Layouts

I want to create a layout in QML and I'd like to add a spacer item (the bottom selected item from the image below) just as you do using widgets like so: But I couldn't find anything to suit this on the QtQuick side of things...is it possible to…
Jacob Krieg
  • 2,834
  • 15
  • 68
  • 140
17
votes
2 answers

Two way binding C++ model in QML

I'm trying to learn more about QtQuick and QML. My current goal is to understand how to bind data from a C++ model to my view. So far I've been able to setup the model in my QML and get data from the model but I can't figure out how to update my…
amura.cxg
  • 2,348
  • 3
  • 21
  • 44
17
votes
5 answers

QML button change text color

I'm new in QML and i want to personalize my buttons. I succeed to change the background's color and border color. But I don't success at all to change the color of the button's text. I saw we don't use anymore "style" to change the style but…
Lazyos
  • 171
  • 1
  • 1
  • 3
16
votes
2 answers

How to make a resizable rectangle in QML?

I'm looking for a simple way to create a rectangle in a QQuickItem. I want to resize, and drag the borders of this rectangle like this (found at resizable QRubberBand) Has someone an idea?
501 - not implemented
  • 2,638
  • 4
  • 39
  • 74
16
votes
4 answers

How to create drop shadow for Rectangle on QtQuick 2.0

How can i draw a drop shadow for a Rectangle visual item on QtQuick 2.0? I like to draw a drop shadow for my main window (I have a transparent and no-decorated window)
S.M.Mousavi
  • 5,013
  • 7
  • 44
  • 59
15
votes
5 answers

How to center dialog on screen in QtQuick Controls 2?

All my dialogs appear on the top left corner of screen instead of the center. What is the best way to let the dialogs be placed automatically correct? import QtQuick 2.7 import QtQuick.Controls 2.2 ApplicationWindow { id: mainWindow …
feedc0de
  • 3,646
  • 8
  • 30
  • 55
15
votes
1 answer

How do I apply the style to a TextField in QML? It seems "style" attribute isn't available

I am trying to apply some styles to a new qt 5.7 application I am working on and the following is not working at all. It gives the error: qrc:/SignInView.qml:67 Cannot assign to non-existent property "style" And I can't edit it in design mode for…
Encompass
  • 562
  • 3
  • 13
  • 27
15
votes
3 answers

Align horizontalcenter in Column

Column documentation explains how to achieve this: However, I would like to achieve this: That is, all items inside the Column should be horizontally aligned to the center. anchors.horizontalCenter: parent.Center does not work. How can I obtain…
avb
  • 1,701
  • 5
  • 22
  • 37
15
votes
1 answer

HTML formatting in QML Text

I have a part of HTML code, which displays small table. In browser it looks like in the picture: But when I want to display it in Text QML (which, according to the documentation, should support HTML), I see: (Orange rectangle is a part of…
trivelt
  • 1,913
  • 3
  • 22
  • 44
15
votes
1 answer

How to print a QQuickView's contents to PDF?

I'm upgrading some Qt (C++ & QML) code from Qt4.8 to Qt5.1. The Qt4.8 code is a trivial C++ "QML viewer" app subclassing a QDeclarativeView, and a bunch of QML. It's been easy enough to change this to use Qt5/QtQuick2's QQuickView except for one…
timday
  • 24,582
  • 12
  • 83
  • 135
15
votes
5 answers

How do I show a message box with Qt Quick Controls?

What is the equivalent of QMessageBox::information() when one wishes to write a QML application using Qt Quick Controls?
Timmmm
  • 88,195
  • 71
  • 364
  • 509