From 40a9216e068b804cb9f048ad639a3bb85b185341 Mon Sep 17 00:00:00 2001 From: Eirik Aavitsland Date: Fri, 29 Apr 2016 11:16:31 +0200 Subject: Avoid asserting when painting certain degenerate bezier paths It could happen that the stroker would attempt to join empty subpaths, resulting in an invalid path structure that would cause assert later. Task-number: QTBUG-43474 Change-Id: Ia369a31e60c40cdae3900d96f15f3e83c9e78b97 Reviewed-by: Lars Knoll --- src/gui/painting/qstroker.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/gui') diff --git a/src/gui/painting/qstroker.cpp b/src/gui/painting/qstroker.cpp index fc344dc3ac..f6c899a815 100644 --- a/src/gui/painting/qstroker.cpp +++ b/src/gui/painting/qstroker.cpp @@ -422,7 +422,7 @@ void QStroker::processCurrentSubpath() bool fwclosed = qt_stroke_side(&fwit, this, false, &fwStartTangent); bool bwclosed = qt_stroke_side(&bwit, this, !fwclosed, &bwStartTangent); - if (!bwclosed) + if (!bwclosed && !fwStartTangent.isNull()) joinPoints(m_elements.at(0).x, m_elements.at(0).y, fwStartTangent, m_capStyle); } -- cgit v1.2.3 From 36578d41f3fe43a3cd3c37d8bdaaf3f9a50eca92 Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Tue, 10 May 2016 17:01:47 -0700 Subject: Remove wrong doc note for QPlatformBackingStore::flush() This is no longer true on at least Cocoa, Windows and xcb. Change-Id: I214caae46a8707ab7c89138646219140079e919a Reviewed-by: Jake Petroules --- src/gui/painting/qplatformbackingstore.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/gui') diff --git a/src/gui/painting/qplatformbackingstore.cpp b/src/gui/painting/qplatformbackingstore.cpp index 33d5e76e52..defdcfb4ad 100644 --- a/src/gui/painting/qplatformbackingstore.cpp +++ b/src/gui/painting/qplatformbackingstore.cpp @@ -226,7 +226,8 @@ void QPlatformTextureList::clear() Flushes the given \a region from the specified \a window onto the screen. - Note that the \a offset parameter is currently unused. + The \a offset parameter is relative to the origin of the backing + store image. */ #ifndef QT_NO_OPENGL -- cgit v1.2.3 From 78eeb6b066113c678fe15531ca10e70964f6b9a4 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Wed, 11 May 2016 15:10:50 +0300 Subject: QFont::exactMatch() should return false for aliases This is a partial revert of 992f233c in Qt 4 repo. The rest of the change cannot be reverted, since it added public API, but that API might be useful anyway. The patch was wrong, basically. QFont::exactMatch() should not claim that you can get an exact match for a typeface alias. It also introduced some weird inconsistencies: For instance, if the first font the alias resolved to in FontConfig did not exist, then exactMatch() would return false, even if it then resolved to the next one which existed. This caused a test failure on OpenSuse, where the preferred font for "sans" is Arial, which doesn't exist, so Roboto will be used instead. [ChangeLog][QtGui][Important Behavior Changes] QFont::exactMatch() now returns false when the provided typeface is an alias. Task-number: QTBUG-46054 Change-Id: I7532d2879b492544620aa0d1d87dd493a4923af9 Reviewed-by: Simon Hausmann --- src/gui/text/qfont.cpp | 3 --- 1 file changed, 3 deletions(-) (limited to 'src/gui') diff --git a/src/gui/text/qfont.cpp b/src/gui/text/qfont.cpp index 7e18250087..f92e4ab457 100644 --- a/src/gui/text/qfont.cpp +++ b/src/gui/text/qfont.cpp @@ -118,9 +118,6 @@ bool QFontDef::exactMatch(const QFontDef &other) const QFontDatabase::parseFontName(family, this_foundry, this_family); QFontDatabase::parseFontName(other.family, other_foundry, other_family); - this_family = QFontDatabase::resolveFontFamilyAlias(this_family); - other_family = QFontDatabase::resolveFontFamilyAlias(other_family); - return (styleHint == other.styleHint && styleStrategy == other.styleStrategy && weight == other.weight -- cgit v1.2.3 From 72e3fcce387d72043dd0b9fbe06d6b720861c1e7 Mon Sep 17 00:00:00 2001 From: Topi Reinio Date: Tue, 10 May 2016 14:54:24 +0200 Subject: Doc: Remove repository name from examplesinstallpath Examples in binary packages now directly match the install path. Change-Id: Ic1487bc766cfd3b0a0a340cc4ae4ba49d953eaa6 Task-number: QTBUG-52953 Reviewed-by: Oswald Buddenhagen --- src/gui/doc/qtgui.qdocconf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/gui') diff --git a/src/gui/doc/qtgui.qdocconf b/src/gui/doc/qtgui.qdocconf index e34347b801..436e2e0b34 100644 --- a/src/gui/doc/qtgui.qdocconf +++ b/src/gui/doc/qtgui.qdocconf @@ -4,7 +4,7 @@ project = QtGui description = Qt GUI Reference Documentation version = $QT_VERSION -examplesinstallpath = qtbase/gui +examplesinstallpath = gui qhp.projects = QtGui -- cgit v1.2.3 From ad54ac5a840c4a31e117fdedd6932ec450441ccc Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Thu, 12 May 2016 11:09:03 +0200 Subject: Fix building with -qreal float Min and max expressions need matching types, which means we have to take care both values are qreal. Task-number: QTCREATORBUG-15851 Change-Id: I5f123e979fa896006ff6eafaac1f65b667db975d Reviewed-by: Marc Mutz --- src/gui/painting/qpainter.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/gui') diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp index 62254213f3..1acd84754a 100644 --- a/src/gui/painting/qpainter.cpp +++ b/src/gui/painting/qpainter.cpp @@ -6268,7 +6268,7 @@ static void drawTextItemDecoration(QPainter *painter, const QPointF &pos, const pen.setColor(uc); // Adapt wave to underlineOffset or pen width, whatever is larger, to make it work on all platforms - const QPixmap wave = generateWavyPixmap(qMin(qMax(underlineOffset, pen.widthF()), maxHeight / 2.), pen); + const QPixmap wave = generateWavyPixmap(qMin(qMax(underlineOffset, pen.widthF()), maxHeight / qreal(2.)), pen); const int descent = qFloor(maxHeight); painter->setBrushOrigin(painter->brushOrigin().x(), 0); @@ -6279,7 +6279,7 @@ static void drawTextItemDecoration(QPainter *painter, const QPointF &pos, const // the text above it, but limit it to stay within descent. qreal adjustedUnderlineOffset = std::ceil(underlineOffset) + 0.5; if (underlineOffset <= fe->descent().toReal()) - adjustedUnderlineOffset = qMin(adjustedUnderlineOffset, fe->descent().toReal() - 0.5); + adjustedUnderlineOffset = qMin(adjustedUnderlineOffset, fe->descent().toReal() - qreal(0.5)); const qreal underlinePos = pos.y() + adjustedUnderlineOffset; QColor uc = charFormat.underlineColor(); if (uc.isValid()) -- cgit v1.2.3 From 3c19b8b162fa4e61a009c6bc8af72baa1ec8a529 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Thu, 28 Apr 2016 09:51:24 +0200 Subject: QOpenGL: use new QJsonObject::value(QLatin1String) Allows to get rid of some QStringLiterals, reducing QtGui text size by ~2Kib. Change-Id: Ic033fad5673aadc85930842dfccc24299df154f7 Reviewed-by: Sean Harmer --- src/gui/opengl/qopengl.cpp | 50 ++++++++++++++++------------------------------ 1 file changed, 17 insertions(+), 33 deletions(-) (limited to 'src/gui') diff --git a/src/gui/opengl/qopengl.cpp b/src/gui/opengl/qopengl.cpp index a798db662c..1a8fc599ce 100644 --- a/src/gui/opengl/qopengl.cpp +++ b/src/gui/opengl/qopengl.cpp @@ -138,22 +138,6 @@ QDebug operator<<(QDebug d, const QOpenGLConfig::Gpu &g) enum Operator { NotEqual, LessThan, LessEqualThan, Equals, GreaterThan, GreaterEqualThan }; static const char operators[][3] = {"!=", "<", "<=", "=", ">", ">="}; -static inline QString valueKey() { return QStringLiteral("value"); } -static inline QString opKey() { return QStringLiteral("op"); } -static inline QString versionKey() { return QStringLiteral("version"); } -static inline QString releaseKey() { return QStringLiteral("release"); } -static inline QString typeKey() { return QStringLiteral("type"); } -static inline QString osKey() { return QStringLiteral("os"); } -static inline QString vendorIdKey() { return QStringLiteral("vendor_id"); } -static inline QString glVendorKey() { return QStringLiteral("gl_vendor"); } -static inline QString deviceIdKey() { return QStringLiteral("device_id"); } -static inline QString driverVersionKey() { return QStringLiteral("driver_version"); } -static inline QString driverDescriptionKey() { return QStringLiteral("driver_description"); } -static inline QString featuresKey() { return QStringLiteral("features"); } -static inline QString idKey() { return QStringLiteral("id"); } -static inline QString descriptionKey() { return QStringLiteral("description"); } -static inline QString exceptionsKey() { return QStringLiteral("exceptions"); } - typedef QJsonArray::ConstIterator JsonArrayConstIt; static inline bool contains(const QJsonArray &haystack, unsigned needle) @@ -216,8 +200,8 @@ VersionTerm VersionTerm::fromJson(const QJsonValue &v) if (!v.isObject()) return result; const QJsonObject o = v.toObject(); - result.number = QVersionNumber::fromString(o.value(valueKey()).toString()); - const QString opS = o.value(opKey()).toString(); + result.number = QVersionNumber::fromString(o.value(QLatin1String("value")).toString()); + const QString opS = o.value(QLatin1String("op")).toString(); for (size_t i = 0; i < sizeof(operators) / sizeof(operators[0]); ++i) { if (opS == QLatin1String(operators[i])) { result.op = static_cast(i); @@ -292,9 +276,9 @@ OsTypeTerm OsTypeTerm::fromJson(const QJsonValue &v) if (!v.isObject()) return result; const QJsonObject o = v.toObject(); - result.type = o.value(typeKey()).toString(); - result.versionTerm = VersionTerm::fromJson(o.value(versionKey())); - result.release = o.value(releaseKey()).toArray(); + result.type = o.value(QLatin1String("type")).toString(); + result.versionTerm = VersionTerm::fromJson(o.value(QLatin1String("version"))); + result.release = o.value(QLatin1String("release")).toArray(); return result; } @@ -318,8 +302,8 @@ QString OsTypeTerm::hostOs() static QString msgSyntaxWarning(const QJsonObject &object, const QString &what) { QString result; - QTextStream(&result) << "Id " << object.value(idKey()).toInt() - << " (\"" << object.value(descriptionKey()).toString() + QTextStream(&result) << "Id " << object.value(QLatin1String("id")).toInt() + << " (\"" << object.value(QLatin1String("description")).toString() << "\"): " << what; return result; } @@ -333,11 +317,11 @@ static bool matches(const QJsonObject &object, const QString &osRelease, const QOpenGLConfig::Gpu &gpu) { - const OsTypeTerm os = OsTypeTerm::fromJson(object.value(osKey())); + const OsTypeTerm os = OsTypeTerm::fromJson(object.value(QLatin1String("os"))); if (!os.isNull() && !os.matches(osName, kernelVersion, osRelease)) return false; - const QJsonValue exceptionsV = object.value(exceptionsKey()); + const QJsonValue exceptionsV = object.value(QLatin1String("exceptions")); if (exceptionsV.isArray()) { const QJsonArray exceptionsA = exceptionsV.toArray(); for (JsonArrayConstIt it = exceptionsA.constBegin(), cend = exceptionsA.constEnd(); it != cend; ++it) { @@ -346,20 +330,20 @@ static bool matches(const QJsonObject &object, } } - const QJsonValue vendorV = object.value(vendorIdKey()); + const QJsonValue vendorV = object.value(QLatin1String("vendor_id")); if (vendorV.isString()) { if (gpu.vendorId != vendorV.toString().toUInt(Q_NULLPTR, /* base */ 0)) return false; } else { - if (object.contains(glVendorKey())) { - const QByteArray glVendorV = object.value(glVendorKey()).toString().toUtf8(); + if (object.contains(QLatin1String("gl_vendor"))) { + const QByteArray glVendorV = object.value(QLatin1String("gl_vendor")).toString().toUtf8(); if (!gpu.glVendor.contains(glVendorV)) return false; } } if (gpu.deviceId) { - const QJsonValue deviceIdV = object.value(deviceIdKey()); + const QJsonValue deviceIdV = object.value(QLatin1String("device_id")); switch (deviceIdV.type()) { case QJsonValue::Array: if (!contains(deviceIdV.toArray(), gpu.deviceId)) @@ -375,7 +359,7 @@ static bool matches(const QJsonObject &object, } } if (!gpu.driverVersion.isNull()) { - const QJsonValue driverVersionV = object.value(driverVersionKey()); + const QJsonValue driverVersionV = object.value(QLatin1String("driver_version")); switch (driverVersionV.type()) { case QJsonValue::Object: if (!VersionTerm::fromJson(driverVersionV).matches(gpu.driverVersion)) @@ -392,7 +376,7 @@ static bool matches(const QJsonObject &object, } if (!gpu.driverDescription.isEmpty()) { - const QJsonValue driverDescriptionV = object.value(driverDescriptionKey()); + const QJsonValue driverDescriptionV = object.value(QLatin1String("driver_description")); if (driverDescriptionV.isString()) { if (!gpu.driverDescription.contains(driverDescriptionV.toString().toUtf8())) return false; @@ -412,7 +396,7 @@ static bool readGpuFeatures(const QOpenGLConfig::Gpu &gpu, { result->clear(); errorMessage->clear(); - const QJsonValue entriesV = doc.object().value(QStringLiteral("entries")); + const QJsonValue entriesV = doc.object().value(QLatin1String("entries")); if (!entriesV.isArray()) { *errorMessage = QLatin1String("No entries read."); return false; @@ -423,7 +407,7 @@ static bool readGpuFeatures(const QOpenGLConfig::Gpu &gpu, if (eit->isObject()) { const QJsonObject object = eit->toObject(); if (matches(object, osName, kernelVersion, osRelease, gpu)) { - const QJsonValue featuresListV = object.value(featuresKey()); + const QJsonValue featuresListV = object.value(QLatin1String("features")); if (featuresListV.isArray()) { const QJsonArray featuresListA = featuresListV.toArray(); for (JsonArrayConstIt fit = featuresListA.constBegin(), fcend = featuresListA.constEnd(); fit != fcend; ++fit) -- cgit v1.2.3