Qt Forum

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

    QmlDesigner Items Preview and interaction

    Tools
    1
    3
    829
    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.
    • K
      kostya111 last edited by

      First of all. How can I force QmlDesigner to show preview of my own qml elements just like standart QtQuick elements?
      Secondly. I have element that displays an image. How can I force QmlDesigner automatically set size of my element to size of image when I set property value.

      1 Reply Last reply Reply Quote 0
      • K
        kostya111 last edited by

        I figured out why my elements isn't showed by QmlDesigner. QmlDesigner uses qmlpuppet for render elements. To render an element, the element must be found by QDeclarativeMetaType::qmlType() method. But my elements are not found. My elements are registred by qmlRegisterType() function in QDeclarativeExtensionPlugin's inherited class. Plugin is installed in Qt's imports directory.
        I can recompile qmlpuppet. But I don't know how to say qmlpuppet that my types are located in plugin. I thought, that plugin must be automatically loaded.
        How can I say qmlpuppet that my types are located in plugin?

        ThomasHartmann please answer. I know you are the all-knowing Oracle of QtQuick.

        1 Reply Last reply Reply Quote 0
        • K
          kostya111 last edited by

          I discovered why qmlpuppet don't see my elements. It seems, the bug of qmlpuppet. I have qtcreator 2.5.2, so maybe the bug has already fixed. The thing is ObjectNodeInstance::createPrimitive() method get in its argument typeName with dots replaced by slashes. For example I register my type with following code:
          @
          class ItemsPlugin : public QDeclarativeExtensionPlugin
          {
          Q_OBJECT
          public:
          void registerTypes(const char uri)
          {
          Q_ASSERT(uri == QLatin1String("my.qmlcomponents"));
          qmlRegisterType<AbstractIndicator>(uri, 1, 0, "Indicator");
          /
          ...*/
          @
          So uri of my element is "my.qmlcomponents/Indicator". But, ObjectNodeInstance::createPrimitive() method accept it as "my/qmlcomponents/Indicator", therefore qmlpuppet can't find it.

          1 Reply Last reply Reply Quote 0
          • First post
            Last post