Details
-
Bug
-
Resolution: Fixed
-
P2: Important
-
6.5.1
-
None
Description
import QtQuick import QtQuick.Window Window { width: 640 height: 480 visible: true title: qsTr("Hello World") id: root Connections { target: root function onTitleChanged() {} } }
gives a build error:
/home/tim/build/build-qml_scratch2-clang_15-Debug/.qmltc/appqml_scratch2/main.cpp: In member function ‘void Main::QML_beginClass(QQmltcObjectCreationHelper*, bool)’: /home/tim/build/build-qml_scratch2-clang_15-Debug/.qmltc/appqml_scratch2/main.cpp:122:22: error: ‘virtual void QQmlConnections::classBegin()’ is private within this context 122 | child->classBegin(); | ~~~~~~~~~~~~~~~~~^~ In file included from /home/tim/build/build-qml_scratch2-clang_15-Debug/.qmltc/appqml_scratch2/main.h:24, from /home/tim/build/build-qml_scratch2-clang_15-Debug/.qmltc/appqml_scratch2/main.cpp:4: /home/tim/bin/qt-6.5-x/include/QtQml/6.5.1/QtQml/private/qqmlconnections_p.h:63:10: note: declared private here 63 | void classBegin() override; | ^~~~~~~~~~ /home/tim/build/build-qml_scratch2-clang_15-Debug/.qmltc/appqml_scratch2/main.cpp: In member function ‘void Main::QML_completeComponent(QQmltcObjectCreationHelper*, bool)’: /home/tim/build/build-qml_scratch2-clang_15-Debug/.qmltc/appqml_scratch2/main.cpp:141:29: error: ‘virtual void QQmlConnections::componentComplete()’ is private within this context 141 | child->componentComplete(); | ~~~~~~~~~~~~~~~~~~~~~~~~^~ In file included from /home/tim/build/build-qml_scratch2-clang_15-Debug/.qmltc/appqml_scratch2/main.h:24, from /home/tim/build/build-qml_scratch2-clang_15-Debug/.qmltc/appqml_scratch2/main.cpp:4: /home/tim/bin/qt-6.5-x/include/QtQml/6.5.1/QtQml/private/qqmlconnections_p.h:64:10: note: declared private here 64 | void componentComplete() override; | ^~~~~~~~~~~~~~~~~ ninja: build stopped: subcommand failed.
the culprit is this generated code:
auto child = creator->get<Main_Connections>(1); child->QML_beginClass(creator); static_assert(std::is_base_of<QQmlParserStatus, Main_Connections>::value); child->classBegin();
`QQmlConnections::classBegin()` is private, though it overrides a function in `QQmlParserStatus` which is public