Install own C++ plugin (OSX)
-
Hello! I have custom c++ plugin libmyplugin.dylib. How can i install it to QtCreator and use it in my *.qml files?
I've copied libmyplugin.dylib to ~/Qt/Qt Creator.app/Contents/PlugIns
-
Hi, is your custom c++ plugin meant for helping Qt Creator with the editing of your *.qml files or for helping running them?
If the plugin is an editor helper then the ~/Qt/Qt Creator.app/Contents/PlugIns is the right place. But also you need to design the plugin in a certain way for Qt Creator to recognize it, see more here
-
This post is deleted!
-
@hskoglund No, it extends qml library, adds new types.
-
I see, you mean a QQmlExtensionPlugin?
Qt Creator doesn't know or care about such plugins, so I think it's a bad idea to copy it into ~/Qt/Qt Creator.app/Contents/PlugIns
You need to put in your project directory so that the QML import statement can find it, an example here
-
@hskoglund Then I need to store all the source code of my plugin in project. Is there any other way add plugin as a dependency?
-
You mean your C++ source code? No, you compile the C++ code when you build the plugin, so the C++ source code is not needed by *.qml files, only the compiled plugin.
(Sorry, I'm no expert, I only use Widgets in Qt, never QML. But there's a nice example of a QML plugin here)
-
@hskoglund Thank you! I've made plugin as subproject and dependency for my main project. Build plugin as a static library and link to in from my main project.