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 6.2, released in September 2021. 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. The latest released major version is Qt 6.x so, when not specifically mentioned, version 6.x of the API should be assumed for questions posted after September, 2021.

Spelling

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

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:

Check out the official Qt documentation for more details of recommended books about Qt programming.

85593 questions
100
votes
13 answers

How can I get the selected VALUE out of a QCombobox?

In Qt, I can get the selected text of a QComboBox by using the combobox->currentText() method. How can I get the selected value? I searched for help but I couldn't find a method currentData() which I expected to find. I could only find…
sabbour
  • 4,969
  • 6
  • 34
  • 33
100
votes
5 answers

What is the difference between QImage and QPixmap?

I do not understand what is the difference between QImage and QPixmap, they seem to offer the same functionality. When should I use a QImage and when should I use a QPixmap?
Mr.Tu
  • 2,633
  • 8
  • 31
  • 47
99
votes
4 answers

Convert std::string to QString

I've got an std::string content that I know contains UTF-8 data. I want to convert it to a QString. How do I do that, avoiding the from-ASCII conversion in Qt?
Fred Foo
  • 355,277
  • 75
  • 744
  • 836
97
votes
10 answers

Qt: resizing a QLabel containing a QPixmap while keeping its aspect ratio

I use a QLabel to display the content of a bigger, dynamically changing QPixmap to the user. It would be nice to make this label smaller/larger depending on the space available. The screen size is not always as big as the QPixmap. How can I modify…
marvin2k
  • 1,573
  • 2
  • 14
  • 18
97
votes
6 answers

Passing an argument to a slot

I want to override mouseReleaseEvent with a bunch of QActions and QMenus... connect(action1, SIGNAL(triggered()), this, SLOT(onStepIncreased())); connect(action5, SIGNAL(triggered()), this, SLOT(onStepIncreased())); connect(action10,…
Fatih Arslan
  • 1,054
  • 1
  • 9
  • 10
96
votes
4 answers

Qt "private slots:" what is this?

I understand how to use it, but the syntax of it bothers me. What is "private slots:" doing? I have never seen something between the private keyword and the : in a class definition before. Is there some fancy C++ magic going on here? And example…
Justin
  • 2,322
  • 1
  • 16
  • 22
95
votes
11 answers

QtCreator: No valid kits found

Installed just the IDE on Windows 7. I want to create a Plain C++ Project (Non-QT Project); however I get an error: No valid kits found. When I click on Options->Kits, I see the Desktop (default) kit, and it shows no errors. Am I getting the…
Agrim Pathak
  • 3,047
  • 4
  • 27
  • 43
93
votes
3 answers

How to format a QString?

I'd like to format a string for Qt label, I'm programming in C++ on Qt. In ObjC I would write something like: NSString *format=[NSString stringWithFormat: ... ]; How to do something like that in Qt?
hubert poduszczak
  • 931
  • 1
  • 6
  • 3
93
votes
5 answers

How to change the Title of the window in Qt?

How to change the title of the window in Qt? (Both for QDialog and QMainWindow.)
tna0y
  • 1,842
  • 3
  • 16
  • 33
92
votes
2 answers

Qt. get part of QString

I want to get QString from another QString, when I know necessary indexes. For example: Main string: "This is a string". I want to create new QString from first 5 symbols and get "This ". input : first and last char number. output : new QString. How…
AlekseyS
  • 921
  • 1
  • 6
  • 4
90
votes
13 answers

How do I create a pause/wait function using Qt?

I'm playing around with Qt, and I want to create a simple pause between two commands. However it won't seem to let me use Sleep(int mili);, and I can't find any obvious wait functions. I am basically just making a console application to test some…
Zac
  • 2,229
  • 9
  • 33
  • 41
89
votes
7 answers

How do I create a simple Qt console application in C++?

I was trying to create a simple console application to try out Qt's XML parser. I started a project in VS2008 and got this template: int main(int argc, char *argv[]) { QCoreApplication a(argc, argv); return a.exec(); } Since I don't need…
neuviemeporte
  • 6,310
  • 10
  • 49
  • 78
89
votes
5 answers

How do I configure Qt for cross-compilation from Linux to Windows target?

I want to cross compile the Qt libraries (and eventually my application) for a Windows x86_64 target using a Linux x86_64 host machine. I feel like I am close, but I may have a fundamental misunderstanding of some parts of this process. I began by…
Mr. Shickadance
  • 5,283
  • 9
  • 45
  • 61
88
votes
5 answers

Why don't the official Qt examples and tutorials use smart pointers?

Why do official examples and tutorials about the Qt library never make use of smart pointers? I only see new and delete for creating and destroying the widgets. I searched for the rationale but I could not find it, and I don't see one myself except…
Martin
  • 9,089
  • 11
  • 52
  • 87
88
votes
4 answers

Qt Designer vs Qt Quick Designer vs Qt Creator?

I have seen references to all three of these applications on various parts of the Qt website but am completely unclear as to the exact differences between them and whether they are actually separate things or just different names for the same thing,…
temporary_user_name
  • 35,956
  • 47
  • 141
  • 220