Implement scroll speed slider

This commit is contained in:
BasioMeusPuga
2018-03-27 21:58:35 +05:30
parent d417a94829
commit 5fa724ae69
5 changed files with 75 additions and 4 deletions

View File

@@ -114,7 +114,8 @@ class Tab(QtWidgets.QWidget):
# the graphics view
self.contentView.setFrameShape(QtWidgets.QFrame.NoFrame)
self.contentView.setObjectName('contentView')
self.contentView.verticalScrollBar().setSingleStep(7)
self.contentView.verticalScrollBar().setSingleStep(
self.main_window.settings['scroll_speed'])
if self.main_window.settings['hide_scrollbars']:
self.contentView.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
@@ -193,10 +194,13 @@ class Tab(QtWidgets.QWidget):
search_text = search_data[1]
if search_text:
# textCursor() RETURNS a copy of the textcursor
cursor = self.contentView.textCursor()
cursor.movePosition(QtGui.QTextCursor.Start, QtGui.QTextCursor.KeepAnchor)
self.contentView.setTextCursor(cursor)
# This is needed so that search results are always at the top
# of the window
self.contentView.verticalScrollBar().setValue(
self.contentView.verticalScrollBar().maximum())