forked from qt-creator/qt-creator
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
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user