summary refs log tree commit diff
diff options
context:
space:
mode:
authorKonstantinos Sideris <sideris.konstantin@gmail.com>2018-03-16 17:29:21 +0200
committerKonstantinos Sideris <sideris.konstantin@gmail.com>2018-03-16 17:29:21 +0200
commit343acaf43413cc9d3ff9c5a9351d5d4ed578967e (patch)
tree85760c924567e888ae7c56fa90b7625ddddec92f
parentAdd context menu option to save images (diff)
downloadnheko-343acaf43413cc9d3ff9c5a9351d5d4ed578967e.tar.xz
Remove opacity animation from the scrollbar
fixes #270
-rw-r--r--include/ui/ScrollBar.h13
-rw-r--r--src/ui/ScrollBar.cc50
2 files changed, 2 insertions, 61 deletions
diff --git a/include/ui/ScrollBar.h b/include/ui/ScrollBar.h
index 45d5b21f..2b5382aa 100644
--- a/include/ui/ScrollBar.h
+++ b/include/ui/ScrollBar.h
@@ -17,11 +17,9 @@
 
 #pragma once
 
-#include <QGraphicsOpacityEffect>
 #include <QPainter>
 #include <QScrollArea>
 #include <QScrollBar>
-#include <QTimer>
 
 class ScrollBar : public QScrollBar
 {
@@ -32,9 +30,6 @@ class ScrollBar : public QScrollBar
 public:
         ScrollBar(QScrollArea *area, QWidget *parent = nullptr);
 
-        void fadeIn();
-        void fadeOut();
-
         QColor backgroundColor() const { return bgColor_; }
         void setBackgroundColor(QColor &color) { bgColor_ = color; }
 
@@ -43,19 +38,13 @@ public:
 
 protected:
         void paintEvent(QPaintEvent *e) override;
-        void sliderChange(SliderChange change) override;
 
 private:
         int roundRadius_     = 4;
         int handleWidth_     = 7;
         int minHandleHeight_ = 20;
-        bool isActive        = false;
-
-        const int AnimationDuration = 300;
-        const int Padding           = 4;
 
-        QGraphicsOpacityEffect *eff;
-        QTimer hideTimer_;
+        const int Padding = 4;
 
         QScrollArea *area_;
         QRect handle_;
diff --git a/src/ui/ScrollBar.cc b/src/ui/ScrollBar.cc
index 1330ca07..37218a13 100644
--- a/src/ui/ScrollBar.cc
+++ b/src/ui/ScrollBar.cc
@@ -15,60 +15,12 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#include <QDebug>
-#include <QGraphicsOpacityEffect>
-#include <QPropertyAnimation>
-
 #include "ScrollBar.h"
 
 ScrollBar::ScrollBar(QScrollArea *area, QWidget *parent)
   : QScrollBar(parent)
   , area_{area}
-{
-        hideTimer_.setSingleShot(true);
-
-        connect(&hideTimer_, &QTimer::timeout, this, &ScrollBar::fadeOut);
-
-        eff = new QGraphicsOpacityEffect(this);
-        setGraphicsEffect(eff);
-}
-
-void
-ScrollBar::fadeOut()
-{
-        isActive = false;
-
-        QPropertyAnimation *anim = new QPropertyAnimation(eff, "opacity");
-        anim->setDuration(AnimationDuration);
-        anim->setStartValue(1);
-        anim->setEndValue(0);
-        anim->setEasingCurve(QEasingCurve::Linear);
-        anim->start(QPropertyAnimation::DeleteWhenStopped);
-}
-
-void
-ScrollBar::fadeIn()
-{
-        QPropertyAnimation *anim = new QPropertyAnimation(eff, "opacity");
-        anim->setDuration(AnimationDuration);
-        anim->setStartValue(0);
-        anim->setEndValue(1);
-        anim->setEasingCurve(QEasingCurve::Linear);
-        anim->start(QPropertyAnimation::DeleteWhenStopped);
-}
-
-void
-ScrollBar::sliderChange(SliderChange change)
-{
-        if (!isActive)
-                fadeIn();
-
-        hideTimer_.stop();
-        hideTimer_.start(1500);
-        isActive = true;
-
-        QScrollBar::sliderChange(change);
-}
+{}
 
 void
 ScrollBar::paintEvent(QPaintEvent *)