Solved qt5 compile problem with QTabWidget::hasHeightForWidth()
-
g++ -c -pipe -O2 -Wall -std=c++11 -W -D_REENTRANT -fPIC -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -I. -I. -isystem /usr/include/qt5 -isystem /usr/include/qt5/QtWidgets -isystem /usr/include/qt5/QtGui -isystem /usr/include/qt5/QtCore -I. -isystem /usr/include/libdrm -I/usr/lib64/qt5/mkspecs/linux-g++ -o GitStatusDialog.o GitStatusDialog.cpp
In file included from /usr/include/qt5/QtWidgets/qstyleoption.h:59,
from /usr/include/qt5/QtWidgets/qabstractitemdelegate.h:45,
from /usr/include/qt5/QtWidgets/qabstractitemview.h:47,
from /usr/include/qt5/QtWidgets/qlistview.h:44,
from /usr/include/qt5/QtWidgets/qlistwidget.h:44,
from /usr/include/qt5/QtWidgets/QListWidget:1,
from ui_GitStatusDialog.h:19,
from GitStatusDialog.h:8,
from GitStatusDialog.cpp:9:
/usr/include/qt5/QtWidgets/qtabwidget.h:126:10: error: ‘bool QTabWidget::hasHeightForWidth() const’ marked ‘override’, but does not override
126 | bool hasHeightForWidth() const override;
| ^~~~~~~~~~~~~~~~~
make: *** [Makefile:713: GitStatusDialog.o] Error 1I've defined -std=c++11 but it doesn't make a difference. If I include <QtGui/QListWidget> instead of <QtWidgets/QListWidget in ui_GitStatusDialog.h it compiles but gives me linker errors for everything in moc_GitStatusDialog.cpp.
I've also tried including <QtCore> and <QtGui> in ui_GitStatusDialog.h but nothing helps.
Thank you. -
Are you customising the QTableWidget ?
-
@jschwartzman said in qt5 compile problem with QTabWidget::hasHeightForWidth():
-std=c++11
Add CONFIG += c++11 to your config file and do a complete rebuild.
But it doesn't look like that's the issue.
What is the version of the compiler and Qt you're using? -
@jschwartzman said in qt5 compile problem with QTabWidget::hasHeightForWidth():
QtGui/QListWidget
This can't work since it's a Qt4 include. I would guess you're mixing Qt4 and Qt5 includes in your code.
-
Got it.
needed to change CONFIG += cpp11 to CONFIG += c++11 in .pro file
needed to add -isystem /usr/include/qt5/QtWidgets to INCPATH in Makefile
needed to add /usr/lib64/libQt5Widgets.so to LIBS in Makefile
needed to add -DQT_NO_PRINTER to DEFINES in Makefile
needed to add #include <QtCore/QObject to GitStatusDialog.hAm I missing some necessary changes to .pro file?
Only remaining problems are the following messsages:
QMetaObject::connectSlotsByName: No matching signal for on_listWidget_selectionChanged()
QMetaObject::connectSlotsByName: No matching signal for on_closeButton_clicked()
QMetaObject::connectSlotsByName: No matching signal for on_refreshButton_clicked()Thanks!
-
@jschwartzman said in qt5 compile problem with QTabWidget::hasHeightForWidth():
QMetaObject::connectSlotsByName: No matching signal for
Hi
Those are warning that the auto connect feature did not find a match.
The best solution is not to rely on the auto connect feature but use
explicit connects instead.This warning happens if you rename any of the widgets in the UI file after you use
the auto connect feature as the code is not automatically refactored.
(auto connect feature is QMetaObject::connectSlotsByName )Rename the slots ( its triggers on the form on_widgetname_signalname) then connect explicitly
https://stackoverflow.com/questions/24355023/qmetaobjectconnectslotsbyname-no-matching-signal
-
@jschwartzman said in qt5 compile problem with QTabWidget::hasHeightForWidth():
needed to add -isystem /usr/include/qt5/QtWidgets to INCPATH in Makefile
needed to add /usr/lib64/libQt5Widgets.so to LIBS in Makefile
needed to add -DQT_NO_PRINTER to DEFINES in MakefileThis is not needed when you properly add the needed modules (widgets, printsupport) in the pro file. See https://doc.qt.io/qt-5/qtwidgets-index.html