hi seema,
That was quite well. But u have not mentioned the parents for these labels. Try this code:
MainWindow::MainWindow()
{
middleWindow();
mainLayout->addWidget(first);
mainLayout->addWidget(second);
mainLayout->addWidget(third);
.
.
.
}
void MainWindow::middleWindow()
{
imageLabel
->setBackgroundRole
(QPalette::Base);
imageLabel->setScaledContents(true);
// Load the Centre image
QImage image
("images/middle.bmp");
imageLabel
->setPixmap
(QPixmap::fromImage(image
));
d->addWidget(imageLabel);
second->setLayout(d);
}
MainWindow::MainWindow()
{
first= new QWidget(this);
second= new QWidget(this);
third= new QWidget(this);
middleWindow();
QHBoxLayout *mainLayout= new QHBoxLayout(this);
mainLayout->addWidget(first);
mainLayout->addWidget(second);
mainLayout->addWidget(third);
.
.
.
}
void MainWindow::middleWindow()
{
imageLabel=new QLabel(this);
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(this);
d->addWidget(imageLabel);
second->setLayout(d);
}
To copy to clipboard, switch view to plain text mode
Please let me know what happenned.
Regards,
sarma.
Bookmarks