Results 1 to 2 of 2

Thread: promoting a QToolBox widget to a custom ToolBox

  1. #1
    Join Date
    Dec 2010
    Posts
    4
    Thanks
    1
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default promoting a QToolBox widget to a custom ToolBox

    1. I have created a custom QToolBox widget by simply adding 3 more tab pages to the default QToolBox designer and named my class ToolBox.
    2. In my main form, I added a QToolBox widget, right click on the QToolBox widget, and selected promote to.
    3. I entered in ToolBox as my promoted object and clicked on promote. However, the mainform ui still only contain only the default QToolBox pages eventhough the side of the control, on the object viewer, indicates that it is a ToolBox derived object.

    Can someone show me how I can promote a QToolBox widget? Thanks!

  2. #2
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: promoting a QToolBox widget to a custom ToolBox

    Can someone show me how I can promote a QToolBox widget?
    You HAVE promoted your QToolBox!
    But you probably don't understand what promoting in designer means.
    Promoting a widget is nothing more than telling designer that it should trust you, and in the UI file, it will create the class you promoted to, and put the include file for your custom file in the ui.
    So when the ui compiler makes C++ code out of your ui, in your project where your custom class is known, it will compile and when you run the application, your gui will show your custom widget where the promoted widget is on the from.
    Ergo - in designer, at design time, designer knows nothing about your promoted widget, and it will only show the base widget it knows.
    If you want to have your custom widget "designable" in designer, you will have to create a designer plugin out of your custom widget.
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

  3. The following user says thank you to high_flyer for this useful post:

    phamtv (23rd December 2010)

Similar Threads

  1. Promoting to custom widget
    By cia.michele in forum Newbie
    Replies: 2
    Last Post: 26th September 2010, 11:38
  2. Promoting widget in Designer
    By evident in forum Qt Programming
    Replies: 5
    Last Post: 24th July 2010, 22:06
  3. Promoting QLabel
    By anafor2004 in forum Qt Tools
    Replies: 23
    Last Post: 28th January 2008, 11:27
  4. Error when promoting a custom widget
    By engin in forum Qt Tools
    Replies: 1
    Last Post: 15th December 2006, 16:00
  5. Promoting a custom widget derived from QWidget Qt4
    By high_flyer in forum Qt Tools
    Replies: 1
    Last Post: 2nd March 2006, 18:50

Tags for this Thread

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.