Delete print dialogs on close

This commit is contained in:
Florian Bruhin 2014-06-17 14:33:15 +02:00
parent 2388874e82
commit 4a0e34fca7
2 changed files with 5 additions and 1 deletions

View File

@ -204,6 +204,7 @@ class CommandDispatcher:
tab = self._tabs.cntwidget(count)
if tab is not None:
preview = QPrintPreviewDialog()
preview.setAttribute(Qt.WA_DeleteOnClose)
preview.paintRequested.connect(tab.print)
preview.exec_()
@ -220,6 +221,7 @@ class CommandDispatcher:
tab = self._tabs.cntwidget(count)
if tab is not None:
printdiag = QPrintDialog()
printdiag.setAttribute(Qt.WA_DeleteOnClose)
printdiag.open(lambda: tab.print(printdiag.printer()))
@cmdutils.register(instance='mainwindow.tabs.cmd')

View File

@ -18,7 +18,8 @@
"""The main browser widgets."""
import sip
from PyQt5.QtCore import QCoreApplication, pyqtSignal, pyqtSlot, PYQT_VERSION
from PyQt5.QtCore import (QCoreApplication, pyqtSignal, pyqtSlot, PYQT_VERSION,
Qt)
from PyQt5.QtNetwork import QNetworkReply
from PyQt5.QtWidgets import QFileDialog
from PyQt5.QtPrintSupport import QPrintDialog
@ -149,6 +150,7 @@ class BrowserPage(QWebPage):
"please upgrade!")
return
printdiag = QPrintDialog()
printdiag.setAttribute(Qt.WA_DeleteOnClose)
printdiag.open(lambda: frame.print(printdiag.printer()))
@pyqtSlot('QNetworkRequest')