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
15
votes
2 answers

Calling a Qt function from the Javascript side (QWebView)

I have a Qt project that can load any HTML page into a web view. I have the following code in main.cpp file: #include "mainwindow.h" #include #include int main(int argc, char *argv[]) { QApplication app(argc, argv); …
Ionică Bizău
  • 109,027
  • 88
  • 289
  • 474
15
votes
3 answers

QML Coding Style Checker

I'm looking for a coding style checker for QML code. Something like Checkstyle or Artistic Style. What do people use to define coding style checks for their DSL of choice? Clarification: I'm looking for something that can be used in build automation…
cellcortex
  • 3,166
  • 1
  • 24
  • 34
15
votes
4 answers

Qt Cannot open include file: 'QPrinter'

I am new to Qt. Downloaded source code for a Qt application of SourceForge, and tried to build and run it. After working through a few similar problems by adding QT += statements to .pro files, I am stuck on this one: On attempting to build in Qt…
Matt M
  • 151
  • 1
  • 1
  • 6
15
votes
2 answers

QDockWidget initial width

How do I set the initial width of a QDockWidget? I have implemented the sizeHint function but what next?
Phil Hannent
  • 12,047
  • 17
  • 71
  • 118
15
votes
1 answer

setWindowFlags(Qt::WindowStaysOnTopHint) hides Qt Window

I want to make my Qt Window stay on top. When setWindowFlags(Qt::WindowStaysOnTopHint) is executed, the window becomes hidden (on Windows 7). I've also tried: Qt::WindowFlags flags = windowFlags(); setWindowFlags(flags |…
swtdrgn
  • 1,154
  • 4
  • 17
  • 49
15
votes
4 answers

Cannot open include file: 'QWebView': No such file or directory

I have followed the instructions on the following page: http://qt-project.org/wiki/Open_Web_Page_in_QWebView I added QT += webkit in my pro file and ran qmake, then clean all and compile again. I still get: error: C1083: Cannot open include file:…
Dimo
  • 3,238
  • 6
  • 29
  • 46
15
votes
2 answers

How to find an object by name in pyqt?

I have a list of dictionaries: globalParams = [{'attr':'enabled','ctrl':'checkBoxEnabled','type':'checkBox'}, {'attr':'colorMode','ctrl':'comboBoxColorMode','type':'comboBox'}] 'ctrl' - name of the control in the Qt window.…
Massimo
  • 836
  • 3
  • 17
  • 38
15
votes
5 answers

How do I show a message box with Qt Quick Controls?

What is the equivalent of QMessageBox::information() when one wishes to write a QML application using Qt Quick Controls?
Timmmm
  • 88,195
  • 71
  • 364
  • 509
15
votes
3 answers

How to get a return value from QMetaObject::invokeMethod

I am calling from my thread the following: QMetaObject::invokeMethod(pProcessor, "doTask", Qt::QueuedConnection, Q_RETURN_ARG(quint32, taskId), …
Amy
  • 1,814
  • 2
  • 23
  • 38
15
votes
2 answers

Connecting signals to slots with less params allowed in Qt?

Is it valid to call QObject::connect(a, SIGNAL(somesig(someparam)), b, SLOT(someslot())); without params? It seems to work (no runtime exception thrown) but I can't find a reference in the docs. All I found is that this is possible if someslot has…
Beachwalker
  • 7,685
  • 6
  • 52
  • 94
15
votes
1 answer

Writing and reading custom class to QSettings

I need to store instances of a custom class in the registry via QSettings. After reading from Qt's documentation, I think I have implemented the needed functions but I don't manage to save anything. Here's my custom class : class…
Ote
  • 301
  • 1
  • 5
  • 16
15
votes
2 answers

max/min function in QML

I would like to set the height of an element. It should be the height of the highest child element. Is there something like: Parent { height: max(child1.height, child2.height) } Alternatively something like: Parent { height:…
15
votes
5 answers

QT - CSS: decoration on focus

I'm experimenting a bit with CSS for making a cool user interface for my QT application. I have this problem: I have a QPushButton and when it is on focus it has a rectangle on it that I want to remove. Here some screen-shot: Normal button: Focused…
nkint
  • 11,513
  • 31
  • 103
  • 174
15
votes
1 answer

Qt Creator - custom namespace for UI classes

I would like to have a UI class in its own namespace, like ProjectName::MainWindow. Is there some convenient way how to achieve this in Qt Creator, please? I can open the mainwindow.ui file and change the from "MainWindow" to…
eMko
  • 1,147
  • 9
  • 22
15
votes
2 answers

Space between widgets in QVBoxLayout

I'm trying to make a sign-in form with Qt5.0.1. I created 2 Widgets and I put my labels and line edits in one of them, and my button in other one. Then I put these 2 widgets in a QVBoxLayout, but the space between two widget in layout is more than…
Aidin.T
  • 731
  • 3
  • 10
  • 25