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

Issue setting the source of a QQuickWidget (created in a plugin) to a qml resource file

    XMLWordPrintable

Details

    • Bug
    • Resolution: Invalid
    • Not Evaluated
    • None
    • 5.14.0
    • Quick: Widget
    • None
    • Manjaro Archlinux 64bit
    • Linux/X11

    Description

      Using the example project in the attachments, I have an error when setting the source of a QQuickWidget, created in a plugin and displayed in the main application, to a qml resource file.

      Indeed:

      // no qml displayed
      // error written in console:
      // "file:///path/to/QMLfromPlugin/: file to open is a directory"
      widget->setSource(QUrl(":/qml/MyQmlFile.qml"));
      
      // works just fine
      widget->setSource(QUrl(QDir(QCoreApplication::applicationDirPath()).path() + "/qmlplugin/qml/MyQmlFile.qml"));
      
      // works just fine as well
      QString qrcPath(":/qml/MyQmlFile.qml");
      QFile file(qrcPath);
      qDebug() << qrcPath << "open" << file.open(QIODevice::ReadOnly);
      qDebug() << qrcPath << "error" << file.errorString();
      

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            tvete Paul Olav Tvete
            xavi-b xavi-b
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes