summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2016-10-08 17:15:55 +0200
committerLiang Qi <liang.qi@qt.io>2016-10-08 17:15:55 +0200
commit3e71810cf3153e4331fc075a73b6408adcf33654 (patch)
tree9f5fbb7a5dc2a902b380dd69a222c0f2cd6eb760 /src/gui
parent6feec9da93032d11a768802ac2187d9d4153b1ec (diff)
parentebd1046323615f22192055a94438bf85fc360ca3 (diff)
Merge remote-tracking branch 'origin/5.6' into 5.7
Conflicts: src/network/access/qhttpnetworkconnection.cpp src/network/access/qhttpnetworkconnection_p.h Change-Id: I11f8641ef482efa8cee1b79977d19cc3182814b4
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/image/qpixmap.cpp50
-rw-r--r--src/gui/kernel/qevent.cpp2
2 files changed, 25 insertions, 27 deletions
diff --git a/src/gui/image/qpixmap.cpp b/src/gui/image/qpixmap.cpp
index 59d6dc12c6..db922b4a9f 100644
--- a/src/gui/image/qpixmap.cpp
+++ b/src/gui/image/qpixmap.cpp
@@ -768,39 +768,37 @@ QBitmap QPixmap::createMaskFromColor(const QColor &maskColor, Qt::MaskMode mode)
bool QPixmap::load(const QString &fileName, const char *format, Qt::ImageConversionFlags flags)
{
- if (fileName.isEmpty()) {
- data.reset();
- return false;
- }
-
- detach();
+ if (!fileName.isEmpty()) {
- QFileInfo info(fileName);
- QString key = QLatin1String("qt_pixmap")
- % info.absoluteFilePath()
- % HexString<uint>(info.lastModified().toTime_t())
- % HexString<quint64>(info.size())
- % HexString<uint>(data ? data->pixelType() : QPlatformPixmap::PixmapType);
+ QFileInfo info(fileName);
+ // Note: If no extension is provided, we try to match the
+ // file against known plugin extensions
+ if (info.completeSuffix().isEmpty() || info.exists()) {
- // Note: If no extension is provided, we try to match the
- // file against known plugin extensions
- if (!info.completeSuffix().isEmpty() && !info.exists()) {
- data.reset();
- return false;
- }
+ QString key = QLatin1String("qt_pixmap")
+ % info.absoluteFilePath()
+ % HexString<uint>(info.lastModified().toTime_t())
+ % HexString<quint64>(info.size())
+ % HexString<uint>(data ? data->pixelType() : QPlatformPixmap::PixmapType);
- if (QPixmapCache::find(key, this))
- return true;
+ if (QPixmapCache::find(key, this))
+ return true;
- if (!data)
- data = QPlatformPixmap::create(0, 0, QPlatformPixmap::PixmapType);
+ data = QPlatformPixmap::create(0, 0, data ? data->pixelType() : QPlatformPixmap::PixmapType);
- if (data->fromFile(fileName, format, flags)) {
- QPixmapCache::insert(key, *this);
- return true;
+ if (data->fromFile(fileName, format, flags)) {
+ QPixmapCache::insert(key, *this);
+ return true;
+ }
+ }
}
- data.reset();
+ if (!isNull()) {
+ if (isQBitmap())
+ *this = QBitmap();
+ else
+ data.reset();
+ }
return false;
}
diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp
index 19220b5492..1da862515b 100644
--- a/src/gui/kernel/qevent.cpp
+++ b/src/gui/kernel/qevent.cpp
@@ -1658,7 +1658,7 @@ QResizeEvent::~QResizeEvent()
The event handler QWidget::closeEvent() receives close events. The
default implementation of this event handler accepts the close
event. If you do not want your widget to be hidden, or want some
- special handing, you should reimplement the event handler and
+ special handling, you should reimplement the event handler and
ignore() the event.
The \l{mainwindows/application#close event handler}{closeEvent() in the