do the proper animation when deleting the current tab
svn path=/trunk/KDE/kdelibs/; revision=1147189
This commit is contained in:
parent
3cf1e32282
commit
93a955c984
@ -452,22 +452,24 @@ void TabBar::removeTab(int index)
|
|||||||
|
|
||||||
int oldCurrentIndex = d->tabProxy->native->currentIndex();
|
int oldCurrentIndex = d->tabProxy->native->currentIndex();
|
||||||
d->tabProxy->native->removeTab(index);
|
d->tabProxy->native->removeTab(index);
|
||||||
QGraphicsWidget *page = d->pages.takeAt(index);
|
|
||||||
|
|
||||||
|
d->currentIndex = oldCurrentIndex;
|
||||||
int currentIndex = d->tabProxy->native->currentIndex();
|
int currentIndex = d->tabProxy->native->currentIndex();
|
||||||
|
|
||||||
if (oldCurrentIndex == index) {
|
if (oldCurrentIndex == index) {
|
||||||
d->tabWidgetLayout->removeAt(1);
|
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);
|
scene()->removeItem(page);
|
||||||
page->deleteLater();
|
page->deleteLater();
|
||||||
|
|
||||||
if (oldCurrentIndex != currentIndex) {
|
if (d->pages.count() > 0) {
|
||||||
setCurrentIndex(currentIndex);
|
|
||||||
}
|
|
||||||
|
|
||||||
d->updateTabWidgetMode();
|
d->updateTabWidgetMode();
|
||||||
|
}
|
||||||
d->tabProxy->setPreferredSize(d->tabProxy->native->sizeHint());
|
d->tabProxy->setPreferredSize(d->tabProxy->native->sizeHint());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user