Questions tagged [qt5]

Questions specifically for version 5.x of the Qt library. If your question applies to other versions of Qt, use the tag [tag:qt4] or [tag:qt3]. It is recommended to use with the tag [tag:qt].

Qt (pronounced officially as cute (/kyut/) though commonly pronounced as (/ˈkyu ti/)) is a cross-platform application development framework widely used for the development of GUI programs (in which case it is known as a widget toolkit), and also used for developing non-GUI programs such as console tools and servers. wikipedia

Qt is developed and maintained by The Qt Company which is subsidiary of Digia.

Qt also provides an integrated development environment named Qt Creator. Though it mainly aims at creating Qt applications, it can be used to create regular C++ applications too.

Resources:

Tagging recommendation:

You will often see questions tagged specifically as , or to indicate that the user experiences the problem in Qt 3.x, 4.x or 5.x, respectively. The default when version information is lacking is to assume version 5.x of the API.

7821 questions
28
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
  • 68,359
  • 51
  • 283
  • 367
26
votes
5 answers

Dark theme for Qt widgets?

Background I'm building a PyQt5 application, that I'd like to have a dark theme for. Previously I've worked with Android development where there was a dark theme that I could set for a whole application Question Is there a dark theme built into Qt…
sunyata
  • 1,233
  • 2
  • 19
  • 30
26
votes
2 answers

How to generate video file from QImage sequence using QMediaRecorder in Qt5 C++

Basically what I want is to encode a video using QMediaRecorder by supplying as a source a sequence of QImages that I generate in custom code at run-time. So far I have found no easy way to do this, and everything points at the solution where I have…
Lennart Rolland
  • 7,561
  • 6
  • 47
  • 80
26
votes
1 answer

Why does FlowLayout behave differently in Qt 5.2, compared to Qt 4.8?

I've just ported my application from Qt 4.8.4 to Qt 5.2.1. I have an issue with the FlowLayout class as provided in the FlowLayout example code in the Qt docs. I have a QMainWindow with a QDockWidget docked at the bottom of the central widget. The…
c_k
  • 1,726
  • 1
  • 20
  • 35
25
votes
3 answers

Deploying Qt5 on Windows without Hardware Acceleration

Qt5 can use the OpenGL driver or the DirectX Driver by using ANGLE. As we cannot depend on an installed OpenGL driver, we need to use the ANGLE backend. Unfortunately, this doesn't solve all deployment problems especially on Windows virtual machines…
Sebastian Wagner
  • 1,655
  • 2
  • 16
  • 24
25
votes
2 answers

Remove selected items from listWidget

How to remove selected items from qlistWidget. I have tried write the following code, but does not work. QList items = ui->listWidget->selectedItems(); foreach(QListWidgetItem item, items){ …
Lion King
  • 28,712
  • 21
  • 69
  • 128
25
votes
4 answers

Qt 5 build error: extra characters after test expression

I am trying to learn Qt 5.3, and this is my first program (hello world). When I try to build, it displays this error: extra characters after test expression. I cannot understand at all why this error comes up. I just took some simple code from…
Sham
  • 404
  • 1
  • 6
  • 14
25
votes
4 answers

How to check the selected version of Qt in a .pro file?

I have multiple versions of Qt installed, and I need to compile my project with all of them. Using a pro file, I could not find in the documentation how to do a conditional compilation. Ideally, this is what I would like to do: QT_VERSION = 5 …
Pietro
  • 10,628
  • 22
  • 80
  • 165
24
votes
1 answer

C++ Qt where's the std::unique_ptr Qt version?

So when programming in Qt I like to go with the Qt implementation as far as possible. As far as I've seen there's no Qt version of the std::unique_ptr or is there? What would be the alternatives that produce the "same" result in Qt if it doesn't…
deW1
  • 5,196
  • 10
  • 35
  • 52
24
votes
1 answer

Qt5 new signal to lambda connections memory leak

The new Qt5 signals and slots syntax allows us to connect signals not only to slots, but also to plain old functions and functors/lambdas. Now the problem is, that lambdas are essentialy objects with () operator, and when you connect signals to…
Sigil
  • 243
  • 2
  • 6
24
votes
3 answers

How to catch exceptions in Qt?

try { // `count()` throws exception connect(thread, SIGNAL(started()), engine, SLOT(count())); } catch(const X& e) {} As of Qt-5, I get following error: Qt has caught an exception thrown from an event handler. Throwing exceptions from an…
smallB
  • 14,808
  • 29
  • 97
  • 144
23
votes
1 answer

In Qt 5, what's the right way to show multi-monitor full screen QWidget windows?

I have a Windows & Mac program that switches into full-screen mode on multiple monitors. In Qt 4, it seems (I can't find explicit documentation on how to do this) like the 'correct' way to go about this is by creating N QMainWindow's for the N…
Ted Middleton
  • 5,722
  • 9
  • 43
  • 64
23
votes
2 answers

How to override just one property:value pair in Qt StyleSheet

I am writing newbie Qt5 code on OSX Mavericks and would like to override just one property:value pair of the StyleSheet for a given widget. If I run the following self-contained demonstration code: #include #include…
lcikgl
  • 679
  • 6
  • 18
22
votes
1 answer

CMake cannot find Qt5LinguistTools in Docker / Ubuntu 18.04

My simple Dockerfile: FROM ubuntu:18.04 RUN apt update && apt upgrade -y RUN apt install build-essential cmake qt5-default -y RUN apt install qttools5-dev-tools -y When I check linguist inside the container it's there: root@9087245330a7:/# which…
juzzlin
  • 38,196
  • 4
  • 25
  • 37
22
votes
2 answers

Use of variables like %{buildDir} in QtCreator kit settings in Qt5

In this documentation (under section "Specifying a Custom Executable to Run") I noticed that there is mention of what looks like a variable %{buildDir} in the field "Working directory". I have struggled for a while now to find documentation for…
Lennart Rolland
  • 7,561
  • 6
  • 47
  • 80