[Development] QML preprocessor
Alberto Mardegan
mardy at users.sourceforge.net
Mon Mar 18 20:52:17 CET 2019
On 18/03/19 12:11, Pierre-Yves Siret wrote:
> This can be done with QQmlFileSelector :
>
> QQmlApplicationEngine engine;
> QQmlFileSelector* qmlFileSelector = QQmlFileSelector::get(&engine);
>
> #if QT_VERSION >= QT_VERSION_CHECK(5, 12, 0)
> qmlFileSelector->setExtraSelectors({"5.12"});
> #endif
>
> engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
>
> This will load qrc:/+5.12/main.qml (if there's one) instead of
> qrc:/main.qml when the Qt version is >= 5.12.
Of all suggestions, this is probably the one having the least
performance impact and greater readability. It still doesn't solve the
code duplication issue (Samuel's does, but with a greater runtime
impact), though. :-(
Anyway, thanks all!
(I'm still looking forward to see this issue addressed at the QML
language level, though :-) )
Ciao,
Alberto
--
http://www.mardy.it - Geek in un lingua international
More information about the Development
mailing list