0
votes

I've read through the tutorials of Qt, I've searched the net, but I can't find the exact way on how to build custom witgets with Qt 5.8.x. In example with this tutorial one is able to build widgets for Qt 4.x as I already succeeded. For Qt 5.8.x I'am lacking in such straightforward tutorials.

Even if you use the build in wizard of Qt for setting up such custom widgets projects, one will end up with none recognized widget libraries.

So first of all, there is a confusion with the installing path, that the makefile should mention while installing the plugin.

In the project file one can find the section

target.path = $$[QT_INSTALL_PLUGINS]/designer
INSTALLS    += target

After a straightforward installation of the open source mingw version of Qt 5.8.0 on a windows 7 machine in the path C:\Qt\Qt5.8.0, the variable "QT_INSTALL_PLUGINS" will extend to

C:\Qt\Qt5.8.0\5.8\mingw53_32\plugins

thus the "target.path" for the

make install

will be read as

C:\Qt\Qt5.8.0\5.8\mingw53_32\plugins\designer

But on the plain installation of Qt 5.8.0 with mingw the designer searches its plugins in

C:\Qt\Qt5.8.0\Tools\QtCreator\bin\plugins\designer\

As someone already suggested to me, one has to set the environment variable "QT_PLUGIN_PATH", where Qt Creator as well as Qt Designer ( in the subdirector "designer") searches its plugins in. So in order that Qt Creator still works properly one has to set the environment variable "QT_PLUGIN_PATH" to

  • the original path as well as to
  • the install path reffered to by $$[QT_INSTALL_PLUGINS]

So on my Windows 7 environment I set the variable "QT_PLUGIN_PATH" to

C:\Qt\Qt5.8.0\Tools\QtCreator\bin\plugins;C:\Qt\Qt5.8.0\5.8\mingw53_32\plugins

Afterwards Qt Designer is able to find the custom build widget library. But Qt Designer it not able to load the library. One interesting thing is that the designer also refuses the libraries provided by the installation of Qt itself.

  • on loading the custom widget lib it says:

    "... .dll can't be loaded: the given procedure was not found"

  • on loading the libs supplied by the Qt distribution itselfs in the path C:\Qt\Qt5.8.0\5.8\mingw53_32\plugins\designer it says:

    "... .dll cant be loaded: the mentioned modul was not found"

What I've done to build the library is, that I just ran through the project wizard to generate a custom widget for Qt Designer. With the so generated project I get the result of a non loadable lib, as mentioned above.

What do I have to change in the source/project files in order that the Qt Designer ist able to load the lib properly?

Thanks for any hints or suggestions!

1
Hello, here is the Qt5 version of your tutorial actually: doc.qt.io/qt-5/designer-creating-custom-widgets.html - Adrien Leravat
Thanks für the link! I downloaded all the code and project file of the worldtimeclock example. But on my environment I get still the same error. The Library can't be loaded. Designed says: "The library ...... worldtimeclockplugin.dll can't be loaded: the mentioned procedure was not found". But I can't figure out, which procedure is missing, or which procedure the designer is locking for. How can I retrive this information? - akazen

1 Answers

0
votes

You seem to use the MinGW compiler.
You cannot make plugins with that compiler with the default supplied Creator as it's compiled with Visual Studio 2013/2015 (depending on the Qt version). Due to how DLLs works on Windows, you must use the same compiler that Creator is compiled with to build the plugin (otherwise it can't load it).

Go to "About Qt Creator" in the Help menu to check.

Also make sure to build the plugin in Release mode.