Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

How do I make a Qt Designer Plugin?



  • I've been looking through Google, Youtube, & Qt Documentation for the last 6 hours or so in order to try and figure out how to make a new plugin for Qt Designer so that I can simply click and drag the new UI Element onto a form, but I feel like I've made 0 headway in terms of getting it working.

    The closest I've gotten is from here: https://doc.qt.io/qt-5/qtdesigner-customwidgetplugin-example.html

    I followed those instructions, but the new custom widget did not appear on the Qt Designer tool list.

    Ideally, someone could explain (preferably through a video... as I can't seem to find any) how to create a custom plugin from start to finish; because right now I'm super confused. I'm astonished there hasn't been a single video guide showing this...


  • Moderators

    Hi @KidSault,

    1. Did you build your plugin using the same compiler version and Qt version that was used to build Qt Creator? (See Qt Creator > Help > About Qt Creator... for these details)
    2. After you built your plugin, did you install it into the Qt Designer plugins folder? (the default Windows folder is C:\Qt\Tools\QtCreator\bin\plugins\designer )


  • @JKSH

    1. Looking at it now, it's 0.0.3 versions off... The version I built with (only once available to me) is 15.12.0 (See the pictures)
      alt text
      alt text
      alt text

    2. I did.

    Here are the exact steps I took....

    1. Create a new C++ Library project in QT Creator.
    2. Copy and paste all the files provided on the guide exactly as they are.
    3. Change compile to Release mode & click Build, followed by Rebuild All.
    4. Copy the new .dll to the Qt Designer Plugins folder.
    5. Restart Qt, make a new sample widget program... Check Qt Designer Tools & nothing new is there.

  • Moderators

    @KidSault Your version of Qt Creator was built using MSVC 2017 32-bit. Therefore, you must also use MSVC 2017 32-bit to build your plugin. (Your screenshot shows MinGW 64-bit, which is not compatible)



  • Hmm you're right @JKSH. I guess I jumped the gun there....

    I just did a fresh install of Qt & for whatever reason the compiler for that isn't on there... Any idea how I can get it?

    alt text


  • Lifetime Qt Champion

    Hi,

    From the looks of it you installed Visual Studio 2019, didn't you ?



  • Hello @SGaist, yes I did. Can I not somehow use it with this version of Qt?


  • Moderators

    @KidSault said in How do I make a Qt Designer Plugin?:

    for whatever reason the compiler for that isn't on there... Any idea how I can get it?

    Your screenshot shows that you have MSVC 2019 installed (Visual C++ Compiler 16.0). This should be compatible with MSVC 2017. Select Microsoft Visual C++ Compiler 16.0.28803.202 (x86) for your MSVC 2017 32-bit kit.

    Note: Qt is a C++ library. You normally need to download the C++ compiler from the compiler's producer (which is Microsoft for MSVC).

    I just did a fresh install of Qt

    It looks like you installed every single kit under "Qt 5.12.3", which would have been ~20 GB?

    In the future, expand "Qt 5.12.3" and only select the kits that you want.



  • @JKSH THANK YOU.

    So I uninstalled Qt again, and then I re-installed with only the required kits. However, I was still unable to compile using MSVC 2017 option (even when selecting 2019).

    So I booted up Visual Studio Installer, modified my current install to include the MSVC 2017 32 & 64 compiler and build tools. Then I restarted QT, manually selected the compilers in settings, built, and bam it worked!

    Thank YOU!!


  • Lifetime Qt Champion

    Hi
    Just as a note.
    You can use custom Widgets in Design mode without using a plugin.
    Creator has a feature called promotion.
    https://doc.qt.io/qt-5/designer-using-custom-widgets.html
    You can even drag a promoted Widget from the form to the left side widget bar and have your widget there also
    ready to be dragged into any form. already promoted.

    However, promotion, do not allow Design time adjustment of properties for properties not
    in the base class. Also if your custom widget has a new paint function, that is first seen when run.


  • Lifetime Qt Champion

    @KidSault said in How do I make a Qt Designer Plugin?:

    @JKSH THANK YOU.

    So I uninstalled Qt again, and then I re-installed with only the required kits. However, I was still unable to compile using MSVC 2017 option (even when selecting 2019).

    So I booted up Visual Studio Installer, modified my current install to include the MSVC 2017 32 & 64 compiler and build tools. Then I restarted QT, manually selected the compilers in settings, built, and bam it worked!

    Thank YOU!!

    Hi,

    There is a "small" catch with the Visual Studio installer: by default the C++ tools are not selected by default.

    I think you have been bitten by that.


Log in to reply