PDA

View Full Version : promoting a QToolBox widget to a custom ToolBox



phamtv
22nd December 2010, 19:16
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!

high_flyer
23rd December 2010, 09:35
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.