summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSamuel Rødal <samuel.rodal@nokia.com>2011-03-04 09:29:46 (GMT)
committerQt Commercial Integration <QtCommercial@digia.com>2012-01-31 10:24:57 (GMT)
commitd8aaa1866f7bf58992c8578704ffd66627c2e59d (patch)
treeec261c4a11d9c523d02655b78c65a09663b9e74a /src
parentfbd7d47cf41400e0b0f5e8aedee9b0ef67f2f5d5 (diff)
downloadQt-d8aaa1866f7bf58992c8578704ffd66627c2e59d.zip
Qt-d8aaa1866f7bf58992c8578704ffd66627c2e59d.tar.gz
Qt-d8aaa1866f7bf58992c8578704ffd66627c2e59d.tar.bz2
Fail in a nicer way when QPixmap is used in a non-GUI application.
Show same fatal message as when trying to instantiate a QWidget. Task-number: QTBUG-17873 Reviewed-by: Gunnar Sletta
Diffstat (limited to 'src')
-rw-r--r--src/gui/image/qpixmap.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/gui/image/qpixmap.cpp b/src/gui/image/qpixmap.cpp
index ee79416..5ed351d 100644
--- a/src/gui/image/qpixmap.cpp
+++ b/src/gui/image/qpixmap.cpp
@@ -112,8 +112,13 @@ void QPixmap::init(int w, int h, Type type)
init(w, h, int(type));
}
+extern QApplication::Type qt_appType;
+
void QPixmap::init(int w, int h, int type)
{
+ if (qt_appType == QApplication::Tty)
+ qFatal("QPixmap: Cannot create a QPixmap when no GUI is being used");
+
if ((w > 0 && h > 0) || type == QPixmapData::BitmapType)
data = QPixmapData::create(w, h, (QPixmapData::PixelType) type);
else