Results 1 to 4 of 4

Thread: Created a custom widget in wizard, how to get it in designer

  1. #1
    Join Date
    Jun 2012
    Posts
    98
    Thanks
    11
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Created a custom widget in wizard, how to get it in designer

    So ugh. I'm trying to do an example custom widget using the custom widget wizard found in designer/creator.

    (I.E. File, new project, other projects, custom widget..)

    I did that, hit build, and I can't seem to figure out how to get that custom widget into the designer.
    Presumably I'm missing a simple step. I'm crossing my fingers that this is enough information for you to know what step I happen to be missing.

    Any help is appreciated, thanks!

    EDIT: Maybe I need to include the plugin in whatever project wishes to add the custom plugin to it's form?
    Last edited by tescrin; 26th June 2012 at 00:05.

  2. #2
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: Created a custom widget in wizard, how to get it in designer

    I did that, hit build, and I can't seem to figure out how to get that custom widget into the designer.
    What do you mean by "get that custom widget into the designer"? Do you mean:
    • Use the non-Qt widget in a Designer layout for another widget. You insert similar widget into the new design and use the Promotion feature to make it use your class instead. See Using Custom Widgets with Qt Designer
    • Make that custom widget appear in the widget tool box at the left of Designer. You need to create a plugin for Designer to enable this. See Creating Custom Widgets for Qt Designer

  3. #3
    Join Date
    Jun 2012
    Posts
    98
    Thanks
    11
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Created a custom widget in wizard, how to get it in designer

    First, I mean the plugin approach. I don't mean to be rude, but I *did* mention that I was trying to get a plugin to work in designer in the first post.

    Second, NO. That tut was not helpful in figuring out WHY it won't show up in designer. I don't wish to write another 200 lines of code to have it *maybe* work when that hasn't worked two times before. I used the wizard to avoid that mess assuming that something that was completely automated to do *only* that task would work, built a wrapper around a QPushButton and I still see no "TestButton", if you will.

    There seems to be some obvious step these tut's don't go out of their way to explain. I don't know what hoop you have to jump through to get the files in the right spot that it'll be happy about it. If it matters:

    -I'm on Windows
    -Latest release of Qt, using Qt Creator
    -The code builds and works (for the button anyway) but does not get the object into designer. I would really like to figure out why it won't appear in my list

  4. #4
    Join Date
    Mar 2012
    Posts
    6
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows Symbian S60

    Default Re: Created a custom widget in wizard, how to get it in designer

    There are two ways of doing that.

    Adding a similar widget and Promoting this widget
    1. Add the similar widget to your desing (for example a QTextEdit)
    2. Copy and past the *.cpp and the *.h document to your project file
    3. Add those documents to your project
    4. On the Ui designer, Right Click over your widget
    5. Press Promote to...
    6. In the textbox Promote class name put the name of the class that you are going to add ("CodeEditor" for example, it is case sensitive).
    7. Press Add Button
    8. Press Promote Button

    Watch this video

    Last edited by luisvt; 10th August 2012 at 02:16.

Similar Threads

  1. Creating custom qt widget + not appearing in wizard
    By kewal.deshpande in forum Qt Programming
    Replies: 1
    Last Post: 4th March 2012, 05:26
  2. Replies: 0
    Last Post: 19th September 2011, 17:10
  3. Replies: 1
    Last Post: 24th June 2011, 00:09
  4. Replies: 4
    Last Post: 8th April 2011, 23:17
  5. Subclassing a widget created in Qt Designer
    By dmginc in forum Qt Programming
    Replies: 2
    Last Post: 19th January 2011, 07:30

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.