do the proper animation when deleting the current tab

svn path=/trunk/KDE/kdelibs/; revision=1147189
This commit is contained in:
Giulio Camuffo 2010-07-07 15:17:48 +00:00
parent 3cf1e32282
commit 93a955c984

View File

@ -452,22 +452,24 @@ void TabBar::removeTab(int index)
int oldCurrentIndex = d->tabProxy->native->currentIndex();
d->tabProxy->native->removeTab(index);
QGraphicsWidget *page = d->pages.takeAt(index);
d->currentIndex = oldCurrentIndex;
int currentIndex = d->tabProxy->native->currentIndex();
if (oldCurrentIndex == index) {
d->tabWidgetLayout->removeAt(1);
if (d->tabProxy->native->count() > 0) {
setCurrentIndex(currentIndex >= oldCurrentIndex ? currentIndex + 1 : currentIndex);
}
}
QGraphicsWidget *page = d->pages.takeAt(index);
scene()->removeItem(page);
page->deleteLater();
if (oldCurrentIndex != currentIndex) {
setCurrentIndex(currentIndex);
if (d->pages.count() > 0) {
d->updateTabWidgetMode();
}
d->updateTabWidgetMode();
d->tabProxy->setPreferredSize(d->tabProxy->native->sizeHint());
}