[Qt-creator] How do I implement and register QmlDesigner::IWidgetPlugins?
Thomas Hartmann
Thomas.Hartmann at qt.io
Wed Nov 29 13:10:51 CET 2017
Hi,
if you just want to add QML types to the item library then you do not need to implement a plugin.
The plugin interface is there if you want to add custom (C++) code to the designer that enables more specific features.
This means you do not need a plugin to provide a .metainfo file.
You can populate the item library using a .metainfo file in the "designer" subdirectory of your QML plugin.
This is also the place to implement custom property editor sheets.
The best example how to integrate your QML types is the QtQuick Controls 2 plugin (http://code.qt.io/cgit/qt/qtquickcontrols2.git/tree/src/imports/controls/designer).
The syntax of the .metainfo file is QML and the format is really simple.
If you really want to interface with the designer in C++ you can either use a Qt Creator plugin or use
the plugin interface from QmlDesigner itself (IWidgetPlugin). The QmlDesigner comes with its own plugin mechanism
and then you do not have to subclass from ExtensionSystem::IPlugin.
I hope this answers your question.
Kind Regards,
Thomas Hartmann
________________________________
From: Qt-creator <qt-creator-bounces+thomas.hartmann=qt.io at qt-project.org> on behalf of Wingard, Alexander <alexander.wingard at crosscontrol.com>
Sent: Wednesday, November 29, 2017 8:59:07 AM
To: qt-creator
Subject: [Qt-creator] How do I implement and register QmlDesigner::IWidgetPlugins?
Hi,
I hope this is the correct place to ask this. Haven’t had any real success googling.
I want to add some custom made QQuickItems to the QML Types panel in QmlDesigner. The purpose is to help our customers easily create UIs purely with the QmlDesigner, and minimize the need for coding knowledge as much as possible.
So far I’ve managed to create a QmlExtensionPlugin for my custom items that work fine in QmlDesigner. Only thing left to do is to get the components to show up in the QML Types panel so they can be easily dragged/dropped in.
>From what I understand I need to create a QmlDesigner::IWidgetPlugin for QtCreator that defines a category, button icons and labels (provide the metainfo file), and adds them to the QmlDesigner’s ItemLibrary. The implementation of the class seems straight forward. But I’m having trouble finding out how to set up the plugin project itself.
Am I supposed to wrap this class inside a regular ExtensionSystem::IPlugin, or is it standalone?
Is there some opensource project or example available that implements IWidgetPlugin that I can look at? All I’ve found so far are the sources for the standard components inside the QtCreator source code, but those seem to be part of the QmlDesigner plugin itself and not easily understood.
And again, sorry if this is the wrong type of question for this list. If so, where do you recommend I ask these kinds of questions?
Would be very grateful for any help or pointers!
Thanks in advance,
Alex Wingård
Alexander Wingård
Software Developer
www.crosscontrol.com
<http://www.crosscontrol.com/>
CrossControl
making machines smart, safe and productive
________________________________
Actuant Corporation Email Notice
This message is intended only for the use of the Addressee and may contain information that is PRIVILEGED and/or CONFIDENTIAL.
This email is intended only for the personal and confidential use of the recipient(s) named above. If the reader of this email is not an intended recipient, you have received this email in error and any review, dissemination, distribution or copying is strictly prohibited.
If you have received this email in error, please notify the sender immediately by return mail and permanently delete the copy you received.
Thank you.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/qt-creator/attachments/20171129/6381c652/attachment.html>
More information about the Qt-creator
mailing list