Solved Making a Qt custom widget without Qt Creator
-
@Panoss
Its sort of a do once and use mingw Creator for ever with that version of Qt
But in a few version of Qt you might need to recompile Creator.Its not a nightmare as such ( webkit is: ) but it does take some (long) time.
If you plan on others to use your plugin , the VS way is still better :)
You will still use Creator etc and its just other compiler.And no, the whole reason to compile Creator with mingww is so it will load plugins compiled with
mingw. So as long as you do not upgrade mingw , then no need to ever recompile Creator for a new plugin.The normal Creator is compiled with Vs and only like VS compiled plugins.
So in my opinion, for your use case Visual Studio is better as its how it normally works and
all other installations of Qt can just use it. -
Ok, I 'll go for the Visual Studio, you convienced me :).
-
@Panoss
Super. Its fun with plugins.
We need more , one can never have too many Designer widgets :)Final note:
The debugger is a separate download.
https://forum.qt.io/topic/60713/setting-visual-studio-2015-debugger/optional component called "debugging tools for windows"
This is often a surprise :)
-
"Optional". So I can live without it, right?
You mean, 'this is often a good surprise' ? -
You will need debugger :)
We all do.
And no its was not good surprise.
They come here and say.
"Program crash"
and we go like "ok, place a breakpoint and single step the function to find crash point."But it can wait till later i guess :)
-
Fast question:
This plugin will run on windows xp?
The app is for Xp?Note that from 5.7 ( think) its not tested on xp.
Might work or might not. Its not supported. -
It will run on Win 10, Win 7 and XP.
-
@Panoss
Ok. just asking as XP is not on ppl mind anymore.
https://forum.qt.io/topic/73292/the-last-qt-version-that-supported-windows-xpSounds like using 5.6 is the best bet :)
Did u try that version of Creator on xp?
It didn't start or ?
Note that Xp in virtual machine do not have openGL (often) and can only work if started with some option
https://forum.qt.io/topic/36827/qt-creator-3-0-welcome-mode-not-working-in-virtualbox-vmlike
c:\path\qtcreator -noload Welcome -noload QmlDesigner -noload QmlProfiler -
On XP I haven't tried Qt Creator yet.
I was thinking of trying an older version, and adjusting the code where necessary. -
@Panoss
well if u go back to Qt4 then all plugin stuff is a bit different. ( from Qt5 series)
So would be great if 5.6 can be used. :) -
Ok, I installed VS 2015 and the debugger (Windows 10 SDK).
Qt Creator auto-detected the VS compiler and a CDB debugger (this must be from Windows 10 SDK).
This means I 'm ready?
So how do I compile a plugin to dll? -
Start a "Qt Custom Designer Plugin" project and it will be all prepared for that. This one is under "Other project" in the "New File or Project" dialog.
-
I make a New Project->Qt Custom Designer Widget, Name: I enter 'AnalogClock'->Next but I see no VS kit:
And no VS kit is auto detected.
Maybe I should add manually a VS kit?Should I make two projects? The 'main' project in wich the widget will be used, and the project of the widget (plugin)?
-
I tried to add a kit manually, but it raises errors:
(I changed C++ compiler from MingW to VS2015)
EDIT: Ok, I had forgotten in Maintenance tool to add, at Qt5.8: msvc2015 32-bit, I'm adding it right now.
-
Ok, after adding msvc2015 32-bit in Maintenance tool, everything seems ok.
I built the poject, and a dll was created(!!wow) in my project 's debug folder.I also now have two folders:
c:\qt\5.8\mingw53_32\bin and
c:\qt\5.8\msvc2015\bin
which have a designer.exe inside.
I run them both (I suppose the one that should show my plugin is the msvc2015\bind\designer.exe) but in none of them appears my plugin.
Also the dll of my plugin was not copied in any of the folders of c:\qt\5.8. -
@Panoss Try to copy the manually to plugins/designer directory in your msvc2015 Qt installation.
-
I copied it in C:\Qt\5.8\msvc2015\plugins\designer, but it failed: 'uses incompatible Qt library. Cannot mix debug and release libraries':
-
@Panoss
Try to build it in Release mode and then copy. -
In the Qt Creator 's 'Release' button, I chose 'release', and build.
In folder C:\Documents\QtProjects\AnalogClockB\build-AnalogClockB-Desktop_Qt_5_8_0_MSVC2015_32bit-Release\release
a dll was created!!! I copied it in C:\Qt\5.8\msvc2015\plugins\designer....and...it appeared in Qt Designer!!! Wow!!Thank you all guys, your help was great!