8000 调整正在播放界面歌曲列表控件的滚动速度 · ag-python-qt/Groove@95c5e40 · GitHub
[go: up one dir, main page]

Skip to content

Commit 95c5e40

Browse files
committed
调整正在播放界面歌曲列表控件的滚动速度
1 parent 5614882 commit 95c5e40

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

app/View/playing_interface/song_list_widget.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ def __initWidget(self):
4343
""" initialize widgets """
4444
self.resize(1150 + 60, 800)
4545
self.setViewportMargins(30, 0, 30, 0)
46-
self.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
4746
setStyleSheet(self, 'playing_interface_song_list_widget')
4847

4948
def createSongCards(self):

app/common/smooth_scroll.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
from PyQt5.QtCore import QDateTime, Qt, QTimer, QPoint
77
from PyQt5.QtGui import QWheelEvent
8-
from PyQt5.QtWidgets import QApplication, QScrollArea
8+
from PyQt5.QtWidgets import QApplication, QScrollArea, QAbstractScrollArea
99

1010

1111
class SmoothScroll:
@@ -41,7 +41,7 @@ def setSmoothMode(self, smoothMode):
4141

4242
def wheelEvent(self, e):
4343
if self.smoothMode == SmoothMode.NO_SMOOTH:
44-
self.widget.wheelEvent(e)
44+
QAbstractScrollArea.wheelEvent(self.widget, e)
4545
return
4646

4747
# push current time to queque

app/components/widgets/list_widget.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# coding:utf-8
2-
from common.smooth_scroll import SmoothScroll
2+
from common.smooth_scroll import SmoothScroll, SmoothMode
33
from PyQt5.QtCore import Qt, QPoint
44
from PyQt5.QtGui import QWheelEvent, QCursor
55
from PyQt5.QtWidgets import QApplication, QListWidget
@@ -15,6 +15,8 @@ def __init__(self, parent=None, trigger=False):
1515
self.setVerticalScrollMode(self.ScrollPerPixel)
1616
self.setAttribute(Qt.WA_StyledBackground)
1717
self.smoothScroll = SmoothScroll(self)
18+
self.smoothScroll.acceleration = 1.12
19+
self.smoothScroll.stepRatio = 0.88
1820

1921
if trigger:
2022
self.verticalScrollBar().valueChanged.connect(self.__fakeMoveMouse)

0 commit comments

Comments
 (0)
0