summaryrefslogtreecommitdiffstats
path: root/src/gui/image
diff options
context:
space:
mode:
authorQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2018-04-15 01:00:18 +0200
committerQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2018-04-15 01:00:18 +0200
commit4aa6f54fec9d199f97759945118451c52767b2ce (patch)
tree5dc695cd4718437b5015aaef3a02463c61bc5dc2 /src/gui/image
parent369e7572bac94bb5b83ef881012fdc4a86829496 (diff)
parentd5ac11891d8237ca2f02390ffd0ff103578b520e (diff)
Merge remote-tracking branch 'origin/5.11' into dev
Diffstat (limited to 'src/gui/image')
-rw-r--r--src/gui/image/qpixmap.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/gui/image/qpixmap.cpp b/src/gui/image/qpixmap.cpp
index 4cd8befc1b..4b2334ae52 100644
--- a/src/gui/image/qpixmap.cpp
+++ b/src/gui/image/qpixmap.cpp
@@ -1467,12 +1467,18 @@ QBitmap QPixmap::mask() const
On all platforms the depth of the primary screen will be returned.
+ \note QGuiApplication must be created before calling this function.
+
\sa depth(), QColormap::depth(), {QPixmap#Pixmap Information}{Pixmap Information}
*/
int QPixmap::defaultDepth()
{
- return QGuiApplication::primaryScreen()->depth();
+ QScreen *primary = QGuiApplication::primaryScreen();
+ if (Q_LIKELY(primary))
+ return primary->depth();
+ qWarning("QPixmap: QGuiApplication must be created before calling defaultDepth().");
+ return 0;
}
/*!