QWidgetPrivate::init(): clarify that QWidget requires QApplication

Task-number: QTBUG-28076
Change-Id: Ica9713894c18bb43ae817a6dd42be087b23fa8c2
Reviewed-by: Jing Bai <jing.bai@digia.com>
This commit is contained in:
J-P Nurmi 2012-11-22 12:54:51 +01:00 committed by The Qt Project
parent 7ff393944e
commit 91fa2e0a53

View File

@ -1088,8 +1088,8 @@ void QWidgetPrivate::adjustFlags(Qt::WindowFlags &flags, QWidget *w)
void QWidgetPrivate::init(QWidget *parentWidget, Qt::WindowFlags f) void QWidgetPrivate::init(QWidget *parentWidget, Qt::WindowFlags f)
{ {
Q_Q(QWidget); Q_Q(QWidget);
if (QApplication::type() == QApplication::Tty) if (!qobject_cast<QApplication *>(QCoreApplication::instance()))
qFatal("QWidget: Cannot create a QWidget when no GUI is being used"); qFatal("QWidget: Cannot create a QWidget without QApplication");
Q_ASSERT(allWidgets); Q_ASSERT(allWidgets);
if (allWidgets) if (allWidgets)