Skip to content

Fix build error: invalid user-defined conversion from ‘QByteArray’ to ‘const char*’

Méven Car requested to merge meven/kdeconnect-kde:fix-build-ci into master
/builds/network/kdeconnect-kde/core/networkpacket.cpp: In instantiation of ‘void qvariant2qobject(const QVariantMap&, T*) [with T = NetworkPacket; QVariantMap = QMap<QString, QVariant>]’:
/builds/network/kdeconnect-kde/core/networkpacket.cpp:118:21:   required from here
/builds/network/kdeconnect-kde/core/networkpacket.cpp:93:70: error: invalid user-defined conversion from ‘QByteArray’ to ‘const char*’ [-fpermissive]
   93 |         const int propertyIndex = T::staticMetaObject.indexOfProperty(iter.key().toLatin1());
      |                                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/qt5/QtCore/qstring.h:50,
                 from /usr/include/qt5/QtCore/qobject.h:47,
                 from /usr/include/qt5/QtCore/QObject:1,
                 from /builds/network/kdeconnect-kde/core/networkpacket.h:12,
                 from /builds/network/kdeconnect-kde/core/networkpacket.cpp:7:
/usr/include/qt5/QtCore/qbytearray.h:469:5: note: candidate is: ‘QByteArray::operator QNoImplicitBoolCast() const’ (near match)
  469 |     operator QNoImplicitBoolCast() const;
      |     ^~~~~~~~
/usr/include/qt5/QtCore/qbytearray.h:469:5: note:   no known conversion from ‘QNoImplicitBoolCast’ {aka ‘int’} to ‘const char*’
/builds/network/kdeconnect-kde/core/networkpacket.cpp:93:70: error: ‘QByteArray::operator QNoImplicitBoolCast() const’ is private within this context
   93 |         const int propertyIndex = T::staticMetaObject.indexOfProperty(iter.key().toLatin1());
      |                                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/qt5/QtCore/qstring.h:50,
                 from /usr/include/qt5/QtCore/qobject.h:47,
                 from /usr/include/qt5/QtCore/QObject:1,
                 from /builds/network/kdeconnect-kde/core/networkpacket.h:12,
                 from /builds/network/kdeconnect-kde/core/networkpacket.cpp:7:
/usr/include/qt5/QtCore/qbytearray.h:469:5: note: declared private here
  469 |     operator QNoImplicitBoolCast() const;
      |     ^~~~~~~~

To fix this CI build issue.

NO_CHANGELOG

Edited by Méven Car

Merge request reports

Loading