summaryrefslogtreecommitdiffstats
path: root/src/gui/widgets/qtabbar.cpp
diff options
context:
space:
mode:
authorGabriel de Dietrich <gabriel.dietrich-de@nokia.com>2010-04-23 08:22:44 (GMT)
committerGabriel de Dietrich <gabriel.dietrich-de@nokia.com>2010-04-23 09:18:52 (GMT)
commit4743831d128dfad4ac9fbafa6e7544dbe7fb7ed2 (patch)
treebdf4fbcd035ac238efa1eb73bc60fd5105d7e2d0 /src/gui/widgets/qtabbar.cpp
parent66da5958bc3ec0df60e76bb32ead94bfe7b2eac7 (diff)
downloadQt-4743831d128dfad4ac9fbafa6e7544dbe7fb7ed2.zip
Qt-4743831d128dfad4ac9fbafa6e7544dbe7fb7ed2.tar.gz
Qt-4743831d128dfad4ac9fbafa6e7544dbe7fb7ed2.tar.bz2
QTabBar: Widgets inside the tab bar where not properly laid out after moveTab()
Only the leftmost tab was being correctly laid out after the move due to a mistake in QTabBarPrivate::layoutTab(). Auto-test included. Reviewed-by: Thierry Task-number: QTBUG-10052
Diffstat (limited to 'src/gui/widgets/qtabbar.cpp')
-rw-r--r--src/gui/widgets/qtabbar.cpp15
1 files changed, 5 insertions, 10 deletions
diff --git a/src/gui/widgets/qtabbar.cpp b/src/gui/widgets/qtabbar.cpp
index 7559311..d03a2f4 100644
--- a/src/gui/widgets/qtabbar.cpp
+++ b/src/gui/widgets/qtabbar.cpp
@@ -580,16 +580,10 @@ void QTabBarPrivate::layoutTab(int index)
}
}
-void QTabBarPrivate::layoutWidgets(int index)
+void QTabBarPrivate::layoutWidgets(int start)
{
Q_Q(QTabBar);
- int start = 0;
- int end = q->count();
- if (index != -1) {
- start = qMax(index, 0);
- end = qMin(end, start + 1);
- }
- for (int i = start; i < end; ++i) {
+ for (int i = start; i < q->count(); ++i) {
layoutTab(i);
}
}
@@ -1171,8 +1165,9 @@ void QTabBar::setCurrentIndex(int index)
update();
d->makeVisible(index);
d->tabList[index].lastTab = oldIndex;
- d->layoutWidgets(oldIndex);
- d->layoutWidgets(index);
+ if (oldIndex >= 0 && oldIndex < count())
+ d->layoutTab(oldIndex);
+ d->layoutTab(index);
#ifdef QT3_SUPPORT
emit selected(index);
#endif