Questions tagged [qt]

Qt is a cross-platform application development framework widely used for the development of application software that can be run on various software and hardware platforms with little or no change in the underlying codebase, while having the power and speed of native applications. Qt is available with both commercial and open source licenses.

General information

Official logo

Qt logo

About

Qt (pronounced officially as cute (/'kjuːt/) though commonly pronounced as Q.T. (/ˈkjuː.tiː/)) is a cross-platform application development framework widely used for the development of GUI programs (where it functions like a cross-platform widget toolkit), and also used for developing non-GUI programs such as console tools and servers. wikipedia

Qt was created by Trolltech, and was acquired by Nokia in 2008. One month after the end of symbian development at Nokia, Nokia decided to sell Qt. From September 2012 and until now Qt is managed by the Qt Company which is subsidiary of Digia.

License

Qt is available under four different licenses:

  1. GNU General Public License (GPL) version 3.0
  2. GNU Lesser General Public License (LGPL) version 2.1
  3. GNU Lesser General Public License (LGPL) version 3.0
  4. Qt Commercial License (which comes in three versions with different features and prices: "Indie Mobile", "Professional" and "Enterprise")

Current version

The latest official release is 5.14. The major version indicates API and binary compatibility.

Recommendations

Tagging

You will often see questions tagged specifically as , , or to indicate that the question is related to Qt 3.x, 4.x, 5.x or 6.x respectively. Qt 3.x is no longer supported, and Qt 6 is still in beta. The latest released major version is still Qt 5.x so, when not specifically mentioned, version 5.x of the API should be assumed.

Spelling

The correct spelling is Qt, not to be confused with QT, which stands for QuickTime - an extensible multimedia framework developed by Apple Inc.

Reminder

Please, do not answer poor questions that will likely get closed or even deleted later. We are aiming for high-quality in this tag, thus we do not wish to encourage poor questions by feeding them with answers.

Resources

Documentation

There is an extensive official documentation (all classes) available on Qt's website, in addition to tutorials and examples. You will often see these tutorials and examples referenced in the questions and answers on this site. Qt also provides an integrated development environment, IDE, named Qt Creator. Although it mainly aims at creating Qt applications, it can be used to create regular C++ applications as well.

Video courses

Pluralsight has a series of three courses on Qt:

  1. Introduction to Qt: A C++ Cross Platform Application Framework
  2. Qt Quick Fundamentals
  3. Integrating Qt Quick and C++

Pluralsight is a subscription based but if you're only interested in Qt you can send the author @todgentille a private tweet and request a week long VIP pass. You'll get unlimited access to the higher subscription level for a week that allows viewing online and offline and you can download the course materials.

Packtpub also has a video tutorial based on Qt 5.

Voidrealm released a full free series of Qt tutorials for beginners on his youtube channel.

Books

Qt introductory books:

Integrated learning of Qt and C++:

Concepts of UI design:

Please, check out the official Qt documentation for more details of recommended books about Qt programming.

79389 questions
393
votes
8 answers

How to convert int to QString?

Is there a QString function which takes an int and outputs it as a QString?
Ahmad
  • 11,274
  • 24
  • 79
  • 132
249
votes
10 answers

How to convert QString to std::string?

I am trying to do something like this: QString string; // do things... std::cout << string << std::endl; but the code doesn't compile. How to output the content of qstring into the console (e.g. for debugging purposes or other reasons)? How to…
augustin
  • 13,003
  • 11
  • 55
  • 77
236
votes
5 answers

Auto-expanding layout with Qt-Designer

I'm using the Qt Designer. I want to create a QVBoxLayout which will automatically expand to fill the whole window. The layout of the QVBoxLayout remains fixed. How can I cause the QVBoxLayout to expand and fill the entire window through the…
Elazar Leibovich
  • 30,136
  • 27
  • 116
  • 161
196
votes
6 answers

QLabel: set color of text and background

How do I set color of text and background of a QLabel ?
Regof
  • 2,487
  • 3
  • 19
  • 20
191
votes
14 answers

STL or Qt containers?

What are the pros and cons of using Qt containers (QMap, QVector, etc.) over their STL equivalent? I can see one reason to prefer Qt: Qt containers can be passed along to other parts of Qt. For example, they can be used to populate a QVariant and…
Julien-L
  • 4,913
  • 3
  • 31
  • 47
170
votes
12 answers

How to print to console when using Qt

I'm using Qt4 and C++ for making some programs in computer graphics. I need to be able to print some variables in my console at run-time, not debugging, but cout doesn't seem to work even if I add the libraries. Is there a way to do this?
lesolorzanov
  • 3,147
  • 6
  • 31
  • 48
168
votes
6 answers

How to enable C++11 in Qt Creator?

The title is pretty self-descriptive. I've downloaded Qt Creator 2.7.0, and I am trying to compile some basic C++11 code: int my_array[5] = {1, 2, 3, 4, 5}; for(int &x : my_array) { x *= 2; } I'm receiving the following error: range based for…
Andrey Chernukha
  • 20,316
  • 16
  • 89
  • 153
162
votes
7 answers

How to change string into QString?

What is the most basic way to do it?
NeverAgain
  • 1,743
  • 3
  • 13
  • 9
160
votes
5 answers

Checking if a folder exists (and creating folders) in Qt, C++

In Qt, how do I check if a given folder exists in the current directory? If it doesn't exist, how do I then create an empty folder?
Switch
  • 4,556
  • 11
  • 31
  • 38
149
votes
19 answers

Beyond Stack Sampling: C++ Profilers

A Hacker's Tale The date is 12/02/10. The days before Christmas are dripping away and I've pretty much hit a major road block as a windows programmer. I've been using AQTime, I've tried sleepy, shiny, and very sleepy, and as we speak, VTune is…
Jake Kurzer
  • 1,452
  • 3
  • 16
  • 24
146
votes
11 answers

qmake: could not find a Qt installation of ''

I have a software in ubuntu that requires me to run qmake to generate the Makefile. However, running qmake gives back this error, qmake: could not find a Qt installation of '' I have installed what I thought to be the required packages using, sudo…
Curious
  • 5,533
  • 6
  • 33
  • 63
145
votes
4 answers

Connecting overloaded signals and slots in Qt 5

I'm having trouble getting to grips with the new signal/slot syntax (using pointer to member function) in Qt 5, as described in New Signal Slot Syntax. I tried changing this: QObject::connect(spinBox, SIGNAL(valueChanged(int)), …
dtruby
  • 1,585
  • 2
  • 11
  • 9
138
votes
3 answers

How to build Qt for Visual Studio 2010

I struggled finding a how-to which provides a stable solution for using Qt with Visual Studio 2010, so after collecting all the bits of information and some trial and error, I would like to write my solution into a guide. The problem, or why is it…
hyperknot
  • 12,019
  • 22
  • 87
  • 143
137
votes
6 answers

Correct way to quit a Qt program?

How should I quit a Qt Program, e.g when loading a data file, and discovered file corruption, and user need to quit this app or re-initiate data file? Should I: call exit(EXIT_FAILURE) call QApplication::quit() call QCoreApplication::quit() And…
daisy
  • 19,459
  • 24
  • 111
  • 218
137
votes
31 answers

Cannot launch AVD in emulator:QT library not found

I am new to Android Studio and I am having problems while using the emulator. When I try to run it keeps crashing saying: "Cannot launch AVD in emulator" [6816]:ERROR:./android/qt/qt_setup.cpp:28:Qt library not found at …
Jay
  • 1,371
  • 2
  • 7
  • 4
1
2 3
99 100