summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/gui/dialogs/qprintdialog_win.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/gui/dialogs/qprintdialog_win.cpp b/src/gui/dialogs/qprintdialog_win.cpp
index 1a3d2de..f66c27f 100644
--- a/src/gui/dialogs/qprintdialog_win.cpp
+++ b/src/gui/dialogs/qprintdialog_win.cpp
@@ -131,8 +131,8 @@ static void qt_win_setup_PRINTDLGEX(PRINTDLGEX *pd, QWidget *parent,
if (d->ep->printToFile)
pd->Flags |= PD_PRINTTOFILE;
- Q_ASSERT(!parent ||parent->testAttribute(Qt::WA_WState_Created));
- pd->hwndOwner = parent ? parent->winId() : 0;
+ Q_ASSERT(parent != 0 && parent->testAttribute(Qt::WA_WState_Created));
+ pd->hwndOwner = parent->winId();
pd->lpPageRanges[0].nFromPage = qMax(pdlg->fromPage(), pdlg->minPage());
pd->lpPageRanges[0].nToPage = (pdlg->toPage() > 0) ? qMin(pdlg->toPage(), pdlg->maxPage()) : 1;
pd->nCopies = d->ep->num_copies;
@@ -212,6 +212,10 @@ int QPrintDialogPrivate::openWindowsPrintDialogModally()
else
parent = QApplication::activeWindow();
+ // If there is no window, fall back to the print dialog itself
+ if (parent == 0)
+ parent = q;
+
QWidget modal_widget;
modal_widget.setAttribute(Qt::WA_NoChildEventsForParent, true);
modal_widget.setParent(parent, Qt::Window);