Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Correct way to write plugins
jaskmar last edited by
I am not sure what is the correct/better way to write plugins for my application. I am confused as when I look at an example called "echoplugin" I can see following code for plugin main class definition:
class EchoPlugin : public QObject, EchoInterface
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.Examples.EchoInterface" FILE "echoplugin.json")
QString echo(const QString &message);
When I try to make new liblary using Qt Creator, the enviroment generates totaly diferent template:
class UNTITLEDSHARED_EXPORT Untitled
#endif // UNTITLED_H
So my question is which way to write plugin is better and how should I use Qt Creator to do it.
You can either start from the library template and add the modifications needed to make it a plugin or copy e.g. the plug and paint plugin example and modify it to suite your needs.