PDA

View Full Version : bool QTabWidget::hasHeightForWidth() const’ marked override, but does not override



Ginsengelf
24th January 2017, 16:47
Hi, I get this error during compilation:


In file included from /usr/include/qt5/QtWidgets/qstyleoption.h:44:0,
from /usr/include/qt5/QtWidgets/qabstractitemdelegate.h:38,
from /usr/include/qt5/QtWidgets/qabstractitemview.h:40,
from /usr/include/qt5/QtWidgets/qheaderview.h:37,
from /usr/include/qt5/QtWidgets/QHeaderView:1,
from obj/ui/ui_mydialog.h:19
(...)
/usr/include/qt5/QtWidgets/qtabwidget.h:120:10: error: ‘bool QTabWidget::hasHeightForWidth() const’ marked override, but does not override
bool hasHeightForWidth() const Q_DECL_OVERRIDE;

qtabwidget.h is included by a file generated from an .ui file
I'm using Qt 5.6.1 with g++ 4.8.5 on Linux (openSUSE 42.1)

How can I get rid of this?

Ginsengelf

anda_skoa
25th January 2017, 10:59
This is strange.


bool QWidget::hasHeightForWidth() const

is virtual, that QTabWidget method does override.

Do you enable C++11 in your .pro file?

Cheers,
_

Ginsengelf
25th January 2017, 14:36
Hi, I'm on Windows now, but I remember seeing something like "-std=c++0x" or similar, so that would mean "yes, C++11".

I'll check if it is enabled in the .pro file, or if I can specifically disable it.

Ginsengelf

anda_skoa
26th January 2017, 13:24
Usually that needs to be enabled with "CONFIG += cpp11" or something similar.

Maybe the compiler is too old to get the override right.

Cheers,
_

britsfp
28th August 2018, 11:19
Usually that needs to be enabled with "CONFIG += cpp11" or something similar.

Maybe the compiler is too old to get the override right.

Cheers,
_

I had the same thing and after including :

<QtCore>
<QtGui>

everything was working again.

Regards
Frik Brits.