Results 1 to 4 of 4

Thread: Custom Widgets in QT DEsigner

  1. #1
    Join Date
    Jun 2007
    Posts
    4
    Thanks
    1
    Qt products
    Qt3
    Platforms
    Unix/X11

    Default Custom Widgets in QT DEsigner

    Hi

    I have created a widget by extending a QSpinBox. How can I add it to a dialog that i have created in QT Designer?

    Thanks
    Amit Khanna

  2. #2
    Join Date
    Oct 2009
    Posts
    151
    Thanks
    6
    Thanked 13 Times in 11 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Custom Widgets in QT DEsigner

    You could add something like this to your xxxdialog.cpp
    Qt Code:
    1. QHBoxLayout *layout = new QHBoxLayout;
    2. layout->addWidget(xxxspinBox);
    3. xxxdialog->setLayout(layout);
    To copy to clipboard, switch view to plain text mode 
    Got to keep the loonies on the path ...

  3. #3
    Join Date
    Jun 2007
    Posts
    4
    Thanks
    1
    Qt products
    Qt3
    Platforms
    Unix/X11

    Default Re: Custom Widgets in QT DEsigner

    Thanks for the reply. Actually I have a dialog form that i made in QT Designer. The form has a textbox, checkbox and push button. I want to add a MySpinBox to this dialog. Is there some way by which i could get MySpinBox in list of widgets that i can directly to the form?

    Amit Khanna

  4. #4
    Join Date
    Oct 2006
    Location
    New Delhi, India
    Posts
    2,467
    Thanks
    8
    Thanked 334 Times in 317 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Custom Widgets in QT DEsigner

    There are 2 ways,,
    1 - you can add spinbox in designer, right click and use promote-to option to promote it to the class you have written.
    2 - Make your class as a designer plugin and you can drag drop your widget from there.

    I guess option 1 will be easier to go.

Similar Threads

  1. Replies: 18
    Last Post: 21st May 2010, 15:08
  2. Adding Custom Widgets to the QT Designer
    By Polnareff in forum Qt Programming
    Replies: 1
    Last Post: 17th May 2010, 21:31
  3. Replies: 0
    Last Post: 15th May 2009, 15:38
  4. Global includes with designer custom widgets
    By mab in forum Qt Programming
    Replies: 2
    Last Post: 5th October 2006, 22:06
  5. Replies: 2
    Last Post: 14th February 2006, 15:28

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.