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:
Jens Bache-Wiig
2010-03-08 15:05:55 +01:00
parent 8a73827ca8
commit e9f33fb8d3

View File

@@ -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);
}
}