Hi all I have problem in adding QLabel to the layout of the widget. It never appears on the widget, here is the code I have written. I have derived a class from QMainWindow and here is the code,
MainWindow::MainWindow()
{
first= new QWidget;
second= new QWidget;
third= new QWidget;
middleWindow();
QHBoxLayout *mainLayout= new QHBoxLayout;
mainLayout->addWidget(first);
mainLayout->addWidget(second);
mainLayout->addWidget(third);
.
.
.
}
void MainWindow::middleWindow()
{
imageLabel=new QLabel;
imageLabel->setBackgroundRole(QPalette::Base);
imageLabel->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored);
imageLabel->setScaledContents(true);
// Load the Centre image
QImage image("images/middle.bmp");
imageLabel->setPixmap(QPixmap::fromImage(image));
QVBoxLayout *d= new QVBoxLayout;
d->addWidget(imageLabel);
second->setLayout(d);
}
I dont know why label doesnt appear on the second widget. Have I missed anything, in the Layout code?
Thanks in advance,
Seema Rao
Bookmarks