X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/blobdiff_plain/18354deaae117d65525929a1de2337275e454232..b1c9b5126d:/src/selectiontoggle.cpp?ds=sidebyside diff --git a/src/selectiontoggle.cpp b/src/selectiontoggle.cpp index fa10c7559..01cfed0f3 100644 --- a/src/selectiontoggle.cpp +++ b/src/selectiontoggle.cpp @@ -44,6 +44,8 @@ SelectionToggle::SelectionToggle(QWidget* parent) : setIconOverlay(isChecked()); connect(this, SIGNAL(toggled(bool)), this, SLOT(setIconOverlay(bool))); + connect(KGlobalSettings::self(), SIGNAL(iconChanged(int)), + this, SLOT(refreshIcon())); } SelectionToggle::~SelectionToggle() @@ -87,9 +89,27 @@ void SelectionToggle::setVisible(bool visible) bool SelectionToggle::eventFilter(QObject* obj, QEvent* event) { - if ((obj == parent()) && (event->type() == QEvent::Leave)) { - hide(); + if (obj == parent()) { + switch (event->type()) { + case QEvent::Leave: + hide(); + break; + + case QEvent::MouseMove: + if (m_isHovered) { + // Don't forward mouse move events to the viewport, + // otherwise a rubberband selection will be shown when + // clicking on the selection toggle and moving the mouse + // above the viewport. + return true; + } + break; + + default: + break; + } } + return QAbstractButton::eventFilter(obj, event); } @@ -177,12 +197,17 @@ void SelectionToggle::setIconOverlay(bool checked) update(); } +void SelectionToggle::refreshIcon() +{ + setIconOverlay(isChecked()); +} + void SelectionToggle::startFading() { Q_ASSERT(m_fadingTimeLine == 0); const bool animate = KGlobalSettings::graphicEffectsLevel() & KGlobalSettings::SimpleAnimationEffects; - const int duration = animate ? 1500 : 1; + const int duration = animate ? 600 : 1; m_fadingTimeLine = new QTimeLine(duration, this); connect(m_fadingTimeLine, SIGNAL(frameChanged(int)),