Can't install custom widget
-
Hello I am trying to install custom widget QSlide: "LINK":http://qt-apps.org/content/show.php/QSlide?content=75303
But I can't compile it, getting error:
"invalid application of 'sizeof' to incomplete type 'QStaticAssertFailure<false>'
enum {Q_STATIC_ASSERT_PRIVATE_JOIN(q_static_assert_result, COUNTER) = sizeof(QStaticAssertFailure<!!(Condition)>)}"Cand find out how to fix it ?
-
It seems it's a plugin for Qt 4 and you're using Qt5, where the macro Q_EXPORT_PLUGIN2 is no longer used.
See "this":http://qt-project.org/doc/qt-5/plugins-howto.html for some info on plugins in Qt5 -
Thanks. So I should use Q_PLUGIN_METADATA instead.
In examle it looks like this:
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QStyleFactoryInterface" FILE mystyleplugin.json)I dont understund what is this: "org.qt-project.Qt.QStyleFactoryInterface"
What path should I add in this place ?And what data should I add in .json file ?
If I understund corectly it should be like this:Old code:
@Q_EXPORT_PLUGIN2(customwidgetplugin, QSlidePlugin) // DELETE IT@Then create file "myqslider.json" and add following content :
@{ "Keys": [ "customwidgetplugin", QSlidePlugin ] }@
-
The "doc":http://qt-project.org/doc/qt-5.0/qtcore/qtplugin.html#Q_PLUGIN_METADATA says it's the interface the plugin implements.
QSlide implements QDesignerCustomWidgetInterface so I would guess it's something like "org.qt-project.Qt.QDesignerCustomWidgetInterface" but I've never created any plugins so I might be wrong ;)[Edit] Yup, this "example":http://qt-project.org/doc/qt-5/qdesignercustomwidgetinterface.html#details seems to confirm this.
-
Ok, now when I compile plugin window opens:
"could not find the executable, please specify one".
There is "qslideplugd.dll" in debug directory maybe I should place it in Qt somewhere, to make widget appear in Designer.
I tried C:\Qt\Qt5.2.1\5.2.1\mingw48_32\plugins\designer but no luck. -
“could not find the executable, please specify one” - this is not when you compile but when you try to run it. Plugin is a library (a dll) so there's nothing to run.
The directory you pasted is the directory of Qt (the library).
You need to place it in the plugins directory of the Qt Creator (the IDE). -
-
Plugins need to be built with the same compiler and Qt version (or at least binary compatible one) that was used to build Qt Creator (you can check in about window what was used for Creator). For example creator bundled with the online installer was built with 32bit VS2010.
-
Ok, let's break it down. These are the things you deal with:
- Qt Creator - an IDE that you (probably) installed. To create it a compiler and some Qt version was used. In case of Creator 3.0.1 from online installer it was Qt 5.2.1 compiled with VS2010
- Your own program - using whatever Qt and compiler you chose, for example this can be Qt 5.2.1 and MinGW 4.8.
- QSlide class - you just include it in your project so it's the same as your program.
- QSlide plugin for the Qt Creator - this needs to use the same Qt and compiler version that was used for the Qt Creator
So again - to just use the class in your code you can use whatever Qt and compiler you want. You don't need the plugin at all for that.
To use the Qt Creator designer plugin both your Qt Creator and the plugin need to use the same Qt and compiler version.If you decide to build the plugin with VS2010 you don't have to use VS(the IDE). Just the compiler from it is needed and you can set it up in the Qt Creator.
I hope this is clearer.
-
Thank you for explanation.
So I have two options:
- recompile Qt Creator with MinGW (Actualy I don't even know how to do that) or download and reinstall MinGW version.
- rebuild QSlide plugin using VS2010.
I think I will try second option, but can I use both MinGW and VS2010, or I have to uninstall MinGW and then install VS2010 ?
Sory for stupid questions, My knowledge is basic, I newr tried to use any plugins before.
-
Ad. 1 Qt-Project doesn't provide Qt-Creator compiled with MinGW. You would have to build it yourself or look for a 3rd party precompiled package. Anyway I wouldn't recommend it.
As for the multiple compilers and IDEs - yes, you can have as many of them as you like installed. They don't know about each other. You just set those up as separate toolchain kits in the Creator.