summaryrefslogtreecommitdiffstats
path: root/src/gui/image/qpixmap.cpp
diff options
context:
space:
mode:
authorSamuel Rødal <samuel.rodal@nokia.com>2011-03-04 09:29:46 (GMT)
committerSamuel Rødal <samuel.rodal@nokia.com>2011-03-04 11:28:25 (GMT)
commita3a79fefe65ec12c4c34a69885c2d23d79538a97 (patch)
treec980b22c1883d27103cef1ebdecc39c257e7bd10 /src/gui/image/qpixmap.cpp
parentc0ef39aaf2836ef5988e25a219f9bcbff2319ad2 (diff)
downloadQt-a3a79fefe65ec12c4c34a69885c2d23d79538a97.zip
Qt-a3a79fefe65ec12c4c34a69885c2d23d79538a97.tar.gz
Qt-a3a79fefe65ec12c4c34a69885c2d23d79538a97.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/gui/image/qpixmap.cpp')
-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 f896572..71fb079 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