[Interest] Using QtQuickControls 2 within a static build of Qt 5.7

Nuno Santos nunosantos at imaginando.pt
Wed Jul 27 16:26:26 CEST 2016


Hi,

I’m not being able to use QtQuickControls 2 in a static build of Qt. In order to register the QtQuick stuff within Qt 5.6 I had to manually link with the plugin lib and initialise the plugins manually. I think this was because of a bug: https://bugreports.qt.io/browse/QTBUG-35754 <https://bugreports.qt.io/browse/QTBUG-35754>

Apparently the bug was fixed and I should be able to use normally however there are no instructions for that so I’m using same registering process I had for QtQuickControls with some nuances and now I have this:

Q_IMPORT_PLUGIN(QtQuickControls1Plugin)
Q_IMPORT_PLUGIN(QtQuickControls2Plugin)

…

qobject_cast<QQmlExtensionPlugin*>(qt_static_plugin_QtQuickControls1Plugin().instance())->registerTypes("QtQuick.Controls");
qobject_cast<QQmlExtensionPlugin*>(qt_static_plugin_QtQuickControls1Plugin().instance())->registerTypes("QtQuick.Controls.Styles");
qobject_cast<QQmlExtensionPlugin*>(qt_static_plugin_QtQuickControls1Plugin().instance())->registerTypes("QtQuick.Controls.Private");
qobject_cast<QQmlExtensionPlugin*>(qt_static_plugin_QtQuickControls2Plugin().instance())->registerTypes("QtQuick.Controls”);

However, it complains about not knowing nothing about, e.g. Slider. It also gives an error: qmlRegisterType requires absolute URLs. I have digged the source down and the qmlRegisterType functions has the following validation:

if (url.isRelative()) {
	// User input check must go here, because QQmlPrivate::qmlregister is also used internally for composite types
	qWarning("qmlRegisterType requires absolute URLs.");
	return 0;
}

So I supposed the types end up not being registered anyway. By the time the plugin is registered, the following url is being passed to the first registration: "qrc/ApplicationWindow.qml”

What am I missing here?

Thx!

Nuno
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20160727/ae7c5c66/attachment.html>


More information about the Interest mailing list