diff --git a/src/plugins/coreplugin/fancytabwidget.cpp b/src/plugins/coreplugin/fancytabwidget.cpp index 9336e464f29af28c307283b897734ad12287f06a..2822c614bc39eeb12b5105d670ec6263ed235045 100644 --- a/src/plugins/coreplugin/fancytabwidget.cpp +++ b/src/plugins/coreplugin/fancytabwidget.cpp @@ -55,20 +55,18 @@ const int FancyTabBar::m_textPadding = 4; void FancyTab::fadeIn() { - QPropertyAnimation *animation; - animation = new QPropertyAnimation(this, "fader"); - animation->setDuration(70); - animation->setEndValue(50); - animation->start(QAbstractAnimation::DeleteWhenStopped); + animator.stop(); + animator.setDuration(80); + animator.setEndValue(40); + animator.start(); } void FancyTab::fadeOut() { - QPropertyAnimation *animation; - animation = new QPropertyAnimation(this, "fader"); - animation->setDuration(200); - animation->setEndValue(0); - animation->start(QAbstractAnimation::DeleteWhenStopped); + animator.stop(); + animator.setDuration(160); + animator.setEndValue(0); + animator.start(); } FancyTabBar::FancyTabBar(QWidget *parent) @@ -176,14 +174,11 @@ void FancyTabBar::enterEvent(QEvent *e) void FancyTabBar::leaveEvent(QEvent *e) { Q_UNUSED(e) - if (validIndex(m_hoverIndex)) { - m_hoverIndex = -1; - update(m_hoverRect); - m_hoverRect = QRect(); - for (int i = 0 ; i < m_tabs.count() ; ++i) { - if (m_tabs[i]->fader() > 0) - m_tabs[i]->fadeOut(); - } + m_hoverIndex = -1; + update(m_hoverRect); + m_hoverRect = QRect(); + for (int i = 0 ; i < m_tabs.count() ; ++i) { + m_tabs[i]->fadeOut(); } } @@ -245,9 +240,6 @@ void FancyTabBar::paintTab(QPainter *painter, int tabIndex) const hover = false; // Do not hover on Mac #endif - QColor hoverColor; - hoverColor = QColor(255, 255, 255, m_tabs[tabIndex]->fader()); - if (selected) { //background painter->fillRect(rect, QColor(220, 220, 220)); @@ -293,7 +285,7 @@ void FancyTabBar::paintTab(QPainter *painter, int tabIndex) const } else { painter->setPen(selected ? Utils::StyleHelper::panelTextColor() : QColor(255, 255, 255, 120)); } - +#ifndef Q_WS_MAC if (!selected && enabled) { painter->save(); int fader = int(m_tabs[tabIndex]->fader()); @@ -307,7 +299,7 @@ void FancyTabBar::paintTab(QPainter *painter, int tabIndex) const painter->drawLine(rect.bottomLeft(), rect.bottomRight()); painter->restore(); } - +#endif int textHeight = painter->fontMetrics().boundingRect(QRect(0, 0, width(), height()), Qt::TextWordWrap, tabText).height(); tabIconRect.adjust(0, 4, 0, -textHeight); int iconSize = qMin(tabIconRect.width(), tabIconRect.height()); diff --git a/src/plugins/coreplugin/fancytabwidget.h b/src/plugins/coreplugin/fancytabwidget.h index 8af2839670fe24447943742772e414b581ced6bf..0ad179cbac50b4605215c0697cbcefbbb8448d6c 100644 --- a/src/plugins/coreplugin/fancytabwidget.h +++ b/src/plugins/coreplugin/fancytabwidget.h @@ -35,7 +35,7 @@ #include <QtGui/QStyleOptionTabV2> #include <QtCore/QTimeLine> #include <QtCore/QTimer> - +#include <QtCore/QPropertyAnimation> QT_BEGIN_NAMESPACE class QPainter; class QStackedLayout; @@ -50,7 +50,10 @@ class FancyTab : public QObject{ Q_PROPERTY(float fader READ fader WRITE setFader) public: - FancyTab(QWidget *tabbar) : enabled(false), tabbar(tabbar), m_fader(0) {} + FancyTab(QWidget *tabbar) : enabled(false), tabbar(tabbar), m_fader(0) { + animator.setPropertyName("fader"); + animator.setTargetObject(this); + } float fader() { return m_fader; } void setFader(float value) { m_fader = value; tabbar->update(); } @@ -61,7 +64,9 @@ public: QString text; QString toolTip; bool enabled; + private: + QPropertyAnimation animator; QWidget *tabbar; float m_fader; }; diff --git a/src/plugins/projectexplorer/projectexplorer.cpp b/src/plugins/projectexplorer/projectexplorer.cpp index 051f5241a6e506adcaa8632e853bb4997038ccc9..5b96347f55497130e105cef24fd5b8a108c755b5 100644 --- a/src/plugins/projectexplorer/projectexplorer.cpp +++ b/src/plugins/projectexplorer/projectexplorer.cpp @@ -698,8 +698,7 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er d->m_projectSelectorAction->setEnabled(false); QWidget *mainWindow = Core::ICore::instance()->mainWindow(); d->m_targetSelector = new Internal::MiniProjectTargetSelector(d->m_projectSelectorAction, mainWindow); - d->m_projectSelectorAction->setCheckable(true); - connect(d->m_projectSelectorAction, SIGNAL(toggled(bool)), d->m_targetSelector, SLOT(setVisible(bool))); + connect(d->m_projectSelectorAction, SIGNAL(triggered()), d->m_targetSelector, SLOT(show())); modeManager->addProjectSelector(d->m_projectSelectorAction); cmd = am->registerAction(d->m_projectSelectorAction, ProjectExplorer::Constants::SELECTTARGET,