Open new tab on Ctrl+click

This commit is contained in:
Florian Bruhin 2014-01-28 08:22:49 +01:00
parent 16645768e6
commit 429d4a6814
2 changed files with 4 additions and 4 deletions

1
TODO
View File

@ -36,7 +36,6 @@ copypaste
All kind of FIXMEs
:bind
docstrings
ctrl+click for new tab
completion code cleanup
Other stuff

View File

@ -195,7 +195,7 @@ class BrowserTab(QWebView):
progress = 0
scroll_pos_changed = pyqtSignal(int, int)
_scroll_pos = (-1, -1)
midbutton = False # if the middle button was pressed
open_new_tab = False # open new tab for the next action
open_tab = pyqtSignal('QUrl')
def __init__(self, parent):
@ -212,7 +212,7 @@ class BrowserTab(QWebView):
return self.load(utils.qurl(url))
def link_handler(self, url):
if self.midbutton:
if self.open_new_tab:
self.open_tab.emit(url)
else:
self.openurl(url)
@ -242,5 +242,6 @@ class BrowserTab(QWebView):
button
"""
if e.type() in [QEvent.MouseButtonPress, QEvent.MouseButtonDblClick]:
self.midbutton = (e.button() == Qt.MidButton)
self.open_new_tab = (e.button() == Qt.MidButton or
e.modifiers() & Qt.ControlModifier)
return super().event(e)