diff options
author | Samuel Rødal <samuel.rodal@nokia.com> | 2011-03-04 09:29:46 (GMT) |
---|---|---|
committer | Samuel Rødal <samuel.rodal@nokia.com> | 2011-03-04 11:28:25 (GMT) |
commit | a3a79fefe65ec12c4c34a69885c2d23d79538a97 (patch) | |
tree | c980b22c1883d27103cef1ebdecc39c257e7bd10 /src/gui/image/qpixmap.cpp | |
parent | c0ef39aaf2836ef5988e25a219f9bcbff2319ad2 (diff) | |
download | Qt-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.cpp | 5 |
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 |