diff options
-rw-r--r-- | src/gui/widgets/qtabbar.cpp | 3 | ||||
-rw-r--r-- | tests/auto/qtabbar/tst_qtabbar.cpp | 34 |
2 files changed, 36 insertions, 1 deletions
diff --git a/src/gui/widgets/qtabbar.cpp b/src/gui/widgets/qtabbar.cpp index 5166390..d8246c8 100644 --- a/src/gui/widgets/qtabbar.cpp +++ b/src/gui/widgets/qtabbar.cpp @@ -1836,7 +1836,8 @@ void QTabBarPrivate::moveTabFinished(int index) } #endif //QT_NO_ANIMATION if (allAnimationsFinished && cleanup) { - movingTab->setVisible(false); // We might not get a mouse release + if(movingTab) + movingTab->setVisible(false); // We might not get a mouse release for (int i = 0; i < tabList.count(); ++i) { tabList[i].dragOffset = 0; } diff --git a/tests/auto/qtabbar/tst_qtabbar.cpp b/tests/auto/qtabbar/tst_qtabbar.cpp index 041836c..3f77b7a 100644 --- a/tests/auto/qtabbar/tst_qtabbar.cpp +++ b/tests/auto/qtabbar/tst_qtabbar.cpp @@ -94,6 +94,7 @@ private slots: void moveTab(); void task251184_removeTab(); + void changeTitleWhileDoubleClickingTab(); }; // Testing get/set functions @@ -535,5 +536,38 @@ void tst_QTabBar::task251184_removeTab() } +class TitleChangeTabBar : public QTabBar +{ + Q_OBJECT + + QTimer timer; + int count; + +public: + TitleChangeTabBar(QWidget * parent = 0) : QTabBar(parent), count(0) + { + setMovable(true); + addTab("0"); + connect(&timer, SIGNAL(timeout()), this, SLOT(updateTabText())); + timer.start(1); + } + +public slots: + void updateTabText() + { + count++; + setTabText(0, QString("%1").arg(count)); + } +}; + +void tst_QTabBar::changeTitleWhileDoubleClickingTab() +{ + TitleChangeTabBar bar; + QPoint tabPos = bar.tabRect(0).center(); + + for(int i=0; i < 10; i++) + QTest::mouseDClick(&bar, Qt::LeftButton, 0, tabPos); +} + QTEST_MAIN(tst_QTabBar) #include "tst_qtabbar.moc" |