diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/image/qimagereader.cpp | 2 | ||||
-rw-r--r-- | src/gui/itemviews/qabstractitemview.cpp | 2 | ||||
-rw-r--r-- | src/opengl/qgl.cpp | 11 |
3 files changed, 11 insertions, 4 deletions
diff --git a/src/gui/image/qimagereader.cpp b/src/gui/image/qimagereader.cpp index 9320cfc..27f9627 100644 --- a/src/gui/image/qimagereader.cpp +++ b/src/gui/image/qimagereader.cpp @@ -503,7 +503,7 @@ QImageReaderPrivate::~QImageReaderPrivate() bool QImageReaderPrivate::initHandler() { // check some preconditions - if (!device || (!deleteDevice && !device->isOpen())) { + if (!device || (!deleteDevice && !device->isOpen() && !device->open(QIODevice::ReadOnly))) { imageReaderError = QImageReader::DeviceError; errorString = QLatin1String(QT_TRANSLATE_NOOP(QImageReader, "Invalid device")); return false; diff --git a/src/gui/itemviews/qabstractitemview.cpp b/src/gui/itemviews/qabstractitemview.cpp index dd9a7e6..0f99949 100644 --- a/src/gui/itemviews/qabstractitemview.cpp +++ b/src/gui/itemviews/qabstractitemview.cpp @@ -2090,7 +2090,7 @@ void QAbstractItemView::focusInEvent(QFocusEvent *event) bool autoScroll = d->autoScroll; d->autoScroll = false; QModelIndex index = moveCursor(MoveNext, Qt::NoModifier); // first visible index - if (index.isValid() && d->isIndexEnabled(index)) + if (index.isValid() && d->isIndexEnabled(index) && event->reason() != Qt::MouseFocusReason) selectionModel()->setCurrentIndex(index, QItemSelectionModel::NoUpdate); d->autoScroll = autoScroll; } diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp index 5908f14..7aba25a 100644 --- a/src/opengl/qgl.cpp +++ b/src/opengl/qgl.cpp @@ -2453,8 +2453,15 @@ QGLTexture *QGLContextPrivate::bindTexture(const QPixmap &pixmap, GLenum target, } #endif - if (!texture) - texture = bindTexture(pixmap.toImage(), target, format, key, options); + if (!texture) { + QImage image = pixmap.toImage(); + // If the system depth is 16 and the pixmap doesn't have an alpha channel + // then we convert it to RGB16 in the hope that it gets uploaded as a 16 + // bit texture which is much faster to access than a 32-bit one. + if (pixmap.depth() == 16 && !image.hasAlphaChannel() ) + image = image.convertToFormat(QImage::Format_RGB16); + texture = bindTexture(image, target, format, key, options); + } // NOTE: bindTexture(const QImage&, GLenum, GLint, const qint64, bool) should never return null Q_ASSERT(texture); |