[Interest] Qt6: QShared<const TYPE> is not supported in signals if TYPE is an QObject?

Alexander Dyagilev alervdvcw at gmail.com
Wed May 25 01:02:15 CEST 2022


Hello,

On 5/20/2022 6:45 PM, Thiago Macieira wrote:
> Please share the error message.

01:58:24: Running steps for project untitled...
01:58:24: Configuration unchanged, skipping qmake step.
01:58:24: Starting: "D:\Qt\Tools\mingw1120_64\bin\mingw32-make.exe" -j16
D:/Qt/Tools/mingw1120_64/bin/mingw32-make -f Makefile.Debug
mingw32-make[1]: Entering directory 'C:/Users/alexa/Documents/Qt 
Creator/build-untitled-Desktop_Qt_6_2_4_MinGW_64_bit-Debug'
g++ -c -fno-keep-inline-dllexport -g -std=gnu++1z -Wall -Wextra -Wextra 
-fexceptions -mthreads -DUNICODE -D_UNICODE -DWIN32 
-DMINGW_HAS_SECURE_API=1 -DQT_QML_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB 
-DQT_CORE_LIB -DQT_NEEDS_QMAIN -I../untitled -I. 
-ID:/Qt/6.2.4/mingw_64/include -ID:/Qt/6.2.4/mingw_64/include/QtWidgets 
-ID:/Qt/6.2.4/mingw_64/include/QtGui 
-ID:/Qt/6.2.4/mingw_64/include/QtCore -Idebug -I. -I/include 
-ID:/Qt/6.2.4/mingw_64/mkspecs/win32-g++  -o debug\moc_a.o debug\moc_a.cpp
In file included from D:/Qt/6.2.4/mingw_64/include/QtCore/qobject.h:54,
                  from D:/Qt/6.2.4/mingw_64/include/QtCore/QObject:1,
                  from debug\../../untitled/a.h:3,
                  from debug\moc_a.cpp:10:
D:/Qt/6.2.4/mingw_64/include/QtCore/qmetatype.h: In instantiation of 
'QObject* 
QtPrivate::QSmartPointerConvertFunctor<SmartPointer>::operator()(const 
SmartPointer&) const [with SmartPointer = QSharedPointer<const B>]':
D:/Qt/6.2.4/mingw_64/include/QtCore/qmetatype.h:613:26:   required from 
'static bool QMetaType::registerConverter(UnaryFunction) [with From = 
QSharedPointer<const B>; To = QObject*; UnaryFunction = 
QtPrivate::QSmartPointerConvertFunctor<QSharedPointer<const B> >]'
D:/Qt/6.2.4/mingw_64/include/QtCore/qmetatype.h:1579:1:   required from 
'static bool QtPrivate::MetaTypeSmartPointerHelper<QSharedPointer<T>, 
typename 
std::enable_if<QtPrivate::IsPointerToTypeDerivedFromQObject<T*>::Value>::type>::registerConverter() 
[with T = const B]'
D:/Qt/6.2.4/mingw_64/include/QtCore/qmetatype.h:1233:64: required from 
'int qRegisterNormalizedMetaType(const QByteArray&) [with T = 
QSharedPointer<const B>]'
D:/Qt/6.2.4/mingw_64/include/QtCore/qmetatype.h:1579:1:   required from 
'static int QtPrivate::SharedPointerMetaTypeIdHelper<QSharedPointer<T>, 
true>::qt_metatype_id() [with T = const B]'
D:/Qt/6.2.4/mingw_64/include/QtCore/qmetatype.h:1133:89: required from 
'static constexpr int QMetaTypeId2<T>::qt_metatype_id() [with T = 
QSharedPointer<const B>]'
D:/Qt/6.2.4/mingw_64/include/QtCore/qmetatype.h:2293:27: required from 
'static constexpr void (* 
QtPrivate::QMetaTypeForType<S>::getLegacyRegister())() [with S = 
QSharedPointer<const B>; QtPrivate::QMetaTypeInterface::LegacyRegisterOp 
= void (*)()]'
D:/Qt/6.2.4/mingw_64/include/QtCore/qmetatype.h:2329:70: required from 
'constexpr const QtPrivate::QMetaTypeInterface 
QtPrivate::QMetaTypeInterfaceWrapper<QSharedPointer<const B> >::metaType'
D:/Qt/6.2.4/mingw_64/include/QtCore/qmetatype.h:2439:16: required from 
'constexpr const QtPrivate::QMetaTypeInterface* 
QtPrivate::qTryMetaTypeInterfaceForType() [with Unique = 
qt_meta_stringdata_A_t; TypeCompletePair = 
QtPrivate::TypeAndForceComplete<QSharedPointer<const B>, 
std::integral_constant<bool, false> >]'
D:/Qt/6.2.4/mingw_64/include/QtCore/qmetatype.h:2483:55: required from 
'constexpr const QtPrivate::QMetaTypeInterface* const 
qt_incomplete_metaTypeArray [5]<qt_meta_stringdata_A_t, 
QtPrivate::TypeAndForceComplete<A, std::integral_constant<bool, true> >, 
QtPrivate::TypeAndForceComplete<void, std::integral_constant<bool, 
false> >, QtPrivate::TypeAndForceComplete<const QSharedPointer<const 
C>&, std::integral_constant<bool, false> >, 
QtPrivate::TypeAndForceComplete<void, std::integral_constant<bool, 
false> >, QtPrivate::TypeAndForceComplete<QSharedPointer<const B>, 
std::integral_constant<bool, false> > >'
debug\moc_a.cpp:106:1:   required from here
D:/Qt/6.2.4/mingw_64/include/QtCore/qmetatype.h:1196:32: error: invalid 
conversion from 'const QObject*' to 'QObject*' [-fpermissive]
  1196 |             return p.operator->();
       |                    ~~~~~~~~~~~~^~
       |                                |
       |                                const QObject*
mingw32-make[1]: Leaving directory 'C:/Users/alexa/Documents/Qt 
Creator/build-untitled-Desktop_Qt_6_2_4_MinGW_64_bit-Debug'
mingw32-make[1]: *** [Makefile.Debug:913: debug/moc_a.o] Error 1
mingw32-make: *** [Makefile:45: debug] Error 2
01:58:26: The process "D:\Qt\Tools\mingw1120_64\bin\mingw32-make.exe" 
exited with code 2.
Error while building/deploying project untitled (kit: Desktop Qt 6.2.4 
MinGW 64-bit)
When executing step "Make"
01:58:26: Elapsed time: 00:02.

> And please use an email client that knows how to paste spaces. Your code is
> unreadable:

Hmm... Is Mozilla Thunderbird really that bad? What email client would 
you recommend to use instead?




More information about the Interest mailing list