revert last bogus commit

svn path=/trunk/KDE/kdelibs/; revision=1042383
This commit is contained in:
Marco Martin 2009-10-29 17:58:52 +00:00
parent 7e8d330582
commit 4418fb8971
2 changed files with 3 additions and 12 deletions

View File

@ -126,7 +126,6 @@ void TabBarPrivate::updateTabWidgetMode()
mainLayout->removeAt(0); mainLayout->removeAt(0);
tabBarLayout->removeAt(1); tabBarLayout->removeAt(1);
mainLayout->addItem(tabProxy); mainLayout->addItem(tabProxy);
q->setPreferredSize(-1, -1);
} }
} }
@ -145,11 +144,7 @@ void TabBarPrivate::slidingCompleted(QGraphicsItem *item)
if (item == oldPage || item == newPage) { if (item == oldPage || item == newPage) {
if (item == newPage) { if (item == newPage) {
tabWidgetLayout->addItem(newPage); tabWidgetLayout->addItem(newPage);
mainLayout->invalidate();
//FIXME: usual QGraphicsLayout hack
q->setPreferredSize(mainLayout->effectiveSizeHint(Qt::PreferredSize));
newPageAnimId = -1; newPageAnimId = -1;
emit q->currentChanged(currentIndex);
} else { } else {
oldPageAnimId = -1; oldPageAnimId = -1;
item->hide(); item->hide();
@ -218,14 +213,11 @@ TabBar::TabBar(QGraphicsWidget *parent)
: QGraphicsWidget(parent), : QGraphicsWidget(parent),
d(new TabBarPrivate(this)) d(new TabBarPrivate(this))
{ {
setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
d->tabProxy = new TabBarProxy(this); d->tabProxy = new TabBarProxy(this);
d->tabWidgetLayout = new QGraphicsLinearLayout(Qt::Vertical); d->tabWidgetLayout = new QGraphicsLinearLayout(Qt::Vertical);
d->tabWidgetLayout->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
d->tabBarLayout = new QGraphicsLinearLayout(Qt::Horizontal); d->tabBarLayout = new QGraphicsLinearLayout(Qt::Horizontal);
d->mainLayout = new QGraphicsLinearLayout(Qt::Horizontal); d->mainLayout = new QGraphicsLinearLayout(Qt::Horizontal);
d->mainLayout->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
d->mainLayout->addItem(d->tabWidgetLayout); d->mainLayout->addItem(d->tabWidgetLayout);
setLayout(d->mainLayout); setLayout(d->mainLayout);
@ -259,13 +251,13 @@ int TabBar::insertTab(int index, const QIcon &icon, const QString &label,
QGraphicsLayoutItem *content) QGraphicsLayoutItem *content)
{ {
QGraphicsWidget *page = new QGraphicsWidget(this); QGraphicsWidget *page = new QGraphicsWidget(this);
page->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred); page->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
if (content) { if (content) {
if (content->isLayout()) { if (content->isLayout()) {
page->setLayout(static_cast<QGraphicsLayout *>(content)); page->setLayout(static_cast<QGraphicsLayout *>(content));
} else { } else {
QGraphicsLinearLayout *layout = new QGraphicsLinearLayout(Qt::Vertical, page); QGraphicsLinearLayout *layout = new QGraphicsLinearLayout(Qt::Vertical, page);
layout->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred); layout->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
layout->addItem(content); layout->addItem(content);
page->setLayout(layout); page->setLayout(layout);
} }
@ -402,6 +394,7 @@ void TabBar::setCurrentIndex(int index)
} }
d->currentIndex = index; d->currentIndex = index;
emit currentChanged(index);
d->tabProxy->native->setCurrentIndex(index); d->tabProxy->native->setCurrentIndex(index);
} }

View File

@ -231,8 +231,6 @@ protected:
private: private:
TabBarPrivate * const d; TabBarPrivate * const d;
friend class TabBarPrivate;
Q_PRIVATE_SLOT(d, void slidingCompleted(QGraphicsItem *item)) Q_PRIVATE_SLOT(d, void slidingCompleted(QGraphicsItem *item))
Q_PRIVATE_SLOT(d, void shapeChanged(const QTabBar::Shape shape)) Q_PRIVATE_SLOT(d, void shapeChanged(const QTabBar::Shape shape))
Q_PRIVATE_SLOT(d, void setPalette()) Q_PRIVATE_SLOT(d, void setPalette())