Uploaded image for project: 'Qt Creator'
  1. Qt Creator
  2. QTCREATORBUG-9422

C++ types exposed by QmlDesigner::IWidgetPlugin are not listed in Library view in QML Designer

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Not Evaluated
    • None
    • Qt Creator 2.7.1
    • None

    Description

      Hello,

      I have created my own custom QML types library using QQmlExtensionPlugin.
      I have successfully imported it into my QML project. Everything works fine, I can edit my types in QML editor and run my project without any problems. My plugin contains both C++ types and one type defined in .qml file. My qmldir therefore looks like this:

      module VideoPlugin
      plugin VideoPlugin
      TestModule 1.0 test.qml

      Now I also created QML designer plugin using QmlDesigner::IWidgetPlugin. My .metainfo file looks like this:

      MetaInfo {
      
          Type {
              name: "VideoPlugin.VideoSurface"
              icon: ":/QFlow/images/player.png"
      
              ItemLibraryEntry {
                  name: "VideoSurface"
                  category: "Video Modules"
                  libraryIcon: ":/QFlow/images/player.png"
                  version: "1.0"
                  requiredImport: "VideoPlugin"
              }
          }
          Type {
              name: "VideoPlugin.Dilate"
              icon: ":/QFlow/images/player.png"
      
              ItemLibraryEntry {
                  name: "Dilate"
                  category: "Video Modules"
                  libraryIcon: ":/QFlow/images/player.png"
                  version: "1.0"
                  requiredImport: "VideoPlugin"
      
                  Property { name: "iterations"; type: "int"; value: "1"; }
              }
          }
          Type {
              name: "VideoPlugin.TestModule"
              icon: ":/QFlow/images/player.png"
      
              ItemLibraryEntry {
                  name: "TestModule"
                  category: "Video Modules"
                  libraryIcon: ":/QFlow/images/random.png"
                  version: "1.0"
                  requiredImport: "VideoPlugin"
                  Property { name: "test"; type: "int"; value: "1"; }
              }
          }
      }
      

      I have put plugin .so file into qtcreator/lib/qtcreator/qmldesigner.
      Designer successfully loads the plugin and calls metaInfo() method and retrives the metainfo.

      When I open the QML designer, I can see that there is a new library in Library window. However, the library contains ONLY THE TYPE DEFINED IN .QML FILE AND NOT MY C++ TYPES. The funny thing is that I can nicely edit my C++ types, edit properties, they work fine in Form Editor and also an icon is assigned to instances of those types. So the QML designer loads the plugin, gets metainfo, assigns icons but it doesn't list my C++ types in Library window.

      Am I missing something or is it a bug?
      I considered to create a bug report because I don't see any reason for this behavior.

      I also attached a screenshot where you can see QML editor where a pure qml type is listed in library, the C++ type is selected in Form editor, it has icon but is not listed in Library view.

      Cheers.

      Michal

      Attachments

        1. expected.png
          expected.png
          224 kB
        2. qmldesigner.png
          qmldesigner.png
          213 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            thohartm Thomas Hartmann
            mfojtak Michal Fojtak
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes