summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@theqtcompany.com>2015-10-02 14:23:08 +0200
committerLiang Qi <liang.qi@theqtcompany.com>2015-10-02 16:59:55 +0200
commitd0eaa737e10aed34c09ba753e21c3e027b5ce58c (patch)
treece2a9ea9dbfbabf5cfc390feaed5ee94beb0449a /src/gui
parent7c0b9e1e8d069afab997efd3df9632d342b23150 (diff)
parenta5f470240f31d35e694a40fe837fc4f49bc32072 (diff)
Merge remote-tracking branch 'origin/5.5' into 5.6
Conflicts: qmake/doc/src/qmake-manual.qdoc src/corelib/tools/qstring.h src/gui/image/qimagereader.cpp src/network/access/qnetworkaccessmanager.cpp src/tools/qdoc/doc/examples/examples.qdoc src/widgets/accessible/qaccessiblewidgetfactory_p.h src/widgets/doc/qtwidgets.qdocconf Change-Id: I8fae62283aebefe24e5ca4b4abd97386560c0fcb
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/image/qimagereader.cpp2
-rw-r--r--src/gui/image/qppmhandler.cpp3
-rw-r--r--src/gui/kernel/qcursor.cpp10
-rw-r--r--src/gui/kernel/qcursor_p.h3
-rw-r--r--src/gui/kernel/qguiapplication.cpp4
-rw-r--r--src/gui/kernel/qwindow.cpp6
-rw-r--r--src/gui/kernel/qwindowsysteminterface.cpp1
-rw-r--r--src/gui/math3d/qmatrix4x4.cpp2
-rw-r--r--src/gui/opengl/qopenglframebufferobject.cpp17
-rw-r--r--src/gui/painting/qcosmeticstroker.cpp3
-rw-r--r--src/gui/painting/qpdfwriter.cpp3
11 files changed, 37 insertions, 17 deletions
diff --git a/src/gui/image/qimagereader.cpp b/src/gui/image/qimagereader.cpp
index 618352d363..0ef587f333 100644
--- a/src/gui/image/qimagereader.cpp
+++ b/src/gui/image/qimagereader.cpp
@@ -1171,7 +1171,7 @@ QImageIOHandler::Transformations QImageReader::transformation() const
Determines that images returned by read() should have transformation metadata automatically
applied if \a enabled is \c true.
- \sa autoTransform(), read()
+ \sa autoTransform(), transformation(), read()
*/
void QImageReader::setAutoTransform(bool enabled)
{
diff --git a/src/gui/image/qppmhandler.cpp b/src/gui/image/qppmhandler.cpp
index 0f4256b740..f460431c2b 100644
--- a/src/gui/image/qppmhandler.cpp
+++ b/src/gui/image/qppmhandler.cpp
@@ -182,7 +182,8 @@ static bool read_pbm_body(QIODevice *device, char type, int w, int h, int mcc, Q
} else { // read ascii data
uchar *p;
int n;
- for (y=0; y<h; y++) {
+ char buf;
+ for (y = 0; (y < h) && (device->peek(&buf, 1) == 1); y++) {
p = outImage->scanLine(y);
n = pbm_bpl;
if (nbits == 1) {
diff --git a/src/gui/kernel/qcursor.cpp b/src/gui/kernel/qcursor.cpp
index dbf2b3c21f..c25f3c2665 100644
--- a/src/gui/kernel/qcursor.cpp
+++ b/src/gui/kernel/qcursor.cpp
@@ -393,7 +393,7 @@ QCursor::QCursor(const QPixmap &pixmap, int hotX, int hotY)
bmm.fill(Qt::color1);
}
- d = QCursorData::setBitmap(bm, bmm, hotX, hotY);
+ d = QCursorData::setBitmap(bm, bmm, hotX, hotY, pixmap.devicePixelRatio());
d->pixmap = pixmap;
}
@@ -436,7 +436,7 @@ QCursor::QCursor(const QPixmap &pixmap, int hotX, int hotY)
QCursor::QCursor(const QBitmap &bitmap, const QBitmap &mask, int hotX, int hotY)
: d(0)
{
- d = QCursorData::setBitmap(bitmap, mask, hotX, hotY);
+ d = QCursorData::setBitmap(bitmap, mask, hotX, hotY, 1.0);
}
/*!
@@ -656,7 +656,7 @@ void QCursorData::initialize()
QCursorData::initialized = true;
}
-QCursorData *QCursorData::setBitmap(const QBitmap &bitmap, const QBitmap &mask, int hotX, int hotY)
+QCursorData *QCursorData::setBitmap(const QBitmap &bitmap, const QBitmap &mask, int hotX, int hotY, qreal devicePixelRatio)
{
if (!QCursorData::initialized)
QCursorData::initialize();
@@ -670,8 +670,8 @@ QCursorData *QCursorData::setBitmap(const QBitmap &bitmap, const QBitmap &mask,
d->bm = new QBitmap(bitmap);
d->bmm = new QBitmap(mask);
d->cshape = Qt::BitmapCursor;
- d->hx = hotX >= 0 ? hotX : bitmap.width() / 2;
- d->hy = hotY >= 0 ? hotY : bitmap.height() / 2;
+ d->hx = hotX >= 0 ? hotX : bitmap.width() / 2 / devicePixelRatio;
+ d->hy = hotY >= 0 ? hotY : bitmap.height() / 2 / devicePixelRatio;
return d;
}
diff --git a/src/gui/kernel/qcursor_p.h b/src/gui/kernel/qcursor_p.h
index 0aaa62b891..188ea387b3 100644
--- a/src/gui/kernel/qcursor_p.h
+++ b/src/gui/kernel/qcursor_p.h
@@ -70,7 +70,8 @@ public:
short hx, hy;
static bool initialized;
void update();
- static QCursorData *setBitmap(const QBitmap &bitmap, const QBitmap &mask, int hotX, int hotY);
+ static QCursorData *setBitmap(const QBitmap &bitmap, const QBitmap &mask, int hotX, int hotY,
+ qreal devicePixelRatio);
};
extern QCursorData *qt_cursorTable[Qt::LastCursor + 1]; // qcursor.cpp
diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp
index 710aa714b7..b309f67866 100644
--- a/src/gui/kernel/qguiapplication.cpp
+++ b/src/gui/kernel/qguiapplication.cpp
@@ -1131,7 +1131,7 @@ void QGuiApplicationPrivate::createPlatformIntegration()
QHighDpiScaling::initHighDpiScaling();
// Load the platform integration
- QString platformPluginPath = QLatin1String(qgetenv("QT_QPA_PLATFORM_PLUGIN_PATH"));
+ QString platformPluginPath = QString::fromLocal8Bit(qgetenv("QT_QPA_PLATFORM_PLUGIN_PATH"));
QByteArray platformName;
@@ -1161,7 +1161,7 @@ void QGuiApplicationPrivate::createPlatformIntegration()
arg.remove(0, 1);
if (arg == "-platformpluginpath") {
if (++i < argc)
- platformPluginPath = QLatin1String(argv[i]);
+ platformPluginPath = QString::fromLocal8Bit(argv[i]);
} else if (arg == "-platform") {
if (++i < argc)
platformName = argv[i];
diff --git a/src/gui/kernel/qwindow.cpp b/src/gui/kernel/qwindow.cpp
index 89bd119564..d4edc0fca1 100644
--- a/src/gui/kernel/qwindow.cpp
+++ b/src/gui/kernel/qwindow.cpp
@@ -1271,8 +1271,11 @@ void QWindow::setMinimumSize(const QSize &size)
*/
void QWindow::setX(int arg)
{
+ Q_D(QWindow);
if (x() != arg)
setGeometry(QRect(arg, y(), width(), height()));
+ else
+ d->positionAutomatic = false;
}
/*!
@@ -1281,8 +1284,11 @@ void QWindow::setX(int arg)
*/
void QWindow::setY(int arg)
{
+ Q_D(QWindow);
if (y() != arg)
setGeometry(QRect(x(), arg, width(), height()));
+ else
+ d->positionAutomatic = false;
}
/*!
diff --git a/src/gui/kernel/qwindowsysteminterface.cpp b/src/gui/kernel/qwindowsysteminterface.cpp
index faa1ff8068..09e6e2deb8 100644
--- a/src/gui/kernel/qwindowsysteminterface.cpp
+++ b/src/gui/kernel/qwindowsysteminterface.cpp
@@ -232,6 +232,7 @@ bool QWindowSystemInterface::tryHandleShortcutOverrideEvent(QWindow *w, QKeyEven
{
#ifndef QT_NO_SHORTCUT
Q_ASSERT(ev->type() == QKeyEvent::ShortcutOverride);
+ QGuiApplicationPrivate::modifier_buttons = ev->modifiers();
QObject *focus = w->focusObject();
if (!focus)
diff --git a/src/gui/math3d/qmatrix4x4.cpp b/src/gui/math3d/qmatrix4x4.cpp
index eb7c7f4b7a..9d363dc895 100644
--- a/src/gui/math3d/qmatrix4x4.cpp
+++ b/src/gui/math3d/qmatrix4x4.cpp
@@ -148,8 +148,6 @@ QMatrix4x4::QMatrix4x4(const float *values)
top-most 4 rows of \a matrix. If \a matrix has less than 4 columns
or rows, the remaining elements are filled with elements from the
identity matrix.
-
- \sa QMatrix4x4(const QGenericMatrix &)
*/
/*!
diff --git a/src/gui/opengl/qopenglframebufferobject.cpp b/src/gui/opengl/qopenglframebufferobject.cpp
index 0e162713ce..e0ef7c52a5 100644
--- a/src/gui/opengl/qopenglframebufferobject.cpp
+++ b/src/gui/opengl/qopenglframebufferobject.cpp
@@ -43,6 +43,7 @@
#include <qwindow.h>
#include <qlibrary.h>
#include <qimage.h>
+#include <QtCore/qbytearray.h>
QT_BEGIN_NAMESPACE
@@ -1275,9 +1276,19 @@ static inline QImage qt_gl_read_framebuffer_rgba8(const QSize &size, bool includ
#if Q_BYTE_ORDER == Q_LITTLE_ENDIAN
// Without GL_UNSIGNED_INT_8_8_8_8_REV, GL_BGRA only makes sense on little endian.
- const bool supports_bgra = context->isOpenGLES()
- ? context->hasExtension(QByteArrayLiteral("GL_EXT_read_format_bgra"))
- : context->hasExtension(QByteArrayLiteral("GL_EXT_bgra"));
+ const bool has_bgra_ext = context->isOpenGLES()
+ ? context->hasExtension(QByteArrayLiteral("GL_EXT_read_format_bgra"))
+ : context->hasExtension(QByteArrayLiteral("GL_EXT_bgra"));
+
+ const char *renderer = reinterpret_cast<const char *>(funcs->glGetString(GL_RENDERER));
+ const char *ver = reinterpret_cast<const char *>(funcs->glGetString(GL_VERSION));
+
+ // Blacklist PowerVR Rogue G6200 as it has problems with its BGRA support.
+ const bool blackListed = (qstrcmp(renderer, "PowerVR Rogue G6200") == 0
+ && ::strstr(ver, "1.3") != 0);
+
+ const bool supports_bgra = has_bgra_ext && !blackListed;
+
if (supports_bgra) {
QImage img(size, include_alpha ? QImage::Format_ARGB32_Premultiplied : QImage::Format_RGB32);
funcs->glReadPixels(0, 0, w, h, GL_BGRA, GL_UNSIGNED_BYTE, img.bits());
diff --git a/src/gui/painting/qcosmeticstroker.cpp b/src/gui/painting/qcosmeticstroker.cpp
index 61d57ca3f8..8c3fd2ce4f 100644
--- a/src/gui/painting/qcosmeticstroker.cpp
+++ b/src/gui/painting/qcosmeticstroker.cpp
@@ -720,10 +720,11 @@ static inline void capAdjust(int caps, int &x1, int &x2, int &y, int yinc)
template<DrawPixel drawPixel, class Dasher>
static bool drawLine(QCosmeticStroker *stroker, qreal rx1, qreal ry1, qreal rx2, qreal ry2, int caps)
{
+ bool didDraw = qAbs(rx2 - rx1) + qAbs(ry2 - ry1) >= 1.0;
+
if (stroker->clipLine(rx1, ry1, rx2, ry2))
return true;
- bool didDraw = false;
const int half = stroker->legacyRounding ? 31 : 0;
int x1 = toF26Dot6(rx1) + half;
int y1 = toF26Dot6(ry1) + half;
diff --git a/src/gui/painting/qpdfwriter.cpp b/src/gui/painting/qpdfwriter.cpp
index ca411ebe08..a8c1d8297c 100644
--- a/src/gui/painting/qpdfwriter.cpp
+++ b/src/gui/painting/qpdfwriter.cpp
@@ -151,7 +151,8 @@ QPdfWriter::QPdfWriter(const QString &filename)
Constructs a PDF writer that will write the pdf to \a device.
*/
QPdfWriter::QPdfWriter(QIODevice *device)
- : QObject(*new QPdfWriterPrivate)
+ : QObject(*new QPdfWriterPrivate),
+ QPagedPaintDevice(new QPdfPagedPaintDevicePrivate(d_func()))
{
Q_D(QPdfWriter);