PDA

View Full Version : Custom Widgets in QT DEsigner



amitkhanna
3rd June 2010, 16:32
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

JD2000
3rd June 2010, 17:38
You could add something like this to your xxxdialog.cpp
QHBoxLayout *layout = new QHBoxLayout;
layout->addWidget(xxxspinBox);
xxxdialog->setLayout(layout);

amitkhanna
3rd June 2010, 20:30
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

aamer4yu
4th June 2010, 06:15
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.