parent
e1f0d994fd
commit
ac1e8a4efe
@ -81,6 +81,7 @@ Fixed
|
|||||||
- Completion highlighting now works again on Qt 5.11.3 and 5.12.1.
|
- Completion highlighting now works again on Qt 5.11.3 and 5.12.1.
|
||||||
- The outdated header `X-Do-Not-Track` is no longer sent.
|
- The outdated header `X-Do-Not-Track` is no longer sent.
|
||||||
- A javascript error on page load when using Qt 5.12 was fixed.
|
- A javascript error on page load when using Qt 5.12 was fixed.
|
||||||
|
- `window.print()` works with Qt 5.12 now.
|
||||||
|
|
||||||
v1.5.2
|
v1.5.2
|
||||||
------
|
------
|
||||||
|
@ -927,6 +927,10 @@ class _WebEngineScripts(QObject):
|
|||||||
utils.read_file('javascript/webelem.js'),
|
utils.read_file('javascript/webelem.js'),
|
||||||
utils.read_file('javascript/caret.js'),
|
utils.read_file('javascript/caret.js'),
|
||||||
)
|
)
|
||||||
|
if not qtutils.version_check('5.12'):
|
||||||
|
# WORKAROUND for Qt versions < 5.12 not exposing window.print().
|
||||||
|
# Qt 5.12 has a printRequested() signal so we don't need this hack
|
||||||
|
# anymore.
|
||||||
self._inject_early_js('js',
|
self._inject_early_js('js',
|
||||||
utils.read_file('javascript/print.js'),
|
utils.read_file('javascript/print.js'),
|
||||||
subframes=True,
|
subframes=True,
|
||||||
@ -1418,15 +1422,20 @@ class WebEngineTab(browsertab.AbstractTab):
|
|||||||
if not qtutils.version_check('5.11.1', compiled=False):
|
if not qtutils.version_check('5.11.1', compiled=False):
|
||||||
self.settings.update_for_url(url)
|
self.settings.update_for_url(url)
|
||||||
|
|
||||||
|
@pyqtSlot()
|
||||||
|
def _on_print_requested(self):
|
||||||
|
"""Slot for window.print() in JS."""
|
||||||
|
try:
|
||||||
|
self.printing.show_dialog()
|
||||||
|
except browsertab.WebTabError as e:
|
||||||
|
message.error(str(e))
|
||||||
|
|
||||||
@pyqtSlot(usertypes.NavigationRequest)
|
@pyqtSlot(usertypes.NavigationRequest)
|
||||||
def _on_navigation_request(self, navigation):
|
def _on_navigation_request(self, navigation):
|
||||||
super()._on_navigation_request(navigation)
|
super()._on_navigation_request(navigation)
|
||||||
|
|
||||||
if navigation.url == QUrl('qute://print'):
|
if navigation.url == QUrl('qute://print'):
|
||||||
try:
|
self._on_print_requested()
|
||||||
self.printing.show_dialog()
|
|
||||||
except browsertab.WebTabError as e:
|
|
||||||
message.error(str(e))
|
|
||||||
navigation.accepted = False
|
navigation.accepted = False
|
||||||
|
|
||||||
if not navigation.accepted or not navigation.is_main_frame:
|
if not navigation.accepted or not navigation.is_main_frame:
|
||||||
@ -1472,6 +1481,11 @@ class WebEngineTab(browsertab.AbstractTab):
|
|||||||
self._on_proxy_authentication_required)
|
self._on_proxy_authentication_required)
|
||||||
page.contentsSizeChanged.connect(self.contents_size_changed)
|
page.contentsSizeChanged.connect(self.contents_size_changed)
|
||||||
page.navigation_request.connect(self._on_navigation_request)
|
page.navigation_request.connect(self._on_navigation_request)
|
||||||
|
try:
|
||||||
|
page.printRequested.connect(self._on_print_requested)
|
||||||
|
except AttributeError:
|
||||||
|
# Added in Qt 5.12
|
||||||
|
pass
|
||||||
|
|
||||||
view.titleChanged.connect(self.title_changed)
|
view.titleChanged.connect(self.title_changed)
|
||||||
view.urlChanged.connect(self._on_url_changed)
|
view.urlChanged.connect(self._on_url_changed)
|
||||||
|
Loading…
Reference in New Issue
Block a user