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. QmlDesigner Items Preview and interaction
Forum Updated to NodeBB v4.3 + New Features

QmlDesigner Items Preview and interaction

Scheduled Pinned Locked Moved Qt Creator and other tools
3 Posts 1 Posters 1.0k 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.
  • K Offline
    K Offline
    kostya111
    wrote on last edited by
    #1

    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
    0
    • K Offline
      K Offline
      kostya111
      wrote on last edited by
      #2

      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
      0
      • K Offline
        K Offline
        kostya111
        wrote on last edited by
        #3

        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
        0

        • Login

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