Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-50435

QQmlFileSelector broken on Android with assets

    XMLWordPrintable

Details

    • Android
    • 5ef14c52d0275e721153b15acfb0410b9889014a

    Description

      We try to use another QML file on Android. But it looks like that the QFileSelector/QQmlFileSelector won't detect the correct +subdir.

      We tried QQmlApplicationEngine with default QFileSelector and a replaced selector and added extraSelectors like "+test". Both won't work as expected.

      The following example works from C++ code.
      But QML will display "assets://qml/provider/ProviderDetailView.qml" instead of the "+test" file.
      Same problem with default "+android" on Android!!

      	QFileSelector* sel = new QFileSelector();
      	sel->setExtraSelectors(QStringList() << "test");
      	qDebug() << sel->allSelectors();
      
      	mEngine.reset(new QQmlApplicationEngine());
      	auto selector = QQmlFileSelector::get(mEngine.data());
      	selector->setSelector(sel);
      
      	qDebug() << sel->select("assets://qml/provider/ProviderDetailView.qml");
      
       ....
      	mEngine->load(QUrl("assets://qml/main.qml"));
      

      assets:/qml/provider/+test/ProviderDetailView.qml

      Looks like this bug exists since at least two years:

      https://forum.qt.io/topic/39642/qqmlfileselector-not-working-on-android-from-assets-folder

      It works if we put every qml file into a qrc, compiles it to an rcc file and use "mEngine->load(QUrl("qrc:/qml/main.qml"));"

      Attachments

        For Gerrit Dashboard: QTBUG-50435
        # Subject Branch Project Status CR V

        Activity

          People

            taipan BogDan Vatra
            misery André Klitzing
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes