From 443ef0010ae68ac5a883fb9ab7677d9de719e70e Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Fri, 29 Nov 2019 10:50:24 +0100 Subject: rhi: Remove unused compat functions These were kept around to keep Qt Quick compiling, but the migration there has been done a long time ago. Remove these leftovers now. Change-Id: Ibd47381b410b11b5475a85c7ed3cb05c22f7adbb Reviewed-by: Paul Olav Tvete --- src/gui/rhi/qrhi_p.h | 20 -------------------- 1 file changed, 20 deletions(-) (limited to 'src') diff --git a/src/gui/rhi/qrhi_p.h b/src/gui/rhi/qrhi_p.h index 907924c788..588347d111 100644 --- a/src/gui/rhi/qrhi_p.h +++ b/src/gui/rhi/qrhi_p.h @@ -246,10 +246,6 @@ public: m_bindings.clear(); std::copy(first, last, std::back_inserter(m_bindings)); } - void setBindings(const QVector &bindings) // compat., to be removed - { - setBindings(bindings.cbegin(), bindings.cend()); - } const QRhiVertexInputBinding *cbeginBindings() const { return m_bindings.cbegin(); } const QRhiVertexInputBinding *cendBindings() const { return m_bindings.cend(); } const QRhiVertexInputBinding *bindingAt(int index) const { return &m_bindings.at(index); } @@ -261,10 +257,6 @@ public: m_attributes.clear(); std::copy(first, last, std::back_inserter(m_attributes)); } - void setAttributes(const QVector &attributes) // compat., to be removed - { - setAttributes(attributes.cbegin(), attributes.cend()); - } const QRhiVertexInputAttribute *cbeginAttributes() const { return m_attributes.cbegin(); } const QRhiVertexInputAttribute *cendAttributes() const { return m_attributes.cend(); } @@ -551,9 +543,6 @@ public: QRhiTextureUploadDescription() = default; QRhiTextureUploadDescription(const QRhiTextureUploadEntry &entry); QRhiTextureUploadDescription(std::initializer_list list); - QRhiTextureUploadDescription(const QVector &entries) // compat., to be removed - : m_entries(entries.cbegin(), entries.cend()) - { } void setEntries(std::initializer_list list) { m_entries = list; } template @@ -979,11 +968,6 @@ public: std::copy(first, last, std::back_inserter(m_bindings)); } - void setBindings(const QVector &bindings) // compat., to be removed - { - setBindings(bindings.cbegin(), bindings.cend()); - } - const QRhiShaderResourceBinding *cbeginBindings() const { return m_bindings.cbegin(); } const QRhiShaderResourceBinding *cendBindings() const { return m_bindings.cend(); } @@ -1172,10 +1156,6 @@ public: m_shaderStages.clear(); std::copy(first, last, std::back_inserter(m_shaderStages)); } - void setShaderStages(const QVector &stages) // compat., to be removed - { - setShaderStages(stages.cbegin(), stages.cend()); - } const QRhiShaderStage *cbeginShaderStages() const { return m_shaderStages.cbegin(); } const QRhiShaderStage *cendShaderStages() const { return m_shaderStages.cend(); } -- cgit v1.2.3 From 8310d636be068bb814418e2e6044c6dbd7df253a Mon Sep 17 00:00:00 2001 From: Joni Poikelin Date: Mon, 14 Oct 2019 12:31:40 +0300 Subject: Fix serializing QUuid with QDataStream with Qt 4 stream versions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes: QTBUG-76103 Change-Id: Iac92c33539940f5f67d014db5240c6dc14bfb772 Reviewed-by: Volker Hilsheimer Reviewed-by: Mårten Nordheim --- src/corelib/kernel/qvariant.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/corelib/kernel/qvariant.cpp b/src/corelib/kernel/qvariant.cpp index 43a3fb1db0..84ad555f34 100644 --- a/src/corelib/kernel/qvariant.cpp +++ b/src/corelib/kernel/qvariant.cpp @@ -2577,8 +2577,8 @@ void QVariant::save(QDataStream &s) const } else if (typeId >= QMetaType::QKeySequence && typeId <= QMetaType::QQuaternion) { // and as a result these types received lower ids too typeId +=1; - } else if (typeId == QMetaType::QPolygonF) { - // This existed in Qt 4 only as a custom type + } else if (typeId == QMetaType::QPolygonF || typeId == QMetaType::QUuid) { + // These existed in Qt 4 only as a custom type typeId = 127; fakeUserType = true; } -- cgit v1.2.3 From 580fd2dbd361be57105ed621d8367c677673a924 Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Fri, 29 Nov 2019 16:15:27 +0100 Subject: Relocate a comment that had become detached from its code Two little tool functions had come between it and the function it actually describes. Change-Id: Ib49d1623833275ea79c7916fece29aed9503aa40 Reviewed-by: Paul Wicking --- src/corelib/time/qdatetimeparser.cpp | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/corelib/time/qdatetimeparser.cpp b/src/corelib/time/qdatetimeparser.cpp index 2c566e3584..74db2bdfd5 100644 --- a/src/corelib/time/qdatetimeparser.cpp +++ b/src/corelib/time/qdatetimeparser.cpp @@ -369,13 +369,6 @@ static QString unquote(const QStringRef &str) } return ret; } -/*! - \internal - - Parses the format \a newFormat. If successful, returns \c true and - sets up the format. Else keeps the old format and returns \c false. - -*/ static inline int countRepeat(const QString &str, int index, int maxCount) { @@ -394,7 +387,12 @@ static inline void appendSeparator(QStringList *list, const QString &string, int list->append(lastQuote >= from ? unquote(separator) : separator.toString()); } +/*! + \internal + Parses the format \a newFormat. If successful, returns \c true and sets up + the format. Else keeps the old format and returns \c false. +*/ bool QDateTimeParser::parseFormat(const QString &newFormat) { const QLatin1Char quote('\''); -- cgit v1.2.3 From c625d923853d01ad668dd3e8ebd55b7e5a6bcdb8 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Mon, 2 Dec 2019 10:27:02 +0100 Subject: Fix depth in renderText() Fixes: QTBUG-31156 Change-Id: I3cbb3f9c5dfbcb182dbe283b0bf0f05a031970a5 Reviewed-by: Paul Olav Tvete --- src/opengl/qgl.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp index 2c5a40a992..2d7b0280d8 100644 --- a/src/opengl/qgl.cpp +++ b/src/opengl/qgl.cpp @@ -4962,7 +4962,7 @@ void QGLWidget::renderText(double x, double y, double z, const QString &str, con // The only option in Qt 5 is the shader-based OpenGL 2 paint engine. // Setting fixed pipeline transformations is futile. Instead, pass the // extra values directly and let the engine figure the matrices out. - static_cast(p->paintEngine())->setTranslateZ(-win_z); + static_cast(p->paintEngine())->setTranslateZ(-2 * win_z); qt_gl_draw_text(p, qRound(win_x), qRound(win_y), str, font); -- cgit v1.2.3 From 4d796cbf17da28e72ad25760a2ee8c27af96c202 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= Date: Fri, 8 Nov 2019 02:19:02 +0100 Subject: Prevent emscripten_webgl_destroy_context from removing event handlers The JavaScript implementation of that function has the following code: if (typeof JSEvents === 'object') JSEvents.removeAllHandlersOnTarget(GL.contexts[contextHandle].GLctx.canvas); // Release all // JS event handlers on the DOM element that the GL context is associated with since the context // is now deleted. This breaks mouse/keyboard events, etc. Disable this logic by temporarily setting the JSEvents object to undefined, for the duration of the emscripten_webgl_destroy_context call. Fixes: QTBUG-74850 Change-Id: Ied3177b0ca6e63e8ea07143bf7d6a850b0bce35a Reviewed-by: Lorn Potter --- src/plugins/platforms/wasm/qwasmopenglcontext.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src') diff --git a/src/plugins/platforms/wasm/qwasmopenglcontext.cpp b/src/plugins/platforms/wasm/qwasmopenglcontext.cpp index 62087f54bd..0532b7e726 100644 --- a/src/plugins/platforms/wasm/qwasmopenglcontext.cpp +++ b/src/plugins/platforms/wasm/qwasmopenglcontext.cpp @@ -30,6 +30,7 @@ #include "qwasmopenglcontext.h" #include "qwasmintegration.h" #include +#include QT_BEGIN_NAMESPACE @@ -50,7 +51,13 @@ QWasmOpenGLContext::QWasmOpenGLContext(const QSurfaceFormat &format) QWasmOpenGLContext::~QWasmOpenGLContext() { if (m_context) { + // Destroy GL context. Work around bug in emscripten_webgl_destroy_context + // which removes all event handlers on the canvas by temporarily removing + // emscripten's JSEvents global object. + emscripten::val jsEvents = emscripten::val::global("window")["JSEvents"]; + emscripten::val::global("window").set("JSEvents", emscripten::val::undefined()); emscripten_webgl_destroy_context(m_context); + emscripten::val::global("window").set("JSEvents", jsEvents); m_context = 0; } } -- cgit v1.2.3 From e4d1a03df00b7fb9528f4cd600038515a07196db Mon Sep 17 00:00:00 2001 From: Volker Hilsheimer Date: Tue, 3 Dec 2019 15:14:59 +0100 Subject: QMacStyle: correct placement of edit field in combobox MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The dark edit field is now centered within the frame around it, with a thin border on all sides, including between input field and button. Change-Id: I27e853289e9048c21fdc81e45fadacba9665b49e Fixes: QTBUG-63454 Reviewed-by: Tor Arne Vestbø --- src/plugins/styles/mac/qmacstyle_mac.mm | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/plugins/styles/mac/qmacstyle_mac.mm b/src/plugins/styles/mac/qmacstyle_mac.mm index 610329a350..ecdde06bb8 100644 --- a/src/plugins/styles/mac/qmacstyle_mac.mm +++ b/src/plugins/styles/mac/qmacstyle_mac.mm @@ -1740,16 +1740,16 @@ QRectF QMacStylePrivate::comboboxEditBounds(const QRectF &outerBounds, const Coc if (cw.type == ComboBox) { switch (cw.size) { case QStyleHelper::SizeLarge: - ret = ret.adjusted(0, 0, -28, 0).translated(3, 4.5); + ret = ret.adjusted(0, 0, -25, 0).translated(2, 4.5); ret.setHeight(16); break; case QStyleHelper::SizeSmall: - ret = ret.adjusted(0, 0, -24, 0).translated(3, 2); + ret = ret.adjusted(0, 0, -22, 0).translated(2, 3); ret.setHeight(14); break; case QStyleHelper::SizeMini: - ret = ret.adjusted(0, 0, -21, 0).translated(2, 3); - ret.setHeight(11); + ret = ret.adjusted(0, 0, -19, 0).translated(2, 2.5); + ret.setHeight(10.5); break; default: break; -- cgit v1.2.3 From 9f79ab360fd8a504601d3c66a7773eeaa09bffde Mon Sep 17 00:00:00 2001 From: David Faure Date: Sun, 3 Mar 2019 14:55:20 +0100 Subject: Fix assert in QTextDocument CSS parser on "border-width: 1pt" The code was assuming that if the parsing of the value worked, then it must be a list of 4 variants. But in this case it's just a single length. This came from using 4 values for border-width while other elements use a single value. But the storage is shared. So the fix is to use 4 values everywhere. When reading 4 and there's only one, it gets duplicated, so the caller can just use the first one in that case. Task-number: QTBUG-80496 Change-Id: I682244b6e3781c4d673a62d5e6511dac263c58e8 Reviewed-by: Nils Jeisecke Reviewed-by: Shawn Rutledge --- src/gui/text/qcssparser.cpp | 1 + src/gui/text/qcssparser_p.h | 4 ++-- src/gui/text/qtexthtmlparser.cpp | 7 +++++-- 3 files changed, 8 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/gui/text/qcssparser.cpp b/src/gui/text/qcssparser.cpp index ce7c7610c1..627b3ec8c0 100644 --- a/src/gui/text/qcssparser.cpp +++ b/src/gui/text/qcssparser.cpp @@ -443,6 +443,7 @@ void ValueExtractor::lengthValues(const Declaration &decl, int *m) { if (decl.d->parsed.isValid()) { QList v = decl.d->parsed.toList(); + Q_ASSERT(v.size() == 4); for (int i = 0; i < 4; i++) m[i] = lengthValueFromData(qvariant_cast(v.at(i)), f); return; diff --git a/src/gui/text/qcssparser_p.h b/src/gui/text/qcssparser_p.h index ab85e76cf3..d91b095a76 100644 --- a/src/gui/text/qcssparser_p.h +++ b/src/gui/text/qcssparser_p.h @@ -856,13 +856,13 @@ struct Q_GUI_EXPORT ValueExtractor int extractStyleFeatures(); bool extractImage(QIcon *icon, Qt::Alignment *a, QSize *size); - int lengthValue(const Declaration &decl); + void lengthValues(const Declaration &decl, int *m); private: void extractFont(); void borderValue(const Declaration &decl, int *width, QCss::BorderStyle *style, QBrush *color); LengthData lengthValue(const Value& v); - void lengthValues(const Declaration &decl, int *m); + int lengthValue(const Declaration &decl); QSize sizeValue(const Declaration &decl); void sizeValues(const Declaration &decl, QSize *radii); diff --git a/src/gui/text/qtexthtmlparser.cpp b/src/gui/text/qtexthtmlparser.cpp index 5d37982a8b..b867f42480 100644 --- a/src/gui/text/qtexthtmlparser.cpp +++ b/src/gui/text/qtexthtmlparser.cpp @@ -1209,8 +1209,11 @@ void QTextHtmlParserNode::applyCssDeclarations(const QVector if (decl.styleValue() != QCss::BorderStyle_Unknown && decl.styleValue() != QCss::BorderStyle_Native) borderStyle = static_cast(decl.styleValue() - 1); break; - case QCss::BorderWidth: - tableBorder = extractor.lengthValue(decl); + case QCss::BorderWidth: { + int borders[4]; + extractor.lengthValues(decl, borders); + tableBorder = borders[0]; + } break; case QCss::BorderCollapse: borderCollapse = decl.borderCollapseValue(); -- cgit v1.2.3 From deb166a5ff0ed3693b7d9a1b6a02b41f3f196b39 Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Wed, 27 Nov 2019 15:25:29 +0100 Subject: Make QMacTimeZonePrivate default constructor more efficient Inline systemTimeZoneId() in it to save the need for init(). We thus save the lookup by name for a time-zone object, when that object is what we took the name from anyway. Do some minor tidy-up in the other constructors and add an assert to systemTimeZoneId() to match the new one in the default constructor. Change-Id: Ib70acf31bdb4a4fa1306eebd1fd5f00ad6b89bcc Reviewed-by: Timur Pocheptsov --- src/corelib/time/qtimezoneprivate_mac.mm | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/corelib/time/qtimezoneprivate_mac.mm b/src/corelib/time/qtimezoneprivate_mac.mm index 4509e316f9..406ee6445f 100644 --- a/src/corelib/time/qtimezoneprivate_mac.mm +++ b/src/corelib/time/qtimezoneprivate_mac.mm @@ -60,22 +60,24 @@ QT_BEGIN_NAMESPACE // Create the system default time zone QMacTimeZonePrivate::QMacTimeZonePrivate() - : m_nstz(0) { - init(systemTimeZoneId()); + // Reset the cached system tz then instantiate it: + [NSTimeZone resetSystemTimeZone]; + m_nstz = [NSTimeZone.systemTimeZone retain]; + Q_ASSERT(m_nstz); + m_id = QString::fromNSString(m_nstz.name).toUtf8(); } // Create a named time zone QMacTimeZonePrivate::QMacTimeZonePrivate(const QByteArray &ianaId) - : m_nstz(0) + : m_nstz(nil) { init(ianaId); } QMacTimeZonePrivate::QMacTimeZonePrivate(const QMacTimeZonePrivate &other) - : QTimeZonePrivate(other), m_nstz(0) + : QTimeZonePrivate(other), m_nstz([other.m_nstz copy]) { - m_nstz = [other.m_nstz copy]; } QMacTimeZonePrivate::~QMacTimeZonePrivate() @@ -316,6 +318,7 @@ QByteArray QMacTimeZonePrivate::systemTimeZoneId() const { // Reset the cached system tz then return the name [NSTimeZone resetSystemTimeZone]; + Q_ASSERT(NSTimeZone.systemTimeZone); return QString::fromNSString([[NSTimeZone systemTimeZone] name]).toUtf8(); } -- cgit v1.2.3 From dc7fa56948a2a7953f645c7f9d7237925b3f9abe Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Wed, 27 Nov 2019 17:08:56 +0100 Subject: QMacTimeZonePrivate: use .member rather than [- member] notation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Apparently this is our preferred style for Objective C member references. Change-Id: I8b2bbaabadbea2cfa74f209372e77cee79e3c895 Reviewed-by: Tor Arne Vestbø Reviewed-by: Qt CI Bot --- src/corelib/time/qtimezoneprivate_mac.mm | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/corelib/time/qtimezoneprivate_mac.mm b/src/corelib/time/qtimezoneprivate_mac.mm index 406ee6445f..1fb48a31d3 100644 --- a/src/corelib/time/qtimezoneprivate_mac.mm +++ b/src/corelib/time/qtimezoneprivate_mac.mm @@ -111,7 +111,7 @@ void QMacTimeZonePrivate::init(const QByteArray &ianaId) QString QMacTimeZonePrivate::comment() const { - return QString::fromNSString([m_nstz description]); + return QString::fromNSString(m_nstz.description); } QString QMacTimeZonePrivate::displayName(QTimeZone::TimeType timeType, @@ -214,7 +214,7 @@ bool QMacTimeZonePrivate::hasTransitions() const // TODO Not sure what is returned in event of no transitions, assume will be before requested date NSDate *epoch = [NSDate dateWithTimeIntervalSince1970:0]; const NSDate *date = [m_nstz nextDaylightSavingTimeTransitionAfterDate:epoch]; - const bool result = ([date timeIntervalSince1970] > [epoch timeIntervalSince1970]); + const bool result = (date.timeIntervalSince1970 > epoch.timeIntervalSince1970); return result; } @@ -224,7 +224,7 @@ QTimeZonePrivate::Data QMacTimeZonePrivate::nextTransition(qint64 afterMSecsSinc const NSTimeInterval seconds = afterMSecsSinceEpoch / 1000.0; NSDate *nextDate = [NSDate dateWithTimeIntervalSince1970:seconds]; nextDate = [m_nstz nextDaylightSavingTimeTransitionAfterDate:nextDate]; - const NSTimeInterval nextSecs = [nextDate timeIntervalSince1970]; + const NSTimeInterval nextSecs = nextDate.timeIntervalSince1970; if (nextDate == nil || nextSecs <= seconds) { [nextDate release]; return invalidData(); @@ -250,7 +250,7 @@ QTimeZonePrivate::Data QMacTimeZonePrivate::previousTransition(qint64 beforeMSec NSDate *nextDate = [NSDate dateWithTimeIntervalSince1970:nextSecs]; nextDate = [m_nstz nextDaylightSavingTimeTransitionAfterDate:nextDate]; if (nextDate != nil - && (tranSecs = [nextDate timeIntervalSince1970]) < endSecs) { + && (tranSecs = nextDate.timeIntervalSince1970) < endSecs) { // There's a transition within the last year before endSecs: nextSecs = tranSecs; } else { @@ -259,7 +259,7 @@ QTimeZonePrivate::Data QMacTimeZonePrivate::previousTransition(qint64 beforeMSec nextDate = [m_nstz nextDaylightSavingTimeTransitionAfterDate:nextDate]; if (nextDate != nil) { NSTimeInterval lateSecs = nextSecs; - nextSecs = [nextDate timeIntervalSince1970]; + nextSecs = nextDate.timeIntervalSince1970; Q_ASSERT(nextSecs <= endSecs - year || nextSecs == tranSecs); /* We're looking at the first ever transition for our zone, at @@ -285,8 +285,7 @@ QTimeZonePrivate::Data QMacTimeZonePrivate::previousTransition(qint64 beforeMSec NSTimeInterval middle = nextSecs / 2 + lateSecs / 2; NSDate *split = [NSDate dateWithTimeIntervalSince1970:middle]; split = [m_nstz nextDaylightSavingTimeTransitionAfterDate:split]; - if (split != nil - && (tranSecs = [split timeIntervalSince1970]) < endSecs) { + if (split != nil && (tranSecs = split.timeIntervalSince1970) < endSecs) { nextDate = split; nextSecs = tranSecs; } else { @@ -303,7 +302,7 @@ QTimeZonePrivate::Data QMacTimeZonePrivate::previousTransition(qint64 beforeMSec while (nextDate != nil && nextSecs < endSecs) { prevSecs = nextSecs; nextDate = [m_nstz nextDaylightSavingTimeTransitionAfterDate:nextDate]; - nextSecs = [nextDate timeIntervalSince1970]; + nextSecs = nextDate.timeIntervalSince1970; if (nextSecs <= prevSecs) // presumably no later data available break; } @@ -319,18 +318,18 @@ QByteArray QMacTimeZonePrivate::systemTimeZoneId() const // Reset the cached system tz then return the name [NSTimeZone resetSystemTimeZone]; Q_ASSERT(NSTimeZone.systemTimeZone); - return QString::fromNSString([[NSTimeZone systemTimeZone] name]).toUtf8(); + return QString::fromNSString(NSTimeZone.systemTimeZone.name).toUtf8(); } QList QMacTimeZonePrivate::availableTimeZoneIds() const { - NSEnumerator *enumerator = [[NSTimeZone knownTimeZoneNames] objectEnumerator]; - QByteArray tzid = QString::fromNSString([enumerator nextObject]).toUtf8(); + NSEnumerator *enumerator = NSTimeZone.knownTimeZoneNames.objectEnumerator; + QByteArray tzid = QString::fromNSString(enumerator.nextObject).toUtf8(); QList list; while (!tzid.isEmpty()) { list << tzid; - tzid = QString::fromNSString([enumerator nextObject]).toUtf8(); + tzid = QString::fromNSString(enumerator.nextObject).toUtf8(); } std::sort(list.begin(), list.end()); -- cgit v1.2.3