Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. Generate a qmltypes file from QML components and not C++ like qmlplugindump
QtWS25 Last Chance

Generate a qmltypes file from QML components and not C++ like qmlplugindump

Scheduled Pinned Locked Moved Qt Creator and other tools
12 Posts 5 Posters 12.2k Views
  • 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.
  • F Offline
    F Offline
    feldifux
    wrote on last edited by
    #1

    Hi,
    I have the following use-case:

    QtCreator allows auto-completion of C++ items from plugins, if a .qmltypes file was created for it with the qmlplugindump tool. However, what to do if I have components written in QML which I would like to distribute as a plugin?

    I tried calling the qmlplugindump tool for the qml components as described in http://qt-project.org/doc/qt-4.8/qdeclarativemodules.html#writing-a-qmltypes-file, but an empty qmltypes file is the result. So it seems qmlplugindump is only applicable for C++ items. Are there other tools to generate a qmltypes file from QML files, or how could I generate the file so my components are usable from QtCreator?

    Cheers,
    Chris

    Founder of Felgo SDK - http://felgo.com/qt

    Felgo simplifies

    • Mobile App Dev with Qt esp. iOS & Android
    • Game Development with Qt

    What others say

    Felgo scored #1 in Cross-Platform App Development Tools Report - see why: https://goo.gl/rgp3rq

    1 Reply Last reply
    0
    • T Offline
      T Offline
      tobias.hunger
      wrote on last edited by
      #2

      IIRC creator will just parse .qml files that the user imports. No dumping should be necessary.

      1 Reply Last reply
      0
      • F Offline
        F Offline
        feldifux
        wrote on last edited by
        #3

        Hi Tobias,

        QtCreator can resolve the component definition when the qml sources are available that's right - however, I would like to distribute the plugin without the source code of the qml files. Thus I would like to generate qmltypes files from the qml sources.

        Thanks,
        Chris

        Founder of Felgo SDK - http://felgo.com/qt

        Felgo simplifies

        • Mobile App Dev with Qt esp. iOS & Android
        • Game Development with Qt

        What others say

        Felgo scored #1 in Cross-Platform App Development Tools Report - see why: https://goo.gl/rgp3rq

        1 Reply Last reply
        0
        • T Offline
          T Offline
          tobias.hunger
          wrote on last edited by
          #4

          I am not really good with QML, sorry, but I would be surprised if that is possible.

          The QML files are evaluated at runtime to do whatever they do. If you remove those files, then the functionality is gone.

          1 Reply Last reply
          0
          • F Offline
            F Offline
            feldifux
            wrote on last edited by
            #5

            So there is no way to publish a closed-source library that contains elements written in QML with support for qmltypes?

            Founder of Felgo SDK - http://felgo.com/qt

            Felgo simplifies

            • Mobile App Dev with Qt esp. iOS & Android
            • Game Development with Qt

            What others say

            Felgo scored #1 in Cross-Platform App Development Tools Report - see why: https://goo.gl/rgp3rq

            1 Reply Last reply
            0
            • L Offline
              L Offline
              Leonard777
              wrote on last edited by
              #6

              Any more word on this? The documentation indicates that it should work with just QML files, but it doesn't seem to be working for me either.

              1 Reply Last reply
              0
              • F Offline
                F Offline
                feldifux
                wrote on last edited by
                #7

                No I couldn't find any way to extract qmltype information from QML components :(

                If you discover a way how to do this, please share it here.

                Founder of Felgo SDK - http://felgo.com/qt

                Felgo simplifies

                • Mobile App Dev with Qt esp. iOS & Android
                • Game Development with Qt

                What others say

                Felgo scored #1 in Cross-Platform App Development Tools Report - see why: https://goo.gl/rgp3rq

                1 Reply Last reply
                0
                • S Offline
                  S Offline
                  sfabry
                  wrote on last edited by
                  #8

                  One year later :p
                  But have the solution
                  @qmlplugindump -nonrelocatable My.Module 1.0 > plugins.qmltypes@

                  1 Reply Last reply
                  1
                  • F Offline
                    F Offline
                    feldifux
                    wrote on last edited by
                    #9

                    Does this also work for qml files in the plugin? I guess you would need to define the plugin then with the qmldir file, or are there any other requirements?

                    Founder of Felgo SDK - http://felgo.com/qt

                    Felgo simplifies

                    • Mobile App Dev with Qt esp. iOS & Android
                    • Game Development with Qt

                    What others say

                    Felgo scored #1 in Cross-Platform App Development Tools Report - see why: https://goo.gl/rgp3rq

                    1 Reply Last reply
                    0
                    • S Offline
                      S Offline
                      sfabry
                      wrote on last edited by
                      #10

                      Yes I only have qml files in my qml plugin.
                      I'm not sure how it works, but I build a qml plugin with only qml files (styled controls) and deployed that plugin in the Qt5.3 install tree.
                      Then this command dropped me the correct plugins.qmltypes to enable color completion in qtcreator.

                      Have a look at qtquick.controls module sources, in their qmltypes files i noted the command that generated the file.

                      1 Reply Last reply
                      1
                      • F Offline
                        F Offline
                        feldifux
                        wrote on last edited by
                        #11

                        Nice, thanks!
                        I'll try to do that and then mark this thread as solved.

                        Founder of Felgo SDK - http://felgo.com/qt

                        Felgo simplifies

                        • Mobile App Dev with Qt esp. iOS & Android
                        • Game Development with Qt

                        What others say

                        Felgo scored #1 in Cross-Platform App Development Tools Report - see why: https://goo.gl/rgp3rq

                        1 Reply Last reply
                        0
                        • S Offline
                          S Offline
                          Sarat
                          wrote on last edited by
                          #12

                          @feldifux : I know its been pretty late xD but did you find any solution as I am facing currently the same problem? I tried everything possible but somehow just have an empty qmltypes generated by the qmlplugindump.

                          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