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
136
votes
19 answers

Qt 5.1.1: Application failed to start because platform plugin "windows" is missing

Edit: Some people started to mark my question as a duplicate. Do not forget that many similar questions existed when I asked this one (see e.g. the list below). However, none of these answers solved my problem. After a long search I found a comment…
Anonymous
  • 4,144
  • 7
  • 41
  • 57
136
votes
4 answers

Qt: How do I handle the event of the user pressing the 'X' (close) button?

I am developing an application using Qt. I don't know which slot corresponds to the event of "the user clicking the 'X'(close) button of the window frame" i.e. this button: If there isn't a slot for this, can anyone suggest me some other method by…
Shiva
  • 2,487
  • 2
  • 15
  • 34
136
votes
6 answers

What does the Q_OBJECT macro do? Why do all Qt objects need this macro?

I just started using Qt and noticed that all the example class definitions have the macro Q_OBJECT as the first line. What is the purpose of this preprocessor macro?
Trevor Boyd Smith
  • 15,512
  • 24
  • 110
  • 159
130
votes
6 answers

Detect if stdin is a terminal or pipe?

When I execute "python" from the terminal with no arguments it brings up the Python interactive shell. When I execute "cat | python" from the terminal it doesn't launch the interactive mode. Somehow, without getting any input, it has detected that…
Mike McQuaid
  • 9,116
  • 5
  • 31
  • 38
121
votes
8 answers

Qt Creator - Project ERROR: Xcode not set up properly. You may need to confirm the license agreement by running /usr/bin/xcodebuild

I just installed Qt 5.5 and am using Qt Creator for the first time on OS X. When I first installed Qt, it gave me an error message 'Xcode 5 not installed' which I thought was strange, (I have the Xcode 7 beta), but the install completed…
123
  • 8,116
  • 10
  • 45
  • 87
120
votes
7 answers

Yes/No message box using QMessageBox

How do I show a message box with Yes/No buttons in Qt, and how do I check which of them was pressed? I.e. a message box that looks like this:
sashoalm
  • 63,456
  • 96
  • 348
  • 677
115
votes
8 answers

Adding external library into Qt Creator project

How can I add external library into a project built by Qt Creator RC1 (version 0.9.2)? For example, the win32 function EnumProcesses() requires Psapi.lib to be added in the project to build.
Donotalo
  • 11,954
  • 23
  • 75
  • 111
115
votes
12 answers

Hand Coded GUI Versus Qt Designer GUI

I'm spending these holidays learning to write Qt applications. I was reading about Qt Designer just a few hours ago, which made me wonder : what do people writing real world applications in Qt use to design their GUIs? In fact, how do people design…
Ankur Sethi
  • 3,338
  • 5
  • 21
  • 17
112
votes
8 answers

Qt: can't find -lGL error

I just reinstalled QtCreator, created new project (Qt Application) an got this after compilation: /usr/bin/ld: **cannot find -lGL** collect2: error: ld returned 1 exit status make: *** [untitled1] Error 1 18:07:41: The process "/usr/bin/make"…
Hofmn
  • 1,223
  • 2
  • 9
  • 4
111
votes
17 answers

"Failed to load platform plugin "xcb" " while launching qt5 app on linux without qt installed

I wrote application for linux which uses Qt5. But when I am trying to launch it on the linux without Qt SDK installed, the output in console is: Failed to load platform plugin "xcb". Available platforms are: How can I fix this? May be I need to…
locomotion
  • 1,418
  • 3
  • 10
  • 15
110
votes
10 answers

How to specify different Debug/Release output directories in QMake .pro file

I have a Qt project and I would like to output compilation files outside the source tree. I currently have the following directory structure: / |_/build |_/mylib |_/include |_/src |_/resources Depending on the configuration (debug/release), I…
Etienne Savard
  • 4,553
  • 6
  • 29
  • 45
106
votes
10 answers

QString to char* conversion

I was trying to convert a QString to char* type by the following methods, but they don't seem to work. //QLineEdit *line=new QLineEdit();{just to describe what is line here} QString temp=line->text(); char *str=(char *)malloc(10); QByteArray…
mawia
  • 8,513
  • 13
  • 45
  • 57
106
votes
9 answers

How to create a subdirectory for a project QtCreator?

I would like to divide my Qt project into several directories because it is growing pretty large. However, when I click on browse in QtCreator, there is no 'Add directory' and no such thing in 'Add new'. Can this be done somehow?
gruszczy
  • 37,239
  • 27
  • 119
  • 167
105
votes
6 answers

Why Qt is misusing model/view terminology?

I think that the terminology used in Qt with model/view controls is flawed. On their explanation page they state, that they simplified the MVC to MV by merging View and Controller and they are giving the following picture: However I think, they…
gorn
  • 4,390
  • 6
  • 28
  • 43
102
votes
10 answers

Qt events and signal/slots

In the Qt world, what is the difference of events and signal/slots? Does one replace the other? Are events an abstraction of signal/slots?
Raphael
  • 7,388
  • 12
  • 55
  • 81