Problems with my first widget plugin
-
Hello
I tried to integrate my first widget-plugin in the designer.Here is the project file gererated from the wizzard. It is a simple subclassing from a checkbox with no additionl functions:
TARGET = $$qtLibraryTarget(awWidgetsPlugin) TEMPLATE = lib HEADERS = awcheckboxplugin.h SOURCES = awcheckboxplugin.cpp RESOURCES = icons.qrc LIBS += -L. greaterThan(QT_MAJOR_VERSION, 4) { QT += designer } else { CONFIG += designer } target.path = $$[QT_INSTALL_PLUGINS]/designer INSTALLS += target include(awcheckbox.pri)
I changed in the plugin the group-name:
QString awCheckboxPlugin::group() const { return QLatin1String("awWidgets"); }
It compiles successfull and generates the dll in a subfolder of my project, but how can I start the integration in the designer.
I have understooden that the following lines from the project file should do this task, but nothing happens.target.path = $$[QT_INSTALL_PLUGINS]/designer
INSTALLS += targetI checked the whole Qt path for this file but found it nowhere. Then I copied by hand my plugin.dll in the following folders:
C:\Qt\Qt5.4.1\Tools\QtCreator\bin\plugins\designer
C:\Qt\Qt5.4.1\5.4\mingw491_32\plugins\designer
and restarted the designer but the widget paletted has no changed.What must I correct ?
PS:
I found this code#if QT_VERSION < 0x050000 Q_EXPORT_PLUGIN2(awcheckboxplugin, awCheckboxPlugin) #endif // QT_VERSION < 0x050000
What is not active for my Qt version. Removing of the switches gives a compiler error.
How to activate the the plugin in Qt versions >= 5 ? -
Hi,
You're hitting the one pitfall with designer plugins: You Qt version + compiler must match the one used to build Qt Creator. For windows, currently and AFAIK, Qt Creator is built with Visual Studio (last time I check it was 2010, it might have changed in between)
-
Hello @SGaist !
Uff, this is a very big pitfall, but explaines much for me.
The Qt binary package for windows is incompatible with itself!? This decreases my first enthusiasm on Qt very much. What is the idea from Digia behind this concept ???
How solve other people this problem? Must I develop a plugin in old C++ style (VS10 is used) and develop an other with the same funktionality in MinGW for my running app? Is this possibe?
The most logic solution would be to get the Designer compiled in the same WinGW version as the it uses itself for developping. Can I download a binary version of it somewhere?
I found a lot of posts in the net about this subject. It seem that only a hand full of persion on this planet had every succes in compiling the designer in WinQW on Windows. Have I a chance to mange this task in my lifetime ?
-
Qt Creator doesn't need to be compiled with the same compiler nor use the same architecture as the Qt version you are currently using, it's just an IDE. On the other hand creating and validating packages for all supported OS + Architecture combinations (OS X, Linux, Windows (which has 4 different compilers that are not compatible one with another + iOS and Android) is already a huge task that takes much time so that's one of the reasons of optimizing the number of different Qt Creator builds and it's really a Windows specific problem. In any case, you can check the packages here. The Qt Creator provided might be built with the same compiler used to create the packages.
-
The Qt binary package for windows is incompatible with itself!?
Most of the time no. Very limited number of compilers target binary compatibility.
The only one I know which does is Intel which is compatible with specific version of Microsoft.
In any case you do not need to develop separate plugin, but you need to build it with appropriate compiler.
If you do not want to use Microsoft one you can build Designer with compiler you own.Personally I build my own QT binaries.
It has to be done once per version/ per toolchain and per system (32/64 bit) and guaranties compatibility.
If you think this is a pain think how much pain would be to build, test and maintain every possible combination. -
Ok, I see it is a great chance make my own compile of the Designer. I am not used to make my own IDE, but if it really works it is fine. I will give it a try.
An other idea, beacause I must not use MinGW. What is with the binary package download for Window with MSVC13 compiler . Is here the Designer compiled with MSVC13 or MSVC11?What is in general recommended for Windows developement MinGW or MSVC. What are the disadvantages and advantages of both version?
-
What is in general recommended for Windows developement MinGW or MSVC. What are the disadvantages and advantages of both version?
There's no such recommendation. These are both supported and which you use depends on your needs. Which is "better" depends largely on who you ask. Some considerations are as follow:
MSVC, as being MS product, has a better platform support and (reported by some people in some cases - yes, this is vague) a better code generation. Depending on what your project is, it will have better (or exclusive) integration with other MS-centric solutions, for example Visual Studio, MFC, .net etc. The debuggers (either built-in VS debugger or CDB) also provide a far better experience.
MinGW, as being Windows port of GCC, has a better c++11/14 conformance and is updated more frequently.
There are also 3rd party libraries that will support one or the other, or provide binaries for one and only source code for other, so you should check your dependencies when making toolchain decision.