QmlDesigner Items Preview and interaction
-
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. -
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.
-
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.