From e9f33fb8d3cfc0a27434412fdbb1d3fac5ea2db9 Mon Sep 17 00:00:00 2001 From: Jens Bache-Wiig <jbache@trolltech.com> Date: Mon, 8 Mar 2010 15:05:55 +0100 Subject: [PATCH] Fix examples failing to open After fixing the sidebar to use delayed update, code that relied on setCurrentItem could break since the state was not set asyncronously. This fixes it by only making mouseClick delayed, while setCurrentIndex works as before when set programatically. Reviewed-by: Lasse Holmstedt --- src/plugins/coreplugin/fancytabwidget.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/plugins/coreplugin/fancytabwidget.cpp b/src/plugins/coreplugin/fancytabwidget.cpp index c4ddb168512..d3656b07890 100644 --- a/src/plugins/coreplugin/fancytabwidget.cpp +++ b/src/plugins/coreplugin/fancytabwidget.cpp @@ -216,9 +216,14 @@ void FancyTabBar::emitCurrentIndex() void FancyTabBar::mousePressEvent(QMouseEvent *e) { e->accept(); - for (int i = 0; i < m_tabs.count(); ++i) { - if (tabRect(i).contains(e->pos())) { - setCurrentIndex(i); + for (int index = 0; index < m_tabs.count(); ++index) { + if (tabRect(index).contains(e->pos())) { + + if (isTabEnabled(index)) { + m_currentIndex = index; + update(); + m_triggerTimer.start(0); + } break; } } @@ -313,7 +318,7 @@ void FancyTabBar::setCurrentIndex(int index) { if (isTabEnabled(index)) { m_currentIndex = index; update(); - m_triggerTimer.start(0); + emit currentChanged(m_currentIndex); } } -- GitLab