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
9
votes
1 answer

Multiple windows in a single project

I have a requirement for my project to display two QML Windows each on one of the screen (one sender, one receiver). Both of the .qml requires me to include some Cpp models inside hence, I'm using QQmlApplicationEngine to register the Cpp models. I…
angelhalo
  • 131
  • 1
  • 1
  • 8
9
votes
3 answers

Measuring elapsed time in QML

Let's consider the following example: we have a Qt Quick Controls Button. The user clicks it twice within 5 seconds. After pushing the Button for the first time, the QML Timer is running for these 5 seconds. We want to measure the time elapsed…
marmistrz
  • 5,974
  • 10
  • 42
  • 94
9
votes
3 answers

How to scroll QML ScrollView to center?

I have code like this: ScrollView { Image { source: "..." } } Image is higher than the ScrollView. How can I scroll the latter to the center of Image element?
fhdnsYa
  • 443
  • 1
  • 6
  • 15
9
votes
3 answers

Using QAbstractListModel in ListView

I'm new with Qt , so please bear with me . I've successfully managed to populate a ListView from a StringList and a QList of Object* What I'm struggling now with is to populate a ListView in QML using a class defined in C++ that derives…
MichaelCMS
  • 4,703
  • 2
  • 23
  • 29
9
votes
2 answers

How to implement a game-loop with C++ and QtQuick

I'm developing a game with QtQuick 2 (Qt5.2) QML and C++. I want most of the game-logic in C++ (I don't want to do it with JS), and I'm trying to use QStateMachines for a lot of the logic. Now my question is, how do I implement a proper game-loop in…
Ela782
  • 5,041
  • 5
  • 53
  • 66
9
votes
2 answers

QML binding to an array element

I have a width property on a QML Rectangle that is set based on another Rectangle with an id of mainwindow and one of the array properties of mainwindow: width: mainwindow.width/mainwindow.numColsPerRow[positionRow] This works at the time my…
johnbakers
  • 24,158
  • 24
  • 130
  • 258
9
votes
3 answers

Qt5 QML error QtQuick QtGraphicalEffects is not installed

After successful compilation of project, I have get an executable file. When I type ./program in result I see: QML Error: qrc:///qml/main.qml:25:1:module "QtGraphicalEffects" is not installed qrc:///qml/main.qml:24:1:module "QtQuick" is not…
jtomaszk
  • 9,223
  • 2
  • 28
  • 40
9
votes
1 answer

QML, dynamically adding elements to a listview

I need some help with adding elements into a qml listview, i have a textarea and a button that will add the textarea text into a listview item when is pressed, here's my attempt: Component { id: delegate Item { width: 200; height:…
Hairo
  • 2,062
  • 5
  • 27
  • 33
8
votes
1 answer

Canonical way to make custom TableView from ListView in Qt Quick

What is the best way to make table from ListView? Say, given a 2d array of strings and delegate for all the columns are Labels. How and when to calculate maximum item width for each column while using only QML? Content of each Label is not constant…
Tomilov Anatoliy
  • 15,657
  • 10
  • 64
  • 169
8
votes
1 answer

How to center elements in ColumnLayout

how can I center elements in ColumnLayout? Here is my qml code: ApplicationWindow { id: root visible: true width: 640 height: 640 title: qsTr("Your Booking") GridLayout{ anchors.fill: parent columns: 2 …
Michał Ściborski
  • 177
  • 1
  • 3
  • 8
8
votes
1 answer

__LINE__ __FILE__ OR similar function in qml

I am trying to print caller function, line number and file name without throwing an error for normal debugging purpose in QML. I can print caller function name as follows console.log("Caller Function Name"+arguments.callee.caller.name);
SourabhKus
  • 818
  • 8
  • 23
8
votes
1 answer

System tray icon without widgets

I'm wondering if there's a way to implement system tray icon + menu functionality without widgets module?
mbg033
  • 501
  • 5
  • 18
8
votes
1 answer

Adjusting QML Image display size

I have a QML window with a nested RowLayout. In the inner row I have two images. The source .png files for these images are (intentionally) rather large. When I attempt to set the height property on these images to make them smaller, they are still…
Phrogz
  • 296,393
  • 112
  • 651
  • 745
8
votes
2 answers

Is there any possibility to reach the index of an outer QML Repeater from the inner one (they are nested)?

I am trying to dynamically build a matrix of the same type of items in my QML application and keep it dynamic, so that you can change the number of rows and columns in a c++ file anytime. This has been working well, but now, to access them…
L. Srd
  • 91
  • 1
  • 4
8
votes
3 answers

import QtQuick.Controls 2.0 not working - QQmlApplicationEngine failed to load component

I have an app that its project generated using CMake in Qt5.7, so when import QtQuick.Controls 2.0 application failed to load with the following error: plugin cannot be loaded for module "QtQuick.Controls": Cannot load library …
Reza Ebrahimi
  • 3,623
  • 2
  • 27
  • 41