if we're given a layout, don't create another layout for it to live in

svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=879360
This commit is contained in:
Aaron J. Seigo 2008-11-03 04:15:34 +00:00
parent fdbd52d617
commit 8c7ed93278

View File

@ -215,10 +215,14 @@ int TabBar::insertTab(int index, const QIcon &icon, const QString &label,
QGraphicsWidget *page = new QGraphicsWidget(this);
page->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
if (content) {
QGraphicsLinearLayout *layout = new QGraphicsLinearLayout(Qt::Vertical, page);
layout->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
page->setLayout(layout);
layout->addItem(content);
if (content->isLayout()) {
page->setLayout(static_cast<QGraphicsLayout *>(content));
} else {
QGraphicsLinearLayout *layout = new QGraphicsLinearLayout(Qt::Vertical, page);
layout->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
layout->addItem(content);
page->setLayout(layout);
}
} else {
page->setPreferredSize(0, 0);
}