Use fake-key scrolling for :scroll-perc 0/100.
This commit is contained in:
parent
4dbc4ba93f
commit
9b372de4a9
@ -165,12 +165,17 @@ class CommandDispatcher:
|
|||||||
perc = 100
|
perc = 100
|
||||||
elif perc is None:
|
elif perc is None:
|
||||||
perc = count
|
perc = count
|
||||||
perc = qtutils.check_overflow(perc, 'int', fatal=False)
|
if perc == 0:
|
||||||
frame = self._current_widget().page().currentFrame()
|
self.scroll('top')
|
||||||
m = frame.scrollBarMaximum(orientation)
|
elif perc == 100:
|
||||||
if m == 0:
|
self.scroll('bottom')
|
||||||
return
|
else:
|
||||||
frame.setScrollBarValue(orientation, int(m * perc / 100))
|
perc = qtutils.check_overflow(perc, 'int', fatal=False)
|
||||||
|
frame = self._current_widget().page().currentFrame()
|
||||||
|
m = frame.scrollBarMaximum(orientation)
|
||||||
|
if m == 0:
|
||||||
|
return
|
||||||
|
frame.setScrollBarValue(orientation, int(m * perc / 100))
|
||||||
|
|
||||||
def _tab_move_absolute(self, idx):
|
def _tab_move_absolute(self, idx):
|
||||||
"""Get an index for moving a tab absolutely.
|
"""Get an index for moving a tab absolutely.
|
||||||
@ -616,6 +621,10 @@ class CommandDispatcher:
|
|||||||
press_evt = QKeyEvent(QEvent.KeyPress, key, Qt.NoModifier, 0, 0, 0)
|
press_evt = QKeyEvent(QEvent.KeyPress, key, Qt.NoModifier, 0, 0, 0)
|
||||||
release_evt = QKeyEvent(QEvent.KeyRelease, key, Qt.NoModifier, 0, 0, 0)
|
release_evt = QKeyEvent(QEvent.KeyRelease, key, Qt.NoModifier, 0, 0, 0)
|
||||||
|
|
||||||
|
# Count doesn't make sense with top/bottom
|
||||||
|
if direction in ('top', 'bottom'):
|
||||||
|
count = 1
|
||||||
|
|
||||||
for _ in range(count):
|
for _ in range(count):
|
||||||
widget.keyPressEvent(press_evt)
|
widget.keyPressEvent(press_evt)
|
||||||
widget.keyReleaseEvent(release_evt)
|
widget.keyReleaseEvent(release_evt)
|
||||||
|
Loading…
Reference in New Issue
Block a user