Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
nheko
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Nheko Reborn
nheko
Commits
343acaf4
Commit
343acaf4
authored
7 years ago
by
Konstantinos Sideris
Browse files
Options
Downloads
Patches
Plain Diff
Remove opacity animation from the scrollbar
fixes #270
parent
511c58d6
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
include/ui/ScrollBar.h
+1
-12
1 addition, 12 deletions
include/ui/ScrollBar.h
src/ui/ScrollBar.cc
+1
-49
1 addition, 49 deletions
src/ui/ScrollBar.cc
with
2 additions
and
61 deletions
include/ui/ScrollBar.h
+
1
−
12
View file @
343acaf4
...
...
@@ -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_
;
...
...
This diff is collapsed.
Click to expand it.
src/ui/ScrollBar.cc
+
1
−
49
View file @
343acaf4
...
...
@@ -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
*
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment