Details
-
Bug
-
Resolution: Done
-
P3: Somewhat important
-
4.6.0, 4.6.1, 4.6.2
-
None
-
6d6df0e2b63f0103ec1f19b4b856b106e295d618
Description
Problem:
When QPrintDialog has no parent visible or has no parent + is a top widget, it returns a Q_ASSERT error in debug mode when exec(). (It shouldn't even so QPrintDialog being a top level widget with no parent is not the expected behavior)
Code to reproduce:
#include <QtGui>
int main(int argc, char** argv)
{
QApplication application(argc, argv);
QPrintDialog print_dialog;
print_dialog.exec();
return 0;
}
Suggested patch:
diff --git a/src/gui/dialogs/qprintdialog_win.cpp b/src/gui/dialogs/qprintdialog
_win.cpp
index 12edf7c..4cf274c 100644
— a/src/gui/dialogs/qprintdialog_win.cpp
+++ b/src/gui/dialogs/qprintdialog_win.cpp
@@ -138,7 +138,7 @@ static void qt_win_setup_PRINTDLGEX(PRINTDLGEX *pd, QWidget
*parent,
if (d->ep->printToFile)
pd->Flags |= PD_PRINTTOFILE;
- Q_ASSERT(parent != 0 && parent->testAttribute(Qt::WA_WState_Created));
+ //Q_ASSERT(parent != 0 && parent->testAttribute(Qt::WA_WState_Created));
pd->hwndOwner = parent->window()->winId();
pd->lpPageRanges[0].nFromPage = qMax(pdlg->fromPage(), pdlg->minPage());
pd->lpPageRanges[0].nToPage = (pdlg->toPage() > 0) ? qMin(pdlg->toPage(),
pdlg->maxPage()) : 1;