1

Can any one say the step by step method to incorporate already created plugins into a new QML based program.
I've got this plugin called qmltermwidget from git qmltermwidget github
Now i have compiled it and I can test the example program in it but I don't know how to use it in my custom application using Qt/QML

Dravigon
  • 73
  • 1
  • 8

1 Answers1

3

See "Creating C++ Plugins for QML".
In your case, you already have a plugin (from your previous question), but the steps involve:

  • Write a project file for the plugin
  • Create a qmldir file to describe the plugin

QML extension plugins are for either application-specific or library-like plugins.
Library plugins should limit themselves to registering types, as any manipulation of the engine's root context may cause conflicts or other issues in the library user's code.

The "Module Definition qmldir Files" is where you declare a plugin to be made available by the module.

plugin <Name> [<Path>]
  • <Name> is the plugin library name. This is usually not the same as the file name of the plugin binary, which is platform dependent; e.g. the library MyAppTypes would produce libMyAppTypes.so on Linux and MyAppTypes.dll on Windows.
  • <Path> (optional) specifies either:
    • an absolute path to the directory containing the plugin file, or
    • a relative path from the directory containing the qmldir file to the directory containing the plugin file.

By default the engine searches for the plugin library in the directory that contains the qmldir file.
The plugin search path can be queried with QQmlEngine::pluginPathList() and modified using QQmlEngine::addPluginPath().

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • again i don't get it i have he compiled plugin in a path say /QMLTermWidget in my main programs how should i add it to my main program – Dravigon Mar 11 '17 at 22:36
  • i have added the plugin folder to the qrc like [this question](http://stackoverflow.com/questions/31726321/load-qmldir-from-qrc-file?noredirect=1&lq=1) but the suggested answer does not work – Dravigon Mar 13 '17 at 16:18