diff --git a/src/plugins/coreplugin/fancytabwidget.cpp b/src/plugins/coreplugin/fancytabwidget.cpp index 0d73ad604ba192b593066b5f0c3a6735f61db9cf..4bfcdd626f82b924dbd6753a50270fbf0ed694ec 100644 --- a/src/plugins/coreplugin/fancytabwidget.cpp +++ b/src/plugins/coreplugin/fancytabwidget.cpp @@ -82,6 +82,10 @@ FancyTabBar::FancyTabBar(QWidget *parent) setAttribute(Qt::WA_Hover, true); setFocusPolicy(Qt::NoFocus); setMouseTracking(true); // Needed for hover events + m_triggerTimer.setSingleShot(true); + + // We use a zerotimer to keep the sidebar responsive + connect(&m_triggerTimer, SIGNAL(timeout()), this, SLOT(emitCurrentIndex())); } FancyTabBar::~FancyTabBar() @@ -136,7 +140,6 @@ void FancyTabBar::mouseMoveEvent(QMouseEvent *e) if (validIndex(m_hoverIndex)) { m_tabs[m_hoverIndex]->fadeIn(); - QRect oldHoverRect = m_hoverRect; m_hoverRect = tabRect(m_hoverIndex); } } @@ -207,6 +210,14 @@ QRect FancyTabBar::tabRect(int index) const } +// This keeps the sidebar responsive since +// we get a repaint before loading the +// mode itself +void FancyTabBar::emitCurrentIndex() +{ + emit currentChanged(m_currentIndex); +} + void FancyTabBar::mousePressEvent(QMouseEvent *e) { e->accept(); @@ -269,15 +280,21 @@ void FancyTabBar::paintTab(QPainter *painter, int tabIndex) const painter->save(); QColor whiteOverlay(Qt::white); whiteOverlay.setAlpha(int(m_tabs[tabIndex]->fader()/2)); - QRect roundRect = rect.adjusted(5, 3, -5, -3); + painter->fillRect(rect, whiteOverlay); + painter->setPen(whiteOverlay); + painter->drawLine(rect.topLeft(), rect.topRight()); + painter->drawLine(rect.bottomLeft(), rect.bottomRight()); + + /* QRect roundRect = rect.adjusted(5, 3, -5, -3); painter->translate(0.5, 0.5); painter->setRenderHint(QPainter::Antialiasing); painter->setBrush(whiteOverlay); whiteOverlay.setAlpha(int(m_tabs[tabIndex]->fader())); painter->setPen(whiteOverlay); painter->drawRoundedRect(roundRect, 3, 3); +*/ painter->restore(); - } + } } QString tabText(this->tabText(tabIndex)); @@ -312,7 +329,7 @@ void FancyTabBar::setCurrentIndex(int index) { if (isTabEnabled(index)) { m_currentIndex = index; update(); - emit currentChanged(index); + m_triggerTimer.start(0); } } diff --git a/src/plugins/coreplugin/fancytabwidget.h b/src/plugins/coreplugin/fancytabwidget.h index 7f5146721e29d721a2c077bf428499cf631578fe..8af2839670fe24447943742772e414b581ced6bf 100644 --- a/src/plugins/coreplugin/fancytabwidget.h +++ b/src/plugins/coreplugin/fancytabwidget.h @@ -34,6 +34,7 @@ #include <QtGui/QTabBar> #include <QtGui/QStyleOptionTabV2> #include <QtCore/QTimeLine> +#include <QtCore/QTimer> QT_BEGIN_NAMESPACE class QPainter; @@ -116,6 +117,7 @@ signals: public slots: void updateHover(); + void emitCurrentIndex(); private: static const int m_rounding; @@ -124,7 +126,7 @@ private: int m_hoverIndex; int m_currentIndex; QList<FancyTab*> m_tabs; - + QTimer m_triggerTimer; QSize tabSizeHint(bool minimum = false) const; }; diff --git a/src/plugins/coreplugin/progressmanager/progressmanager_win.cpp b/src/plugins/coreplugin/progressmanager/progressmanager_win.cpp index db99d1b850b88391ba997db7ba54a523ed282a08..c2aa324407ba7cd6e7367aeceae9142a92ea4f68 100644 --- a/src/plugins/coreplugin/progressmanager/progressmanager_win.cpp +++ b/src/plugins/coreplugin/progressmanager/progressmanager_win.cpp @@ -1,4 +1,4 @@ -/************************************************************************** +************************************************************************** ** ** This file is part of Qt Creator **