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

View File

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