commands: Implement scrollstart and scrollend
This commit is contained in:
parent
8ca98da6c4
commit
bba3696630
@ -64,5 +64,9 @@ class QuteBrowser(QApplication):
|
||||
cmds['scrollleft'].signal.connect(self.mainwindow.tabs.scroll_left_act)
|
||||
cmds['scrollright'].signal.connect(
|
||||
self.mainwindow.tabs.scroll_right_act)
|
||||
cmds['scrollstart'].signal.connect(
|
||||
self.mainwindow.tabs.scroll_start_act)
|
||||
cmds['scrollend'].signal.connect(
|
||||
self.mainwindow.tabs.scroll_end_act)
|
||||
cmds['undo'].signal.connect(self.mainwindow.tabs.undo_close)
|
||||
self.keyparser.from_cmd_dict(cmdutils.cmd_dict)
|
||||
|
@ -81,3 +81,13 @@ class Undo(Command):
|
||||
nargs = 0
|
||||
key = 'u'
|
||||
signal = pyqtSignal()
|
||||
|
||||
class ScrollStart(Command):
|
||||
nargs = 0
|
||||
key = 'g, g'
|
||||
signal = pyqtSignal()
|
||||
|
||||
class ScrollEnd(Command):
|
||||
nargs = 0
|
||||
key = 'Shift+g'
|
||||
signal = pyqtSignal()
|
||||
|
@ -1,4 +1,4 @@
|
||||
from PyQt5.QtCore import QObject, pyqtSlot, QUrl, pyqtSignal, Qt
|
||||
from PyQt5.QtCore import QObject, pyqtSlot, QUrl, pyqtSignal, Qt, QPoint
|
||||
from PyQt5.QtPrintSupport import QPrintPreviewDialog
|
||||
from PyQt5.QtWebKitWidgets import QWebView
|
||||
from qutebrowser.widgets.tabbar import TabWidget
|
||||
@ -93,6 +93,19 @@ class TabbedBrowser(TabWidget):
|
||||
def scroll_right_act(self, count=50):
|
||||
self.currentWidget().page().mainFrame().scroll(count, 0)
|
||||
|
||||
@pyqtSlot()
|
||||
def scroll_start_act(self):
|
||||
frame = self.currentWidget().page().mainFrame()
|
||||
cur_pos = frame.scrollPosition()
|
||||
frame.setScrollPosition(QPoint(cur_pos.x(), 0))
|
||||
|
||||
@pyqtSlot()
|
||||
def scroll_end_act(self):
|
||||
frame = self.currentWidget().page().mainFrame()
|
||||
cur_pos = frame.scrollPosition()
|
||||
size = frame.contentsSize()
|
||||
frame.setScrollPosition(QPoint(cur_pos.x(), size.height()))
|
||||
|
||||
@pyqtSlot()
|
||||
def switch_prev(self):
|
||||
idx = self.currentIndex()
|
||||
|
Loading…
Reference in New Issue
Block a user