Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. QML / Cpp plugin
Forum Updated to NodeBB v4.3 + New Features

QML / Cpp plugin

Scheduled Pinned Locked Moved QML and Qt Quick
11 Posts 4 Posters 7.7k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • U Offline
    U Offline
    utcenter
    wrote on last edited by
    #2

    Does it work?

    1 Reply Last reply
    0
    • W Offline
      W Offline
      Wroman
      wrote on last edited by
      #3

      Nope, it asks :

      module "com.mycompany.qmlcomponents" is not installed : import com.mycompany.qmlcomponents 1.0;

      That's why i'm wondering... How to install it ?

      Trust me, i'm an engineer !

      1 Reply Last reply
      0
      • T Offline
        T Offline
        Torgeir
        wrote on last edited by
        #4

        You may need to set the QML2_IMPORT_PATH environment variable to point to where the plugin is.

        Or you can add the path using @view.engine()->addImportPath("/my/path/to/plugin");@

        where view is a QQuickView

        1 Reply Last reply
        0
        • W Offline
          W Offline
          Wroman
          wrote on last edited by
          #5

          Thanks for replying.

          I actually already tested to add import path to my view engine :

          @ m_view->engine()->addImportPath(QLatin1String("file:///C:/HMI/qmlcomponents/test_plugin/release"));
          qDebug() << m_view->engine()->importPathList();@

          and the dump of the import path list is ok, there is the path to where the qmldir / plugins.qmltypes / dll file are.

          Unfortunately, nothing changed...

          Trust me, i'm an engineer !

          1 Reply Last reply
          0
          • C Offline
            C Offline
            chrisadams
            wrote on last edited by
            #6

            The "no code in the docs" is a bug in the docs - code snippets aren't being generated by qdoc correctly, and I don't know why. I've asked Jerome about it on IRC and he said he'd look into it.

            Regarding your module:
            http://doc-snapshot.qt-project.org/qt5-stable/qtqml/qtqml-modules-identifiedmodules.html explains that you must install to QML2_IMPORT_PATH for QML2/QtQuick2 plugins (where you seem to use QT_INSTALL_IMPORTS in your project) - by default I think this is /usr/lib/qt5/qml on Linux, so your particular module would be installed to /usr/lib/qt5/qml/com/mycompany/components on Linux. You're on Windows, I see, but I don't know what the default import path for QML2 modules is on that platform.

            If addImportPath() isn't working as specified, that's a bug - please file a bug report and assign it to Alan Alpert. There are unit tests for that functionality, however, so either you've got a strange environment, or something strange is going on.

            See http://doc-snapshot.qt-project.org/qt5-stable/qtdoc/qtquick-debugging.html#debugging-module-imports for more information about debugging imports. QML_IMPORT_TRACE=1 ./myapp should tell you a bit more about what's going on.

            Cheers,
            Chris.

            1 Reply Last reply
            0
            • W Offline
              W Offline
              Wroman
              wrote on last edited by
              #7

              Ok.

              Basically, what is working is copy/paste the plugin (ie. the dynamic lib, the plugins.qmltypes and the qmldir) into the Windows default qml directory... So the normal behaviour of the

              (Which is fyi : C:/Qt/Qt5.0.2/5.0.2/qml)

              QT_INSTALL_IMPORT seems to be used only with the "unix" tag on the project file. As i'm not compiling for Unix, the "QML_IMPORT_PATH" should add to the import path the correct place.

              The addImportPath() add the correct path to the Import path but... it still prompts me that my plugin is "not installed".

              How do you make a bug report ?

              Trust me, i'm an engineer !

              1 Reply Last reply
              0
              • C Offline
                C Offline
                chrisadams
                wrote on last edited by
                #8

                Not QML_IMPORT_PATH. QML2_IMPORT_PATH. When the version was bumped, the import path env var changed.

                But you're right, the addImportPath() should also add the path.
                Make a bug report on bugreports.qt-project.org

                Cheers,
                Chris.

                1 Reply Last reply
                0
                • W Offline
                  W Offline
                  Wroman
                  wrote on last edited by
                  #9

                  Hey, thanks for your reply.

                  I've actually "QML_IMPORT_PATH" in my project file 'cause QML2_IMPORT_PATH doesn't seems to exists. With QML_IMPORT_PATH, qtcreator seems to see my lib (but still it prompts that it's not installed) and with QML2_IMPORT_PATH, it doesn't seems to see my lib (Warning on the qml file, import fail).

                  I'm writing a bug report.

                  Trust me, i'm an engineer !

                  1 Reply Last reply
                  0
                  • C Offline
                    C Offline
                    chrisadams
                    wrote on last edited by
                    #10

                    QML_IMPORT_PATH might be what QtCreator uses to determine typenames and so forth, I don't know. But the QML engine uses QML2_IMPORT_PATH when it resolves plugins at runtime.

                    1 Reply Last reply
                    0
                    • W Offline
                      W Offline
                      Wroman
                      wrote on last edited by
                      #11

                      Ok, fine.

                      Thanks a lot !

                      Trust me, i'm an engineer !

                      1 Reply Last reply
                      0

                      • Login

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • Users
                      • Groups
                      • Search
                      • Get Qt Extensions
                      • Unsolved