Important: Please read the Qt Code of Conduct -

[SOLVED] Plugin migrated to Qt 5.0.0 build error will not generate lib file

  • I am trying to migrate a working plug-in that works fine in Qt 4.8.4 which was obtained "here": I am having issues in Qt 5.0.0 for MSVC2010. Specifically, the module which provides implementation of the plugin is in
    @Q_EXPORT_PLUGIN2(customwidgetplugin, QLedIndicatorPlugin)@

    which appears to have been deprecated and show an error:

    error C2338: Old plugin system used.

    If I just comment it out, the build doesn't generate a needed .lib file which is used by Qt designer.

    I'm reading that the replacement is to use Q_PLUGIN_METADATA but the examples I saw are not in the context of how I used the former.

    What's the right way to migrate this?

    I the header for the plug in, I edited the code to include the following, based on some of the plugin examples in the 5.0 build:

    Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QDesignerCustomWidgetInterface" FILE "qledindicator.json")

    I get yet again an error "Plugin Metadata file "qledindicator.json" does not exist. Declaration will be ignored

    I fixed it it by removing the FILE keyword which was the second parameter in the macro. This allowed the LIB file to be generated.

    Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QDesignerCustomWidgetInterface" /* FILE "qledindicator.json" */)

  • Hi

    I was having the same problem when I tried to implement the CircleBar example from Thelin's book in QT5.

    After looking at the doc, I managed to get something working, but I'm not sure what exactly is going on.

    I inserted this in circlebarplugin.h:

    @class CircleBarPlugin : public QObject, public QDesignerCustomWidgetInterface
    Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QDesignerCustomWidgetInterface" FILE "circlebar.json")

    Then I created a new text file inside the project (right click on the project name in the sidebar->add new->general->text file, this puts it in the current directory so it can be seen) and renamed it circlebar.json. I simply put:

    @{ "Keys": [ "circlebaristhisplugin" ] }@

    In the file and it seemed to work. I'm not too sure what's going on in Q_PLUGIN_METADATA or the .json file but this is working for me at the moment.

  • I was having similar problem when I was trying to create sample Qt Creator plugin with Qt 5.2 and Qt Creator 3.0.8, both built from their Git repositories.

    After creating project with the Qt Creator Plugin wizard, I tweaked some file/class names and started getting this "“Plugin Metadata file ... does not exist."

    Turns out, FILE name used in Q_PLUGIN_METADATA was slightly different than QTC_PLUGIN_NAME in .pro file.

Log in to reply