Qt dev branch: "invalid covariant return type" for QEvent

Phil Thompson phil at riverbankcomputing.com
Wed May 25 17:06:16 BST 2022


On 24/05/2022 19:34, Florian Bruhin wrote:
> Hi,
> 
> When trying to build the current dev branch of Qt 6 against the
> currently released PyQt:
> 
>     PyQt-builder 1.12.2
>     PyQt6-sip 13.3.1
>     PyQt6 6.3.0
> 
> I get:
> 
>     /tmp/tmplprdnj33/QtGui/sipQtGuiQCloseEvent.cpp:47:16: error:
> invalid covariant return type for ‘virtual QEvent*
> sipQCloseEvent::clone() const’
>        47 |      ::QEvent* clone() const SIP_OVERRIDE;
>           |                ^~~~~
>     In file included from
> ../../../home/florian/proj/qt/dev6/build/qtbase/include/QtCore/qcoreevent.h:1,
>                      from
> ../../../home/florian/proj/qt/dev6/build/qtbase/include/QtGui/../../../../qt5/qtbase/src/gui/kernel/qevent.h:9,
>                      from
> ../../../home/florian/proj/qt/dev6/build/qtbase/include/QtGui/qevent.h:1,
>                      from
> /home/florian/proj/qt/dev6/pyqt/PyQt6-6.3.0/sip/QtGui/qevent.sip:290:
> 
> ../../../home/florian/proj/qt/dev6/build/qtbase/include/QtCore/../../../../qt5/qtbase/src/corelib/kernel/qcoreevent.h:27:16:
> note: overridden function is ‘virtual QCloseEvent*
> QCloseEvent::clone() const’
>        27 |         Class* clone() const override; \
>           |                ^~~~~
> 
> ../../../home/florian/proj/qt/dev6/build/qtbase/include/QtGui/../../../../qt5/qtbase/src/gui/kernel/qevent.h:554:5:
> note: in expansion of macro ‘Q_DECL_EVENT_COMMON’
>       554 |     Q_DECL_EVENT_COMMON(QCloseEvent)
>           |     ^~~~~~~~~~~~~~~~~~~
>     make[1]: *** [Makefile:43949: sipQtGuiQCloseEvent.o] Error 1
> 
> With similar errors for other clone() implementations too:
> https://paste.the-compiler.org/view/6c24584a
> 
> Is that an issue in sip/PyQt? A backwards-incompatible change in Qt?
> Something else entirely?

It's an addition to the Qt API that PyQt isn't aware of but needs to be.

Phil


More information about the PyQt mailing list