[Qt-interest] showing designed widgets in a layout

Mehmet Kaplan mehmetkpln at gmail.com
Tue Apr 13 08:09:42 CEST 2010


hi all,
I have a widget class in which I try to put some widgets in a layout.
First widget is a QLabel.
The other widgets are widgets designed by Qt Designer (widgets have .ui files).
In constructor of parent widget class, which will show all these
widgets, the code is like this:

Widget1 *designedWidget1 = new Widget1();
Widget2 *designedWidget2 = new Widget2 ();
Widget3 * designedWidget3 = new Widget3 ();
QLabel *myLabel= new QLabel();
myLabel->setPixmap(QPixmap::fromImage(QImage("inputImage.jpg")));

QVBoxLayout *vl = new QVBoxLayout(this);
vl->addWidget(myLabel);
vl->addWidget(designedWidget1 );
vl->addWidget(designedWidget2 );
vl->addWidget(designedWidget3 );
setLayout(vl);

After this code sequence parent widget only show the QLabel widget,
other designed widgets are invisible.
Am I doing a wrong thing, is it impossible to show designed widgets in a layout?



More information about the Qt-interest-old mailing list