#include <QtWidgets> does not work in Qt 4

The developer added a function to our software using QtWidgets, which, as far as I can tell, is a QT5 function. The problem is that our software is still designed for QT4, and we still cannot upgrade to the latest version of QT. The new function works fine when compiling in QT5, but when trying to compile using QT 4.8.5, the following error occurs.

src\qt\snapwidget.h:3: error: QtWidgets: No such file or directory
#include <QtWidgets>
                   ^

Is there any documentation on migrating QtWidgets back to an older version of QT? Perhaps someone was preparing something like widgets before it appeared as a native function.

+4
source share
1 answer

Qt 5. Qt .


, . , .

#include <QClass>

.pro, ( ).


, QtWidgets Qt 4. Qt 4 "gui".

, "" Qt 4

#include <QtGui>

QT_VERSION, ++ Qt 4, 5:

#include <QtGlobal>
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
#  include <QtWidgets>
#else
#  include <QtGui>
#endif

.pro widgets. Qt 4, Qt 5 core gui, , , Qt 5:

greaterThan(QT_MAJOR_VERSION, 4):QT += widgets
+13

Source: https://habr.com/ru/post/1542827/


All Articles