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

Unable to figure out how to add custom widget in qt creator.



  • Hi, all

    I've started off with qt few days ago. I've gone through basic tutorials and understood how it works basically.
    My system specs : using qt-4.8.5-minGW, qt creator 3.0 (both of 'em installed via installer) on win7

    Recently, I was going through a tutorial to create custom widget (analog clock example) in which i've gone through procedure. Project builds fine. Now what am I supposed to do so that I can use that custom widget via qt-creator to design my own ui ?

    I've gone through various posts saying use promote widget options and etc. But am i supposed to add generated files (if any) somewhere in qt-creator or qt-designer ? My ultimate aim is to show that custom widget in qt-creator's built in widget panel.

    Any help regarding his topic will be appreciated.



  • Alright,

    I followed this link : http://qt-project.org/forums/viewthread/6235 and figured out where it should be put (generated dll file).

    I checked like mentioned in this reference. Tools --> Form editor --> Qt designer plugins

    My custom plug in is listed under failed plugin with error message saying :

    " Plugin verification data mismatch"

    Any idea what could be the error ?

    Thanks in advance.



  • Hi,

    I figured out the problem.

    I guess it was because my qt creator was based on qt 5.2 , msvc 2010 and I was using qt 4.8.5 to compile the plugin.

    I solved it as i'm using qt creator 2.5.2 (based on qt 4.8.2) and qt-4.8.2-VS2008, and after adding generated dll to the path, it adds the widget to designer / creator panel.

    Now i'm stuck at the next stage.

    While adding a custom widget to a form, while building it says...

    "widget.h" file not found. Now that got me thinking isn't generated dll supposed to do that ?

    Anyhow i tried adding .h and source files of widget to the path but then the following error pops up.

    12:10:31: Running steps for project test1...
    12:10:31: Configuration unchanged, skipping qmake step.
    12:10:31: Starting: "C:\Qt\qtcreator-2.5.2\bin\jom.exe"
    C:\Qt\qtcreator-2.5.2\bin\jom.exe -f Makefile.Debug
    Error: dependent '....\Custom' does not exist.
    jom: D:\Qt projects\Test forms\test1-build-desktop-Qt_4_8_2__4_8_2__Debug\Makefile [debug] Error 2
    12:10:32: The process "C:\Qt\qtcreator-2.5.2\bin\jom.exe" exited with code 2.
    Error while building/deploying project test1 (target: Desktop)
    When executing step 'Make'

    Any help will be appreciated.



  • I figured it out. I have to copy my .h files and source files in project path. It worked.

    Thanks.


Log in to reply