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
3 answers

How do I style a Qt Widget not its children with stylesheets?

I have a: class Box : public QWidget and it has this->setLayout(new QGridLayout(this)); I tried doing: this->setStyleSheet( "border-radius: 5px; " "border: 1px solid black;" "border: 2px groove gray;" …
chacham15
  • 13,719
  • 26
  • 104
  • 207
15
votes
2 answers

QtTest Unit Testing, how to add header files located in another project?

Maybe I'm missing something, but it seems really stupid to me that the only tutorial provided for QtTest framework has you testing the QString class. The typical use case for unit testing is....testing classes you wrote yourself, but there is no…
John Lotacs
  • 1,184
  • 4
  • 20
  • 34
15
votes
2 answers

QPlainTextEdit truncate history linewise

I have a GUI application whose main part is a QPlainTextEdit. It is used to display a log of the application, and as such the associated text grows line by line ad infinitum. As the application is intended to run very long, I need to limit the…
moooeeeep
  • 31,622
  • 22
  • 98
  • 187
15
votes
2 answers

PySide: Easier way of updating GUI from another thread

I have a PySide (Qt) GUI which spawns multiple threads. The threads sometimes need to update the GUI. I have solved this in the following way: class Signaller(QtCore.QObject) : my_signal = QtCore.Signal(QListWidgetItem, QIcon) signaller =…
Petter
  • 37,121
  • 7
  • 47
  • 62
15
votes
3 answers

wkhtmltopdf patched qt?

I'm trying to convert multiple URLs to PDF. However, when I compile wkhtmltopdf or run apt-get install wkhtmltopdf and try, it says: Error: This version of wkhtmltopdf is build against an unpatched version of QT, and does not support more then one…
m3rg
  • 688
  • 2
  • 9
  • 25
15
votes
4 answers

What steps are necessary to enable antialiasing when using a QPainter on a QGLWidget?

I am trying to draw basic shapes on a QGLWidget. I am trying to enable antialiasing to smooth out the lines, but it is not working. This is what I am trying at the moment: QGLWidget *widget = ui->renderWidget; QPainter…
Elliott
  • 1,336
  • 1
  • 13
  • 26
15
votes
2 answers

How to create screenshot of QWidget?

I work at my homework in Qt Creator, where I paint to QWidget and I need to save some part of this QWdiget. I tried to solve this problem: QPixmap pixmap; pixmap.copy(rectangle); // rectangle is part of QWidget, which I need to save …
avalagne
  • 359
  • 3
  • 7
  • 15
15
votes
5 answers

Is it valid to define a pure virtual signal in C++/Qt?

I am making an abstract-base-class and was thinking I might want a pure virtual signal. But when I compiled I get a warning for the pure virtual signals I have defined: ../FILE1.h:27: Warning: Signals cannot be declared virtual ../FILE1.h:28:…
Trevor Boyd Smith
  • 18,164
  • 32
  • 127
  • 177
14
votes
5 answers

Disable QDialogs default close button (upper left "cross button")?

Is it possible to disable/delete the QDialogs default close button at the upper left of the dialog?
Streight
  • 811
  • 4
  • 15
  • 28
14
votes
3 answers

How to set crlf endings in QtCreator on linux

I want to set QtCreator to use CRLF instead of LF in unix. Is there a way to do that? PS: I know I can use dos2unix on the files however I don't want to do that.
Dan Lincan
  • 1,065
  • 2
  • 14
  • 32
14
votes
3 answers

QDir mkdir with absolutepath

I have problem with the creation of dir with Qt. I would like to create a dir in documents'dir so, I make some things like that : QString path("C:/Users/Me/Documents/MyApp/profiles/"); Qdir dir = QDir::root(); dir.mkdir(path); But that doesn't…
Guillaume
  • 8,741
  • 11
  • 49
  • 62
14
votes
2 answers

How to gray out a menu item in Qt

I'm building a small program in Qt with menu bars (menuBar) using C++ and I would like to know how to gray out (eg. disable) an item of the menu when a certain variable is activated. Is it possible?
user1031431
  • 1,475
  • 6
  • 17
  • 24
14
votes
5 answers

qtextedit - resize to fit

I have a QTextEdit which act as "displayer" (editable to false). The text it displays is wordwrapped. Now I do wish to set the height of this textbox so that the text fits exactly (while also respecting a maximum height). Basically the widget (in…
paul23
  • 8,799
  • 12
  • 66
  • 149
14
votes
4 answers

Sending signal from static class method in Qt

I am trying to code a static callback function that is called frequently from another static function within the same class. My callback function needs to emit a signal but for some reason it simply fails to do so. I have put it under a debugger and…
user99545
  • 1,173
  • 3
  • 16
  • 32
14
votes
1 answer

QSqlQuery not positioned on a valid record

I'm trying select a field of my date base, the code is: if (db.db().isOpen()) { qDebug() << "OK"; QSqlQuery query("SELECT state FROM jobs WHERE jobId = '553'", db.db()); qDebug() << query.value(0).toString(); } else qDebug() << "No ok";…
Jjreina
  • 2,633
  • 6
  • 33
  • 54
1 2 3
99
100