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
_______________________________________________
Development mailing list
[email protected]
https://lists.qt-project.org/listinfo/development

Reply via email to