Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Update: Forum Guidelines & Code of Conduct


    Qt World Summit: Early-Bird Tickets

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

    Tools
    5
    12
    11255
    Loading More Posts
    • 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
      feldifux last edited by

      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 Reply Quote 0
      • T
        tobias.hunger last edited by

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

        1 Reply Last reply Reply Quote 0
        • F
          feldifux last edited by

          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 Reply Quote 0
          • T
            tobias.hunger last edited by

            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 Reply Quote 0
            • F
              feldifux last edited by

              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 Reply Quote 0
              • L
                Leonard777 last edited by

                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 Reply Quote 0
                • F
                  feldifux last edited by

                  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 Reply Quote 0
                  • S
                    sfabry last edited by

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

                    1 Reply Last reply Reply Quote 1
                    • F
                      feldifux last edited by

                      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 Reply Quote 0
                      • S
                        sfabry last edited by

                        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 Reply Quote 1
                        • F
                          feldifux last edited by

                          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 Reply Quote 0
                          • S
                            Sarat last edited by

                            @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 Reply Quote 0
                            • First post
                              Last post