From 490b24b06408e90e9684d8331fd3fe8b0c51b0b5 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Wed, 1 Nov 2017 08:40:24 -0700 Subject: QTemporaryFile: hide the O_TMPFILE feature behind a check for linkat() Some Linux libc (I'm looking at you, Bionic) use the system call but don't expose it to userspace. We could use syscall() to make the system call, but instead I decided to penalize users of those libc by not having the feature. It's probably a good thing, since there were likely to be more problems with Android anyway and I don't have an environment to debug. Task-number: QTBUG-64154 Change-Id: I57a1bd6e0c194530b732fffd14f3007a1062d935 Reviewed-by: Oswald Buddenhagen Reviewed-by: Lars Knoll --- src/corelib/configure.json | 15 +++++++++++++++ src/corelib/global/minimum-linux_p.h | 2 +- src/corelib/global/qconfig-bootstrapped.h | 5 +++++ src/corelib/io/qtemporaryfile_p.h | 2 +- 4 files changed, 22 insertions(+), 2 deletions(-) diff --git a/src/corelib/configure.json b/src/corelib/configure.json index 8067ca70f1..bf44f2649d 100644 --- a/src/corelib/configure.json +++ b/src/corelib/configure.json @@ -349,6 +349,15 @@ "qmake": "linux: LIBS += -lpthread -lrt" } }, + "linkat": { + "label": "linkat()", + "type": "compile", + "test": { + "head": "#define _ATFILE_SOURCE 1", + "include": [ "fcntl.h", "unistd.h" ], + "main": "linkat(AT_FDCWD, \"foo\", AT_FDCWD, \"bar\", AT_SYMLINK_FOLLOW);" + } + }, "ppoll": { "label": "ppoll()", "type": "compile", @@ -540,6 +549,12 @@ "condition": "libs.journald", "output": [ "privateFeature" ] }, + "linkat": { + "label": "linkat()", + "autoDetect": "config.linux", + "condition": "tests.linkat", + "output": [ "privateFeature" ] + }, "std-atomic64": { "label": "64 bit atomic operations", "condition": "libs.libatomic", diff --git a/src/corelib/global/minimum-linux_p.h b/src/corelib/global/minimum-linux_p.h index 324744b856..bad2488b4d 100644 --- a/src/corelib/global/minimum-linux_p.h +++ b/src/corelib/global/minimum-linux_p.h @@ -67,7 +67,7 @@ QT_BEGIN_NAMESPACE * - inotify_init1 before 2.6.12-rc12 * - futex(2) before 2.6.12-rc12 * - FUTEX_WAKE_OP 2.6.14 FUTEX_OP - * - linkat(2) 2.6.17 O_TMPFILE + * - linkat(2) 2.6.17 O_TMPFILE && QT_CONFIG(linkat) * - FUTEX_PRIVATE_FLAG 2.6.22 * - O_CLOEXEC 2.6.23 * - eventfd 2.6.23 diff --git a/src/corelib/global/qconfig-bootstrapped.h b/src/corelib/global/qconfig-bootstrapped.h index 2164d7f21f..dabb715607 100644 --- a/src/corelib/global/qconfig-bootstrapped.h +++ b/src/corelib/global/qconfig-bootstrapped.h @@ -87,6 +87,11 @@ #define QT_FEATURE_futimens -1 #define QT_FEATURE_futimes -1 #define QT_FEATURE_library -1 +#ifdef __linux__ +# define QT_FEATURE_linkat 1 +#else +# define QT_FEATURE_linkat -1 +#endif #define QT_NO_QOBJECT #define QT_FEATURE_process -1 #define QT_FEATURE_renameat2 -1 diff --git a/src/corelib/io/qtemporaryfile_p.h b/src/corelib/io/qtemporaryfile_p.h index 46a0d7aba3..f74e5680b9 100644 --- a/src/corelib/io/qtemporaryfile_p.h +++ b/src/corelib/io/qtemporaryfile_p.h @@ -58,7 +58,7 @@ #include "private/qfile_p.h" #include "qtemporaryfile.h" -#ifdef Q_OS_LINUX +#if defined(Q_OS_LINUX) && QT_CONFIG(linkat) # include # ifdef O_TMPFILE // some early libc support had the wrong values for O_TMPFILE -- cgit v1.2.3 From 48afcf97b45a2f2729e5ff29a7d9d9ec71958a13 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Wed, 8 Nov 2017 13:45:26 +0100 Subject: Fix shader graph metatypes for static builds Cannot rely on Q_COREAPP_STARTUP_FUNCTION inside Qt since static builds have to be fully supported. Due to not registering those types, the shader builder silently generated incompilable shader code in static builds. This is critical especially on platforms where static builds are the only choice (INTEGRITY). Task-number: QTBUG-64365 Change-Id: I8820ded239ac160ab00c7fc34918fd3f273f0afb Reviewed-by: Lars Knoll --- src/gui/util/qshadergraphloader.cpp | 3 +++ src/gui/util/qshaderlanguage.cpp | 14 ++++++-------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/gui/util/qshadergraphloader.cpp b/src/gui/util/qshadergraphloader.cpp index c7560d9105..8d92c73a5a 100644 --- a/src/gui/util/qshadergraphloader.cpp +++ b/src/gui/util/qshadergraphloader.cpp @@ -48,10 +48,13 @@ QT_BEGIN_NAMESPACE +void qt_register_ShaderLanguage_enums(); + QShaderGraphLoader::QShaderGraphLoader() Q_DECL_NOTHROW : m_status(Null), m_device(nullptr) { + qt_register_ShaderLanguage_enums(); } QShaderGraphLoader::Status QShaderGraphLoader::status() const Q_DECL_NOTHROW diff --git a/src/gui/util/qshaderlanguage.cpp b/src/gui/util/qshaderlanguage.cpp index 4a0da5bfb5..f9192f5ff3 100644 --- a/src/gui/util/qshaderlanguage.cpp +++ b/src/gui/util/qshaderlanguage.cpp @@ -43,14 +43,12 @@ QT_BEGIN_NAMESPACE -namespace { - void registerEnums() - { - qRegisterMetaType(); - qRegisterMetaType(); - } +// Note: to be invoked explicitly. Relying for example on +// Q_COREAPP_STARTUP_FUNCTION would not be acceptable in static builds. +void qt_register_ShaderLanguage_enums() +{ + qRegisterMetaType(); + qRegisterMetaType(); } -Q_COREAPP_STARTUP_FUNCTION(registerEnums) - QT_END_NAMESPACE -- cgit v1.2.3 From 131c9a24626b0bb2c09d509d3ba7a1155501f0e1 Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Fri, 10 Nov 2017 17:14:23 +0100 Subject: Fix BC breakage by adding an overload for the QSqlField constructor Change-Id: I253bb8cd97b982fa5ed5dd546c38deb1f7995986 Reviewed-by: Lars Knoll --- src/sql/kernel/qsqlfield.cpp | 13 +++++++++++++ src/sql/kernel/qsqlfield.h | 5 +++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/sql/kernel/qsqlfield.cpp b/src/sql/kernel/qsqlfield.cpp index 59b992e803..a258d44df7 100644 --- a/src/sql/kernel/qsqlfield.cpp +++ b/src/sql/kernel/qsqlfield.cpp @@ -155,6 +155,19 @@ public: */ /*! + Constructs an empty field called \a fieldName of variant type \a type. + + \sa setRequiredStatus(), setLength(), setPrecision(), setDefaultValue(), + setGenerated(), setReadOnly() +*/ +QSqlField::QSqlField(const QString &fieldName, QVariant::Type type) +{ + d = new QSqlFieldPrivate(fieldName, type, QString()); + val = QVariant(type); +} + +/*! + \overload Constructs an empty field called \a fieldName of variant type \a type in \a table. diff --git a/src/sql/kernel/qsqlfield.h b/src/sql/kernel/qsqlfield.h index 30474735f4..8650ba8715 100644 --- a/src/sql/kernel/qsqlfield.h +++ b/src/sql/kernel/qsqlfield.h @@ -55,8 +55,9 @@ public: enum RequiredStatus { Unknown = -1, Optional = 0, Required = 1 }; explicit QSqlField(const QString& fieldName = QString(), - QVariant::Type type = QVariant::Invalid, - const QString &tableName = QString()); + QVariant::Type type = QVariant::Invalid); + QSqlField(const QString &fieldName, QVariant::Type type, + const QString &tableName); QSqlField(const QSqlField& other); QSqlField& operator=(const QSqlField& other); -- cgit v1.2.3 From 1456a7b78aad6ad3edf91dec7be76a7cb885cd24 Mon Sep 17 00:00:00 2001 From: Topi Reinio Date: Wed, 8 Nov 2017 13:57:26 +0100 Subject: Doc: Remove the default list of highlighted examples Each module now maintain the list of examples to highlight separately. Change-Id: Ib9bca8d945bb3e81d4176cbbebcb89b1309dc0d4 Reviewed-by: Nico Vertriest --- doc/global/manifest-meta.qdocconf | 20 -------------------- 1 file changed, 20 deletions(-) diff --git a/doc/global/manifest-meta.qdocconf b/doc/global/manifest-meta.qdocconf index 3b67049182..3db67a3131 100644 --- a/doc/global/manifest-meta.qdocconf +++ b/doc/global/manifest-meta.qdocconf @@ -30,26 +30,6 @@ manifestmeta.filters = highlighted android thumbnail ios -manifestmeta.highlighted.names = "QtQuick/Qt Quick Demo - Same Game" \ - "QtQuick/Qt Quick Demo - Photo Surface" \ - "QtQuick/Qt Quick Demo - Tweet Search" \ - "QtQuick/Qt Quick Demo - Calqlatr" \ - "QtQuick/Qt Quick Demo - StocQt" \ - "QtQuick/Qt Quick Demo - Clocks" \ - "QtQuick/Qt Quick Examples - Shader Effects" \ - "QtQuickExtras/Qt Quick Extras - Dashboard" \ - "QtQuickExtras/Qt Quick Extras - Flat" \ - "QtQuickExtras/Qt Quick Extras - Gallery" \ - "QtQuickDialogs/Qt Quick System Dialog Examples" \ - "QtWinExtras/Quick Player" \ - "QtMultimedia/QML Video Shader Effects Example" \ - "QtCanvas3D/Interactive Mobile Phone Example" \ - "QtLocation/Map Viewer (QML)" \ - "QtBluetooth/Bluetooth Low Energy Heart Rate Game" \ - "QtCharts/Chart Themes Example" \ - "QtDataVisualization/Bars Example" \ - "QtDataVisualization/Surface Example" - manifestmeta.highlighted.attributes = isHighlighted:true manifestmeta.android.names = "QtQuick/Qt Quick Demo - Calqlatr" \ -- cgit v1.2.3 From 285596ee199ae1767fc48a0d0c2d12b178c0234d Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Thu, 9 Nov 2017 21:13:43 +0100 Subject: Special-case parsing of Zulu time-zone in date-times When parsing a date-time's zone, a stray Z denotes UTC (a.k.a. Zulu time), despite not being a valid name for the zone. Clients parsing such date strings had to treat the Z as a literal, rather than a zone-ID, but then they got back a LocalTime instead of the UTC the string actually described. So teach QTimeZoneParser to handle this special case and adapt an existing test (that used a time ending in Z, but had to treat it as a local time) to check this works. [ChangeLog][QtCore][QDateTime] When parsing a time-zone, "Z" is now recognized as an alias for UTC. Change-Id: Ib6aa2d8ea2dc6b2da526b39aec74dbc007f90fd8 Reviewed-by: Thiago Macieira --- src/corelib/tools/qdatetimeparser.cpp | 7 ++++++- tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp | 4 ++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/corelib/tools/qdatetimeparser.cpp b/src/corelib/tools/qdatetimeparser.cpp index dd277f7753..4b3777407c 100644 --- a/src/corelib/tools/qdatetimeparser.cpp +++ b/src/corelib/tools/qdatetimeparser.cpp @@ -1155,7 +1155,8 @@ QDateTimeParser::scanString(const QDateTime &defaultValue, // Synchronize with what findTimeZone() found: QStringRef zoneName = input->midRef(pos, sect.used); Q_ASSERT(!zoneName.isEmpty()); // sect.used > 0 - const QByteArray latinZone(zoneName.toLatin1()); + const QByteArray latinZone(zoneName == QLatin1String("Z") + ? QByteArray("UTC") : zoneName.toLatin1()); timeZone = QTimeZone(latinZone); tspec = timeZone.isValid() ? (QTimeZone::isTimeZoneIdAvailable(latinZone) @@ -1595,6 +1596,10 @@ QDateTimeParser::findTimeZone(QStringRef str, const QDateTime &when, while (index > 0) { str.truncate(index); + if (str == QLatin1String("Z")) { + offset = 0; // "Zulu" time - a.k.a. UTC + break; + } QTimeZone zone(str.toLatin1()); if (zone.isValid()) { offset = zone.offsetFromUtc(when); diff --git a/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp b/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp index c0ed88e154..7a047c67de 100644 --- a/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp +++ b/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp @@ -2396,8 +2396,8 @@ void tst_QDateTime::fromStringStringFormat_data() QTest::newRow("data14") << QString("32.01.2004") << QString("dd.MM.yyyy") << invalidDateTime(); QTest::newRow("data15") << QString("Thu January 2004") << QString("ddd MMMM yyyy") << QDateTime(QDate(2004, 1, 1), QTime()); QTest::newRow("data16") << QString("2005-06-28T07:57:30.001Z") - << QString("yyyy-MM-ddThh:mm:ss.zZ") - << QDateTime(QDate(2005, 06, 28), QTime(07, 57, 30, 1)); + << QString("yyyy-MM-ddThh:mm:ss.zt") + << QDateTime(QDate(2005, 06, 28), QTime(07, 57, 30, 1), Qt::UTC); } void tst_QDateTime::fromStringStringFormat() -- cgit v1.2.3 From a066ad32b6ef87b8882642495dcabaa3ac1a0819 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Sun, 12 Nov 2017 15:56:20 -0800 Subject: QDateTime: Move the deprecation marker to Qt 5.10 Commit b6a61211280aa6ddd56f107a9795c9824b7702b0 went into dev at around the time of the 5.10 branching. We apparently got the side of it wrong. Change-Id: Ic632b4163d784b83951cfffd14f67bec63fbc795 Reviewed-by: Edward Welbourne --- src/corelib/tools/qdatetime.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/corelib/tools/qdatetime.h b/src/corelib/tools/qdatetime.h index adab47fc1f..3b741553d5 100644 --- a/src/corelib/tools/qdatetime.h +++ b/src/corelib/tools/qdatetime.h @@ -81,7 +81,7 @@ public: int daysInYear() const; int weekNumber(int *yearNum = Q_NULLPTR) const; -#if QT_DEPRECATED_SINCE(5, 11) && !defined QT_NO_TEXTDATE +#if QT_DEPRECATED_SINCE(5, 10) && !defined QT_NO_TEXTDATE QT_DEPRECATED_X("Use QLocale::monthName or QLocale::standaloneMonthName") static QString shortMonthName(int month, MonthNameType type = DateFormat); QT_DEPRECATED_X("Use QLocale::dayName or QLocale::standaloneDayName") -- cgit v1.2.3 From 12aa50175268064b3da36473ec0196cbdb1bdf7f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= Date: Thu, 14 Sep 2017 15:09:22 +0200 Subject: macOS: Fix OpenGL context sharing MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit See code comments for problem and fix description. Task-number: QTBUG-63180 Change-Id: I6c6381f2c77c246bd975f66f9baa0165e32de777 Reviewed-by: Tor Arne Vestbø --- src/plugins/platforms/cocoa/qcocoaglcontext.mm | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/cocoa/qcocoaglcontext.mm b/src/plugins/platforms/cocoa/qcocoaglcontext.mm index 5ed81a7f1b..be5029b7e0 100644 --- a/src/plugins/platforms/cocoa/qcocoaglcontext.mm +++ b/src/plugins/platforms/cocoa/qcocoaglcontext.mm @@ -152,9 +152,32 @@ QCocoaGLContext::QCocoaGLContext(const QSurfaceFormat &format, QPlatformOpenGLCo QMacAutoReleasePool pool; // For the SG Canvas render thread + m_shareContext = share ? static_cast(share)->nsOpenGLContext() : nil; + + if (m_shareContext) { + // Allow sharing between 3.2 Core and 4.1 Core profile versions in + // cases where NSOpenGLContext creates a 4.1 context where a 3.2 + // context was requested. Due to the semantics of QSurfaceFormat + // this 4.1 version can find its way onto the format for the new + // context, even though it was at no point requested by the user. + GLint shareContextRequestedProfile; + [m_shareContext.pixelFormat getValues:&shareContextRequestedProfile + forAttribute:NSOpenGLPFAOpenGLProfile forVirtualScreen:0]; + auto shareContextActualProfile = share->format().version(); + + if (shareContextRequestedProfile == NSOpenGLProfileVersion3_2Core && + shareContextActualProfile >= qMakePair(4, 1)) { + + // There is a mismatch, downgrade requested format to make the + // NSOpenGLPFAOpenGLProfile attributes match. (NSOpenGLContext will + // fail to create a new context if there is a mismatch). + if (m_format.version() >= qMakePair(4, 1)) + m_format.setVersion(3, 2); + } + } + // create native context for the requested pixel format and share NSOpenGLPixelFormat *pixelFormat = createNSOpenGLPixelFormat(m_format); - m_shareContext = share ? static_cast(share)->nsOpenGLContext() : nil; m_context = [[NSOpenGLContext alloc] initWithFormat:pixelFormat shareContext:m_shareContext]; // retry without sharing on context creation failure. -- cgit v1.2.3 From b72b5cd76004e54dc00c0f1133f4d59192ef154a Mon Sep 17 00:00:00 2001 From: Victor-Andrei Variu Date: Mon, 14 Aug 2017 15:47:26 +0300 Subject: Adjust screen scale factor for certain screen configurations MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Pixel density reported by the screen is sometimes not precise enough, so recalculate it: divide px (physical pixels) by dp (device-independent pixels) for both width and height, and then use the average if it is different from the one initially reported by the screen Task-number: QTBUG-62191 Change-Id: Ia2f485c7ce8849db6e7c1d2ac08f5e008aea2ff8 Reviewed-by: Morten Johan Sørvig --- src/gui/kernel/qhighdpiscaling.cpp | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/src/gui/kernel/qhighdpiscaling.cpp b/src/gui/kernel/qhighdpiscaling.cpp index 085652879c..078f185d08 100644 --- a/src/gui/kernel/qhighdpiscaling.cpp +++ b/src/gui/kernel/qhighdpiscaling.cpp @@ -376,8 +376,22 @@ qreal QHighDpiScaling::screenSubfactor(const QPlatformScreen *screen) { qreal factor = qreal(1.0); if (screen) { - if (m_usePixelDensity) - factor *= screen->pixelDensity(); + if (m_usePixelDensity) { + qreal pixelDensity = screen->pixelDensity(); + + // Pixel density reported by the screen is sometimes not precise enough, + // so recalculate it: divide px (physical pixels) by dp (device-independent pixels) + // for both width and height, and then use the average if it is different from + // the one initially reported by the screen + QRect screenGeometry = screen->geometry(); + qreal wFactor = qreal(screenGeometry.width()) / qRound(screenGeometry.width() / pixelDensity); + qreal hFactor = qreal(screenGeometry.height()) / qRound(screenGeometry.height() / pixelDensity); + qreal averageDensity = (wFactor + hFactor) / 2; + if (!qFuzzyCompare(pixelDensity, averageDensity)) + pixelDensity = averageDensity; + + factor *= pixelDensity; + } if (m_screenFactorSet) { QVariant screenFactor = screen->screen()->property(scaleFactorProperty); if (screenFactor.isValid()) -- cgit v1.2.3 From 3c7a6a7a581f9ea6f05a22a912d660c5402a1fa8 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Sat, 21 Oct 2017 11:24:54 -0700 Subject: QRandomGenerator: Enforce the use of 32-bit integers in the engine std::mt19937 is defined as operating on uint_fast32_t, which is usually just a 32-bit integer. That's not the case on 64-bit Linux, where it is actually 64-bit wide, meaning sizeof(std::mt19937) jumps from 2504 to 5000 bytes, with exactly 50% of it filled with zeroes. The seed() function also needs a large zero-extending loop. Change-Id: Icaa86fc7b54d4b368c0efffd14efa911e2a40b44 Reviewed-by: Lars Knoll --- src/corelib/global/qrandom.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/corelib/global/qrandom.h b/src/corelib/global/qrandom.h index bde64646a4..005de0941f 100644 --- a/src/corelib/global/qrandom.h +++ b/src/corelib/global/qrandom.h @@ -177,7 +177,8 @@ private: friend class QRandomGenerator64; struct SystemGenerator; struct SystemAndGlobalGenerators; - typedef std::mt19937 RandomEngine; + using RandomEngine = std::mersenne_twister_engine; union Storage { uint dummy; -- cgit v1.2.3 From 4ee85ff7c5db7aa228a30a9dc2a52d5d37089241 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Sun, 19 Nov 2017 11:26:33 -0800 Subject: QFileSystemEngine/Linux: fix when qt_lstatx() succeeds When qt_lstatx() succeeds and the target is not a link, we'd erroneously mark the file as non-existent during the pass to check qt_statx(). All flags besides the file's modes were cleared. This is unit-tested, but only happens on Linux kernels 4.12 or later. It didn't happen to me because I already had this fix applied as part of a later change relating to QSystemResult. Task-number: QTBUG-64514 Change-Id: I938b024e38bf4aac9154fffd14f893506a1ef55b Reviewed-by: Lars Knoll --- src/corelib/io/qfilesystemengine_unix.cpp | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/src/corelib/io/qfilesystemengine_unix.cpp b/src/corelib/io/qfilesystemengine_unix.cpp index d77cdc123c..4051dc43a1 100644 --- a/src/corelib/io/qfilesystemengine_unix.cpp +++ b/src/corelib/io/qfilesystemengine_unix.cpp @@ -918,7 +918,7 @@ bool QFileSystemEngine::fillMetaData(const QFileSystemEntry &entry, QFileSystemM data.entryFlags &= ~what; const QByteArray nativeFilePath = entry.nativeFilePath(); - bool entryExists = true; // innocent until proven otherwise + int entryErrno = 0; // innocent until proven otherwise // first, we may try lstat(2). Possible outcomes: // - success and is a symlink: filesystem entry exists, but we need stat(2) @@ -968,7 +968,7 @@ bool QFileSystemEngine::fillMetaData(const QFileSystemEntry &entry, QFileSystemM } } else { // it doesn't exist - entryExists = false; + entryErrno = errno; data.knownFlagsMask |= QFileSystemMetaData::ExistsAttribute; } @@ -976,8 +976,8 @@ bool QFileSystemEngine::fillMetaData(const QFileSystemEntry &entry, QFileSystemM } // second, we try a regular stat(2) - if (statResult != 0 && (what & QFileSystemMetaData::PosixStatFlags)) { - if (entryExists && statResult == -1) { + if (statResult == -1 && (what & QFileSystemMetaData::PosixStatFlags)) { + if (entryErrno == 0 && statResult == -1) { data.entryFlags &= ~QFileSystemMetaData::PosixStatFlags; statResult = qt_statx(nativeFilePath, &statxBuffer); if (statResult == -ENOSYS) { @@ -991,7 +991,7 @@ bool QFileSystemEngine::fillMetaData(const QFileSystemEntry &entry, QFileSystemM } if (statResult != 0) { - entryExists = false; + entryErrno = errno; data.birthTime_ = 0; data.metadataChangeTime_ = 0; data.modificationTime_ = 0; @@ -1010,13 +1010,13 @@ bool QFileSystemEngine::fillMetaData(const QFileSystemEntry &entry, QFileSystemM if (what & (QFileSystemMetaData::UserPermissions | QFileSystemMetaData::ExistsAttribute)) { // calculate user permissions auto checkAccess = [&](QFileSystemMetaData::MetaDataFlag flag, int mode) { - if (!entryExists || (what & flag) == 0) + if (entryErrno != 0 || (what & flag) == 0) return; if (QT_ACCESS(nativeFilePath, mode) == 0) { // access ok (and file exists) data.entryFlags |= flag | QFileSystemMetaData::ExistsAttribute; } else if (errno != EACCES && errno != EROFS) { - entryExists = false; + entryErrno = errno; } }; @@ -1025,9 +1025,10 @@ bool QFileSystemEngine::fillMetaData(const QFileSystemEntry &entry, QFileSystemM checkAccess(QFileSystemMetaData::UserExecutePermission, X_OK); // if we still haven't found out if the file exists, try F_OK - if (entryExists && (data.entryFlags & QFileSystemMetaData::ExistsAttribute) == 0) { - entryExists = QT_ACCESS(nativeFilePath, F_OK) == 0; - if (entryExists) + if (entryErrno == 0 && (data.entryFlags & QFileSystemMetaData::ExistsAttribute) == 0) { + if (QT_ACCESS(nativeFilePath, F_OK) == -1) + entryErrno = errno; + else data.entryFlags |= QFileSystemMetaData::ExistsAttribute; } @@ -1037,13 +1038,13 @@ bool QFileSystemEngine::fillMetaData(const QFileSystemEntry &entry, QFileSystemM #if defined(Q_OS_DARWIN) if (what & QFileSystemMetaData::AliasType) { - if (entryExists && hasResourcePropertyFlag(data, entry, kCFURLIsAliasFileKey)) + if (entryErrno == 0 && hasResourcePropertyFlag(data, entry, kCFURLIsAliasFileKey)) data.entryFlags |= QFileSystemMetaData::AliasType; data.knownFlagsMask |= QFileSystemMetaData::AliasType; } if (what & QFileSystemMetaData::BundleType) { - if (entryExists && isPackage(data, entry)) + if (entryErrno == 0 && isPackage(data, entry)) data.entryFlags |= QFileSystemMetaData::BundleType; data.knownFlagsMask |= QFileSystemMetaData::BundleType; @@ -1055,19 +1056,19 @@ bool QFileSystemEngine::fillMetaData(const QFileSystemEntry &entry, QFileSystemM QString fileName = entry.fileName(); if ((fileName.size() > 0 && fileName.at(0) == QLatin1Char('.')) #if defined(Q_OS_DARWIN) - || (entryExists && hasResourcePropertyFlag(data, entry, kCFURLIsHiddenKey)) + || (entryErrno == 0 && hasResourcePropertyFlag(data, entry, kCFURLIsHiddenKey)) #endif ) data.entryFlags |= QFileSystemMetaData::HiddenAttribute; data.knownFlagsMask |= QFileSystemMetaData::HiddenAttribute; } - if (!entryExists) { + if (entryErrno != 0) { what &= ~QFileSystemMetaData::LinkType; // don't clear link: could be broken symlink data.clearFlags(what); return false; } - return data.hasFlags(what); + return true; } // static -- cgit v1.2.3 From 0dc025bf9f0ba3760ae8a02356900f5f63e75047 Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Thu, 16 Nov 2017 16:59:00 +0100 Subject: Fix macOS shadow prefix builds using pre-synced source packages For source packages that don't have a .git subdirectory, syncqt is executed before configure, with outdir set to srcdir, and this caused path misalignments for injected headers in qt_module.prf when generating makefile rules. The fix is to change syncqt to always output injected header paths relative to the source dir. Task-number: QTBUG-64539 Change-Id: Ia2296e44494093dbf124729062f430ad6fca7262 Reviewed-by: Oswald Buddenhagen --- bin/syncqt.pl | 5 +++-- mkspecs/features/qt_module.prf | 14 ++++---------- 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/bin/syncqt.pl b/bin/syncqt.pl index e741f22f65..02e55d847e 100755 --- a/bin/syncqt.pl +++ b/bin/syncqt.pl @@ -1037,7 +1037,8 @@ foreach my $lib (@modules_to_sync) { my $clean_header; my $requires; - my $iheader = $subdir . "/" . $header; + my $iheader_src = $subdir . "/" . $header; + my $iheader = $iheader_src; $iheader =~ s/^\Q$basedir\E/$out_basedir/ if ($shadow); if ($check_includes) { # We need both $public_header and $private_header because QPA headers count as neither @@ -1079,7 +1080,7 @@ foreach my $lib (@modules_to_sync) { } $header_copies++ if (!$shadow && syncHeader($lib, $oheader, $iheader, $copy_headers, $ts)); - my $pri_install_iheader = fixPaths($iheader, $dir); + my $pri_install_iheader = fixPaths($iheader_src, $dir); my $injection = ""; if ($public_header) { foreach my $class (@classes) { diff --git a/mkspecs/features/qt_module.prf b/mkspecs/features/qt_module.prf index a5c40a7899..c0a8dcc251 100644 --- a/mkspecs/features/qt_module.prf +++ b/mkspecs/features/qt_module.prf @@ -135,18 +135,12 @@ lib_bundle { !build_all| \ if(if(!debug_and_release|CONFIG(release, debug|release))) { FRAMEWORK_HEADERS.version = Versions - FRAMEWORK_HEADERS.files = $$SYNCQT.HEADER_FILES $$SYNCQT.HEADER_CLASSES - # Non-existing paths (yet, they will be generated) are used verbatim. - for (injected_header, SYNCQT.INJECTED_HEADER_FILES): \ - FRAMEWORK_HEADERS.files += \ - $$relative_path($$absolute_path($$injected_header, $$_PRO_FILE_PWD_), $$OUT_PWD) - + FRAMEWORK_HEADERS.files = \ + $$SYNCQT.HEADER_FILES $$SYNCQT.HEADER_CLASSES $$SYNCQT.INJECTED_HEADER_FILES FRAMEWORK_HEADERS.path = Headers FRAMEWORK_PRIVATE_HEADERS.version = Versions - FRAMEWORK_PRIVATE_HEADERS.files = $$SYNCQT.PRIVATE_HEADER_FILES - for (injected_header, SYNCQT.INJECTED_PRIVATE_HEADER_FILES): \ - FRAMEWORK_PRIVATE_HEADERS.files += \ - $$relative_path($$absolute_path($$injected_header, $$_PRO_FILE_PWD_), $$OUT_PWD) + FRAMEWORK_PRIVATE_HEADERS.files = \ + $$SYNCQT.PRIVATE_HEADER_FILES $$SYNCQT.INJECTED_PRIVATE_HEADER_FILES FRAMEWORK_PRIVATE_HEADERS.path = Headers/$$VERSION/$$MODULE_INCNAME/private FRAMEWORK_QPA_HEADERS.version = Versions FRAMEWORK_QPA_HEADERS.files = $$SYNCQT.QPA_HEADER_FILES -- cgit v1.2.3 From 0817e2a81ec1b0fc1e5cd7ed9473177c75dc6f1e Mon Sep 17 00:00:00 2001 From: Topi Reinio Date: Tue, 7 Nov 2017 12:11:45 +0100 Subject: Doc: Update the list of highlighted examples Update the list of highlighted examples for modules in qtbase, based on which examples have been updated to use C++11 features, the new signal/slot connection syntax, and documentation improvements. Not all the modules have highlighted examples yet as some of the work is still ongoing. Task-number: QTBUG-60641 Change-Id: If28d59c10ca1a30e5db408970f20159434ac94f8 Reviewed-by: Nico Vertriest Reviewed-by: Leena Miettinen Reviewed-by: Venugopal Shivashankar --- src/concurrent/doc/qtconcurrent.qdocconf | 2 ++ src/corelib/doc/qtcore.qdocconf | 3 +++ src/dbus/doc/qtdbus.qdocconf | 2 +- src/gui/doc/qtgui.qdocconf | 2 ++ src/network/doc/qtnetwork.qdocconf | 2 ++ src/widgets/doc/qtwidgets.qdocconf | 4 +++- 6 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/concurrent/doc/qtconcurrent.qdocconf b/src/concurrent/doc/qtconcurrent.qdocconf index d8ee963ef5..356d602a7c 100644 --- a/src/concurrent/doc/qtconcurrent.qdocconf +++ b/src/concurrent/doc/qtconcurrent.qdocconf @@ -36,6 +36,8 @@ exampledirs += ../../../examples/qtconcurrent \ ../ \ snippets +manifestmeta.highlighted.names = "QtConcurrent/QtConcurrent Progress Dialog Example" + excludedirs += ../../../examples/widgets/doc imagedirs += images diff --git a/src/corelib/doc/qtcore.qdocconf b/src/corelib/doc/qtcore.qdocconf index 3d64708def..5a42e21845 100644 --- a/src/corelib/doc/qtcore.qdocconf +++ b/src/corelib/doc/qtcore.qdocconf @@ -45,5 +45,8 @@ excludedirs += snippets excludefiles += ../../../examples/widgets/tools/customcompleter/doc/src/customcompleter.qdoc \ ../../../examples/widgets/tools/codecs/doc/src/codecs.qdoc +manifestmeta.highlighted.names = "QtCore/JSON Save Game Example" \ + "QtCore/Local Fortune*" + navigation.landingpage = "Qt Core" navigation.cppclassespage = "Qt Core C++ Classes" diff --git a/src/dbus/doc/qtdbus.qdocconf b/src/dbus/doc/qtdbus.qdocconf index ff46cc5961..69eaa0eec3 100644 --- a/src/dbus/doc/qtdbus.qdocconf +++ b/src/dbus/doc/qtdbus.qdocconf @@ -59,4 +59,4 @@ navigation.cppclassespage = "Qt D-Bus C++ Classes" manifestmeta.thumbnail.names = "QtDBus/D-Bus List Names Example" \ "QtDBus/D-Bus Ping Pong Example" \ - "QtDBus/D-Bus Complex Ping Pong Example" \ + "QtDBus/D-Bus Complex Ping Pong Example" diff --git a/src/gui/doc/qtgui.qdocconf b/src/gui/doc/qtgui.qdocconf index 3b3ebafc2d..e1afa426ed 100644 --- a/src/gui/doc/qtgui.qdocconf +++ b/src/gui/doc/qtgui.qdocconf @@ -56,5 +56,7 @@ imagedirs += images \ ../../../examples/gui/doc/images \ ../../../doc/src/images \ +manifestmeta.highlighted.names = "QtGui/Analog Clock Window Example" + navigation.landingpage = "Qt GUI" navigation.cppclassespage = "Qt GUI C++ Classes" diff --git a/src/network/doc/qtnetwork.qdocconf b/src/network/doc/qtnetwork.qdocconf index 2a8e577dda..4f667eed9d 100644 --- a/src/network/doc/qtnetwork.qdocconf +++ b/src/network/doc/qtnetwork.qdocconf @@ -40,5 +40,7 @@ exampledirs += ../../../examples/network \ imagedirs += images \ ../../../examples/network/doc/images +manifestmeta.highlighted.names = "QtNetwork/HTTP Example" + navigation.landingpage = "Qt Network" navigation.cppclassespage = "Qt Network C++ Classes" diff --git a/src/widgets/doc/qtwidgets.qdocconf b/src/widgets/doc/qtwidgets.qdocconf index a49eb439af..88957b0f94 100644 --- a/src/widgets/doc/qtwidgets.qdocconf +++ b/src/widgets/doc/qtwidgets.qdocconf @@ -48,4 +48,6 @@ imagedirs += images \ navigation.landingpage = "Qt Widgets" navigation.cppclassespage = "Qt Widgets C++ Classes" manifestmeta.highlighted.names = "QtWidgets/Calendar Widget Example" \ - "QtWidgets/Simple Tree Model Example" + "QtWidgets/Editable Tree Model Example" \ + "QtWidgets/Address Book Example" \ + "QtWidgets/Application Example" -- cgit v1.2.3 From 42005951defded6cd1a9a60582b29f58c78fea9e Mon Sep 17 00:00:00 2001 From: Antti Kokko Date: Wed, 8 Nov 2017 13:06:46 +0200 Subject: Add changes file for Qt 5.10.0 Change-Id: I66bfe7a8897c7b2b4986a12dec37229e0ad82755 Reviewed-by: Edward Welbourne Reviewed-by: Lars Knoll Reviewed-by: Thiago Macieira --- dist/changes-5.10.0 | 564 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 564 insertions(+) create mode 100644 dist/changes-5.10.0 diff --git a/dist/changes-5.10.0 b/dist/changes-5.10.0 new file mode 100644 index 0000000000..b76f51543b --- /dev/null +++ b/dist/changes-5.10.0 @@ -0,0 +1,564 @@ +Qt 5.10 introduces many new features and improvements as well as bugfixes +over the 5.9.x series. For more details, refer to the online documentation +included in this distribution. The documentation is also available online: + +http://doc.qt.io/qt-5/index.html + +The Qt version 5.10 series is binary compatible with the 5.9.x series. +Applications compiled for 5.9 will continue to run with 5.10. + +Some of the changes listed in this file include issue tracking numbers +corresponding to tasks in the Qt Bug Tracker: + +https://bugreports.qt.io/ + +Each of these identifiers can be entered in the bug tracker to obtain more +information about a particular change. + +**************************************************************************** +* Important Behavior Changes * +**************************************************************************** + + - [QTBUG-60857] The names of the roles returned by + QSqlQueryModel::roleNames now only include a name for the + Qt::DisplayRole. Previously all the roles names of QSqlQueryModel were + returned. + - QFileInfo on empty strings now behaves like the default-constructed + QFileInfo. Notably, path() will now be the empty string too, instead of + ".", which means absoluteFilePath() is no longer the current working + directory. + + - QTemporaryFile: + * rename() no longer attempts to do block copying, as that usually + indicates a mistake in the user's code. Instead, either create the + temporary file in the same directory as the new name to be, or use + QSaveFile. + * On Linux, QTemporaryFile will attempt to create unnamed temporary + files. If that succeeds, open() will return true but exists() will be + false. If you call fileName() or any function that calls it, + QTemporaryFile will give the file a name, so most applications will + not see a difference. + + - Windows: + * [QTBUG-62662] On Windows, a drag & drop operation of local file URIs, + like QListView items backed by a QFileSystemModel, will result in the + attachment or opening of the files by the target application, instead + of the creation of hyperlinks. + +**************************************************************************** +* General Notes * +**************************************************************************** + +Deprecation Notice +------------------ + + - Starting with Qt 5.10, IPv6 support is mandatory for all platforms. + Systems without proper IPv6 support, such as the getaddrinfo() function + or the proper socket address structures, will not be able to build + QtNetwork anymore. + + - QSignalMapper is now marked as deprecated. + +Potentially Source-Incompatible Changes +--------------------------------------- + + - QByteArray: + * qbytearray.h no longer includes qstring.h. In particular, this means + that in order to use QStringBuilder with QByteArray, you need to + include both qbytearray.h and qstring.h now (or and + , resp.). + + - QStaticText: + * The QStaticText(const QString &) constructor is now explicit. + +Third-Party Code +---------------- + + - PCRE2 has been updated to version 10.30. + - Replaced bundled libjpeg by libjpeg-turbo 1.5.2 + - Improve documentation about Freetype 2 licenses. + - Sqlite was updated to version 3.20.1 + +**************************************************************************** +* Library * +**************************************************************************** + +QtCore +------ + + - Added qHash(QStringView). + - [QTBUG-37253] Added QMetaObject::invokeMethod() overloads for function + pointers. + - [QTBUG-41006] Added qEnvironmentVariable, which returns the value of an + environment variable in a QString, while qgetenv continues to be used to + return it in a QByteArray. For Unix, since most environment variables + seem to contain path names, qEnvironmentVariable will do the same as + QFile::decodeName, which means NFC/NFD conversion on Apple OSes. + - [QTBUG-62915] qAddPostRoutine() and qRemovePostRoutine() are now + thread-safe. + + - Containers: + * Added an STL-like iterator to go through QHash/QMap returning both the + key and the value of the element pointed to. That lets QHash/QMap + interoperate better with stl's algorithms like std::set_union. + + - JSON: + * QJsonArray, QJsonDocument, QJsonObject and QJsonValue now have move + operations and a swap() member function. + + - Logging: + * If you set QT_FATAL_WARNINGS to a number n > 1, Qt will stop the + application on that n-th warning, instead of on the first. For the + sake of compatibility with previous versions, if the variable is set + to any non-empty and non-numeric value, Qt will understand it as "stop + on first warning". + + - QByteArray: + * Added shrink_to_fit() for compatibility with the Standard Library. This + function does the same as squeeze(). + + - QChar: + * Added constructors from char16_t and, on Windows, wchar_t. + + - QCoreApplication: + * [QTBUG-57095] Calling QCoreApplication::translate() is now + thread-safe. + + - QCryptographicHash: + * [QTBUG-59770] In order to preserve compatibility with earlier versions + of Qt, QCryptographicHash is now able to calculate Keccak message + digests. Please see the release notes for Qt 5.9.2 for more details. + + - QDate/QTime/QDateTime: + * Added toString() overloads taking the format as a QStringView. + * [QTBUG-22833] Added support for parsing of time-zones. + + - QDebug: + * Added streaming of QStringViews. + + - QFile: + * [QTBUG-984] Added fileTime() and setFileTime(). + + - QFileInfo: + * [QTBUG-984] Added fileTime(). + * Deprecated created() because it could return one of three different + file times depending on the OS and filesystem type, without the + ability to determine which one is which. It is replaced by + metadataChangeTime() and birthTime(). + * Added QFileInfo::metadataChangeTime(), which returns the time the + file's metadata was last changed, if it is known, and falling back to + the same value as lastModified() otherwise. On Unix systems, this + corresponds to the file's ctime. + * Added QFileInfo::birthTime(), which returns the file's birth time if + it is known, an invalid QDateTime otherwise. This function is + supported on Windows and on some Unix systems. + + - QIODevice: + * Added skip() method to improve performance in read operations. + + - QLatin1String: + * Added isEmpty(), isNull(). + * Added iterators, {c,}{r,}{begin,end}(). + * Added chopped(), chop(), truncate(). + * Added startsWith(), endsWith(). + * Added a constructor taking two pointers, complementing the constructor + that takes a pointer and a length. + * Added trimmed() function. + + - QLocale: + * Added toString(QDate/QTime/QDateTime) overloads taking the format + string as a QStringView. + * Added QLocale::formattedDataSize() for formatting quantities of bytes + as kB, MB, GB etc. + + - QLockFile: + * Fixed a bug that would cause QLockFile to mis-identify valid lock + files as stale if the application name was set with + QCoreApplication::setApplicationName(). + + - QMimeType: + * Add Q_GADGET, so that QML applications can make use of QMimeType's + properties and methods. + + - QObject: + * [QTBUG-60339] Added connect() support for move-only function objects. + + - QProcess: + * [QTBUG-2058][QTBUG-2284][QTBUG-37656][QTBUG-52405][QTBUG-57687] Added + non-static QProcess::startDetached to support more features for + detached processes. + * [QTBUG-2284] Added the ability to set a custom process environment for + detached processes. + * [QTBUG-52405] Added the ability to specify native arguments for + detached processes on Windows. + * [QTBUG-2058][QTBUG-37656] Added support for standard channel + redirection using setStandard{Input|Output|Error}File to + QProcess::startDetached. + + - QSaveFile: + * [QTBUG-47379] Saving to Alternate Data Streams on NTFS on Windows is + now possible, but requires setDirectWriteFallback(true). + + - QSemaphore: + * Added a new RAII class, QSemaphoreReleaser, to reliably perform + release() calls. + + - QSettings: + * [QTBUG-47379] Added setAtomicSyncRequired(), which allows one to use + QSettings with config files in unwriteable directories or in Alternate + Data Streams on NTFS on Windows. This used to work before Qt 5.4, but + remains a non-default behavior due to the potential of data + corruption. + + - QSortFilterProxyModel: + * QSortFilterProxyModel now does not emit an unnecessary layoutChanged() + following a model reset. + + - QStandardPaths: + * On Windows, QStandardPaths now also looks into + "/data/" for non-generic paths. + + - QString: + * Added arg(QStringView), arg(QLatin1String) overloads. + * Added shrink_to_fit(), for compatibility with the Standard + Library. This function does the same as squeeze(). + + - QString/QStringRef: + * Added startsWith(), endsWith() overloads taking QStringView. + + - QString/QStringRef/QByteArray: + * Added chopped(n), a const version of chop(n). + + - QString/QStringRef/QByteArray/QLatin1String: + * Added front() and back() for STL compatibility. + + - QStringBuilder: + * Added support for (non-const) char*. + + - QStringList: + * Added contains(QLatin1String) overload. + + - QStringRef: + * trimmed() now returns an empty string-ref for an empty input. Before, + it would return a null one. + + - QStringView: + * New class, superseding const QString and QStringRef as function + parameters, accepting a wide variety of UTF-16 string data sources, + e.g. u"string", std::u16string{,_view}, and, on Windows, L"string", + std::wstring{,_view} without converting to QString first. + + - QTemporaryDir: + * The class now supports the "XXXXXX" replacement token anywhere in the + template, not just at the end. This behavior is similar to what + QTemporaryFile supports. + + - QTextCodec: + * Added fromUnicode() and canEncode() overloads taking QStringView. + + - QTextEncoder: + * Added fromUnicode() overload taking QStringView. + + - QThread: + * Added the QThread::create() function. + * An exception escaping from QThread::run() will now result in immediate + and abnormal program termination. The same applies if an exception + leaves a slot connected directly to the QThread::started() or + QThread::finished() signals. + + - QUuid: + * Added fromString(QStringView/QLatin1String). + + - QVariant: + * QVariants containing pointers will now return true on isNull() if the + contained pointer is null. + + - QVarLengthArray: + * Added shrink_to_fit(), for compatibility with the Standard Library. + + - QVector: + * Added shrink_to_fit(), for compatibility with the Standard Library. + + - QVersionNumber: + * Added QStringView and QLatin1String overloads of fromString(). + + - QtGlobal: + * Q_ASSERT() and Q_ASSERT_X() now always expand to expressions of type + void that are usable in constexpr contexts. This makes them usable in + both C++11 and C++14 constexpr functions and in comma expressions. + +QtGui +----- + + - [QTBUG-55981] Added support for rendering to QWindow via the Vulkan + graphics API. + - [QTBUG-55981] Added QVulkanWindow, a convenience subclass of QWindow. + - Added support for the OpenGL ES 3.2 API in QOpenGLExtraFunctions + - [QTBUG-50987] Added support for requesting OpenGL windows with + sRGB-capable default framebuffers. While this is implicit on some + platforms, QSurfaceFormat now has the necessary flags to request such + windows in a cross-platform manner. + - High DPI variants of 9-patch images can now be loaded using the + following syntax: "foo@2x.9.png" + - It's now possible to retrieve the screen at a given point via + QGuiApplication::screenAt(). + + - Important Behvior Changes: + * [QTBUG-56848][QTCREATORBUG-17683] Changed CSS line-height property + with multiplier to follow CSS spec + + - Tablet support: + * [QTBUG-44964] If the application attribute AA_CompressTabletEvents is + set in addition to AA_CompressHighFrequencyEvents, even the + QTabletEvents will be compressed (only on the X11 platform so far). + AA_CompressHighFrequencyEvents does not enable compression of tablet + events by itself, because paint applications typically need to process + all possible tablet events in order to draw the smoothest curves. + + - QPA: + * [QTBUG-57608] QWindowSystemInterfacePrivate::handleGeometryChange no + longer takes the old geometry as an argument. + + - QImage: + * QImages can now use more than 2GByte of pixel data. + + - QCursor: + * Added equality operators. + + - QImageWriter: + * Add QImageWriter::InvalidImageError to communicate invalid attempts to + write a bad QImage (for instance, a null QImage). + + - QMovie: + * Added lastError and lastErrorString accessors, as a convenience over + connecting to the error() signal. + + - QWindow: + * setMask() no longer requires the window to be created to have an + effect; it can be set at any time. + + - Text: + * [QTBUG-56728] Added QFont::PreferNoShaping style strategy to support + improvements to performance at the expense of some cosmetic font + features. + + - Windows: + * [QTBUG-55967] Native menus have been implemented. + * A native system tray icon is now available for SystemTrayIcon. + +QtNetwork +--------- + + - [QTBUG-56102] QSslSocket can now use a temporary keychain on macOS. + - Fixed a proxy-authentication issue, after a wrong password has been used, + when supplying the right password. + + - HTTP/2: + * [QTBUG-61397] In case of clear text HTTP/2 we now initiate a required + protocol upgrade procedure instead of 'H2Direct' connection. + + - QHostInfo: + * Added swap() and move operator. + + - QLocalServer: + * [QTBUG-55043] Added a function to retrieve the socket descriptor. + + - QNetworkAccessManager: + * [QTBUG-63075] Added support for HTTP status 308. + + - QNetworkInterface: + * [QTBUG-51922] Changed allAddresses() to not include addresses found in + inactive interfaces, matching the user expectations of this function. + If those addresses are needed for some purpose, the application can + call allInterfaces() and obtain the addresses in each interface. + + - QNetworkProxy: + * [QTBUG-45495] Setting of network proxies is now supported on UWP. + * [QTBUG-45495] UWP now supports proxies using SOCKS5. + * The functions related to QNetworkConfiguration are deprecated. They've + performed no action since Qt 5.0, so code using them can safely stop + doing so. + + - QSslSocket: + * [QTBUG-52905] Added OpenSSL 1.1 backend. + +QtSql +----- + + - QSqlError: + * Added swap(). + + - SQLite: + * Named placeholder can now be used. If compiling Qt by hand and using + system libraries, this feature requires at least SQLite 3.3.11. + * [QTBUG-18084] Added QSQLITE_ENABLE_REGEXP connect option for the SQLite + backend. If set, a Qt based regexp() implementation is provided + allowing use of REGEXP in SQL statements. + +QtTest +------ + + - [QTBUG-53381] Added keySequence() function. + + - QCOMPARE: + * Can now be used for mixed-type comparisons. + * Now outputs contents of QPair and std::pair on failure. + * Now supports printing QStringViews in case of test failures. + +QtWidgets +--------- + + - The windowsxp style is no longer available as a separate style, because + it did not (and cannot) actually provide an XP-style appearance on + currently supported Qt platforms. + - Added AA_DisableWindowContextHelpButton attribute. Setting this + attribute globally prevents the automatic "What's this" button on + dialogs on Windows (WindowsContextHelpButtonHint). + - [QTBUG-56860] Fixed widget losing focus after showing menu second time. + - [QTBUG-47185][QTBUG-61280] QOpenGLWidget is now able to render and + return its content via grabFramebuffer(), QWidget::grab() or + QWidget::render() even when the widget has not been made visible. + - [QTBUG-10907] When tabbing to a widget with focus proxy, focus will now + be given to the proxy rather than just being ignored. + + - ItemViews: + * Made it easier to drop above and below items. + + - QAbstractItemView/QTreeWidget/QTableWidget/QListWidget: + * [QTBUG-61139] Added isPersistentEditorOpen(). + + - QDockWidget: + * When QMainWindow::GrouppedDragging and QMainWindow::AllowNestedDocks + are both enabled, floating dock widgets now have the ability to be + dropped together side by side. + * [QTBUG-63526] Fixed an issue in QDockWidgets where the widget would + not resize despite showing a resize cursor. + + - QFusionStyle: + * The default palette used by the platform-agnostic Fusion style has + been desaturated. Previously the window background color, and other + colors derived from it, were brown shades. Now these colors are + neutral gray that fit better on any desktop. + + - QInputDialog: + * [QTBUG-17547] Added setDoubleStep to enable changing of the step + amount for getDouble(). + + - QLineEdit: + * Added selectionEnd(), selectionLength(), complementing + selectionStart(). + + - QOpenGLWidget: + * [QTBUG-50987] Added support for specifying custom internal texture + formats in QOpenGLWidget in order to make it possible to have the + widget backed by an sRGB-capable framebuffer. + + - QSplashScreen: + * All constructors now implicitly set Qt::FramelessWindowHint, not just + the (pixmap, flags) one. + + - QWidget: + * [QTBUG-10907] QWidget::setTabOrder() will now preserve the local tab + order inside a widget if it has a focus proxy set to an inner child. + + - Styles: + * Added SH_Widget_Animation_Duration style hint which supersedes + SH_Widget_Animate, which is now deprecated. + + - Text: + * Introduced tabStopDistance property in QTextOption, QTextEdit and + QPlainTextEdit as replacement for the inconsistently named tabStop and + tabStopWidth properties. QTextOption::tabStop, QTextEdit::tabStopWidth + and QPlainTextEdit::tabStopWidth are now deprecated. + +**************************************************************************** +* Platform-specific Changes * +**************************************************************************** + + - [QTBUG-60268] Input context is now supported with the offscreen platform. + +Android +------- + + - QtLoader: Enabled loading shared libraries from /system/lib or a custom + path specified with the android.app.system_libs_prefix metadata variable in + AndroidManifest.xml. This supports deploying Qt apps as Android system + apps. + - [QTBUG-58060] Android dialogs now have more appropriate button layouts, + with affirmative actions on the right. + - [QTBUG-59175] QWidget::createWindowContainer() is now supported on + Android for embedding OpenGL-based QWindows into widget UIs. + +iOS +--- + + - [QTBUG-59403] Support added for using the input panel as a trackpad + using two-finger swipe. + - The minimum deployment target for applications is now iOS 10.0. + +Linux +----- + + - XInput device property changes are now detected at runtime (no + application restart required). + - [QTBUG-60513][QTBUG-29278][QTBUG-43768][QTBUG-18380] The _NET_WORKAREA + atom is used for calculating QScreen::availableGeometry() only on systems + with one monitor. In all other cases QScreen::availableGeometry() is + equal to QScreen::geometry(). To restore the legacy behavior with + untrustworthy values in QScreen::availableGeometry() set + QT_RELY_ON_NET_WORKAREA_ATOM=1 in the environment. + - The QT_XCB_NO_XI2_MOUSE environment variable is deprecated and will be + removed in Qt 6. If your application relies on behavior set by + QT_XCB_NO_XI2_MOUSE, it should be updated accordingly. + + - Pointer event delivery on X11 is now done starting from XInput version + 2.0 (when available) instead of 2.2. XInput support can be disabled by + setting QT_XCB_NO_XI2=1 in the environment; note that doing so will also + disable tablet and touch support. + + - Qt uses the statx(2) system call for obtaining file information on + kernels 4.12 and later. Some older container systems install system call + protection rules that do not include this system call. If you experience + problems running Qt applications inside containers (such as the report of + a file not existing when it does), ensure the statx(2) is allowed in the + container configuration. + + - Linux/XCB: + * Added screen product information from EDID. + + - eglfs/KMS: + * Screen modes, including current and preferred ones, are now listed. + * Added screen product information from EDID. + +Windows +------- + + - Accessibility: + * MinGW builds now support IAccessible2. + + - Fonts: + * [QTBUG-62176] Some key fonts, such as Calibri, were being detected as + bitmap fonts and not rendered correctly in Qt Quick. This has now been + fixed. + +**************************************************************************** +* Tools * +**************************************************************************** + +moc +--- + + - moc now supports NOTIFY signals of parent classes in Q_PROPERTY + +qmake +----- + + - If you use CONFIG+=qmltestcase with no SOURCES, 'make check' will now + run qmltestrunner for you. + +uic +--- + + - Old images embedded in ui files, imported from Qt 3, are now ignored. + uic will now behave consistently with Qt Designer - both will ignore + them. -- cgit v1.2.3 From 4be50ecafd3cc63469504aaae8ac28ff0736989d Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Tue, 7 Nov 2017 14:08:54 -0800 Subject: QTemporaryFile: fix issues with removing a file twice The assertion in isUnnamedFile() we had was incorrect after the file was removed, since we cleared the name and possibly reset back to the template. Since ~QTemporaryFile() calls remove(), this was easy to trigger if you attempted to remove the temp file and leave QTemporaryFile like that. Take this opportunity to add to the docs of setAutoRemove() explaining the possibility of unnamed files. #7 0x00007f69bcc2b50e in qt_assert ( assertion=assertion@entry=0x7f69bcf194a0 "unnamedFile == d_func()->fileEntry.isEmpty()", file=file@entry=0x7f69bcf19458 "io/qtemporaryfile.cpp", line=line@entry=514) at global/qglobal.cpp:3123 #8 0x00007f69bcd672cf in QTemporaryFileEngine::isUnnamedFile (this=this@entry=0x55cd60644df0) at io/qtemporaryfile.cpp:514 #9 0x00007f69bcd683f7 in QTemporaryFileEngine::remove (this=0x55cd60644df0) at io/qtemporaryfile.cpp:396 #10 0x00007f69bcd48654 in QFile::remove (this=this@entry=0x7fffb393f7e0) at io/qfile.cpp:513 #11 0x00007f69bcd6653b in QTemporaryFile::~QTemporaryFile (this=0x7fffb393f7e0, __in_chrg=) at io/qtemporaryfile.cpp:719 Change-Id: I57a1bd6e0c194530b732fffd14f4ed28ca8185b2 Reviewed-by: Andreas Hartmetz Reviewed-by: Thiago Macieira --- src/corelib/io/qfile.cpp | 3 ++- src/corelib/io/qfsfileengine_p.h | 3 +++ src/corelib/io/qtemporaryfile.cpp | 22 +++++++++++++++++++--- src/corelib/io/qtemporaryfile_p.h | 2 +- .../io/qtemporaryfile/tst_qtemporaryfile.cpp | 20 ++++++++++++++++++-- 5 files changed, 43 insertions(+), 7 deletions(-) diff --git a/src/corelib/io/qfile.cpp b/src/corelib/io/qfile.cpp index bac995ff25..e4888e9523 100644 --- a/src/corelib/io/qfile.cpp +++ b/src/corelib/io/qfile.cpp @@ -503,7 +503,8 @@ bool QFile::remove() { Q_D(QFile); - if (d->fileName.isEmpty()) { + if (d->fileName.isEmpty() && + !static_cast(d->engine())->isUnnamedFile()) { qWarning("QFile::remove: Empty or null file name"); return false; } diff --git a/src/corelib/io/qfsfileengine_p.h b/src/corelib/io/qfsfileengine_p.h index 1f34dfc2be..faef84cbe2 100644 --- a/src/corelib/io/qfsfileengine_p.h +++ b/src/corelib/io/qfsfileengine_p.h @@ -112,6 +112,9 @@ public: qint64 write(const char *data, qint64 len) Q_DECL_OVERRIDE; bool cloneTo(QAbstractFileEngine *target) override; + virtual bool isUnnamedFile() const + { return false; } + bool extension(Extension extension, const ExtensionOption *option = 0, ExtensionReturn *output = 0) Q_DECL_OVERRIDE; bool supportsExtension(Extension extension) const Q_DECL_OVERRIDE; diff --git a/src/corelib/io/qtemporaryfile.cpp b/src/corelib/io/qtemporaryfile.cpp index b8d3e859cf..35699d52df 100644 --- a/src/corelib/io/qtemporaryfile.cpp +++ b/src/corelib/io/qtemporaryfile.cpp @@ -393,7 +393,9 @@ bool QTemporaryFileEngine::remove() // we must explicitly call QFSFileEngine::close() before we remove it. d->unmapAll(); QFSFileEngine::close(); - if (isUnnamedFile() || QFSFileEngine::remove()) { + if (isUnnamedFile()) + return true; + if (!filePathIsTemplate && QFSFileEngine::remove()) { d->fileEntry.clear(); // If a QTemporaryFile is constructed using a template file path, the path // is generated in QTemporaryFileEngine::open() and then filePathIsTemplate @@ -511,7 +513,10 @@ bool QTemporaryFileEngine::materializeUnnamedFile(const QString &newName, QTempo bool QTemporaryFileEngine::isUnnamedFile() const { #ifdef LINUX_UNNAMED_TMPFILE - Q_ASSERT(unnamedFile == d_func()->fileEntry.isEmpty()); + if (unnamedFile) { + Q_ASSERT(d_func()->fileEntry.isEmpty()); + Q_ASSERT(filePathIsTemplate); + } return unnamedFile; #else return false; @@ -749,10 +754,21 @@ bool QTemporaryFile::autoRemove() const } /*! - Sets the QTemporaryFile into auto-remove mode if \a b is true. + Sets the QTemporaryFile into auto-remove mode if \a b is \c true. Auto-remove is on by default. + If you set this property to \c false, ensure the application provides a way + to remove the file once it is no longer needed, including passing the + responsibility on to another process. Always use the fileName() function to + obtain the name and never try to guess the name that QTemporaryFile has + generated. + + On some systems, if fileName() is not called before closing the file, the + temporary file may be removed regardless of the state of this property. + This behavior should not be relied upon, so application code should either + call fileName() or leave the auto removal functionality enabled. + \sa autoRemove(), remove() */ void QTemporaryFile::setAutoRemove(bool b) diff --git a/src/corelib/io/qtemporaryfile_p.h b/src/corelib/io/qtemporaryfile_p.h index f74e5680b9..c3a2c01790 100644 --- a/src/corelib/io/qtemporaryfile_p.h +++ b/src/corelib/io/qtemporaryfile_p.h @@ -140,7 +140,7 @@ public: enum MaterializationMode { Overwrite, DontOverwrite, NameIsTemplate }; bool materializeUnnamedFile(const QString &newName, MaterializationMode mode); - bool isUnnamedFile() const; + bool isUnnamedFile() const override final; const QString &templateName; quint32 fileMode; diff --git a/tests/auto/corelib/io/qtemporaryfile/tst_qtemporaryfile.cpp b/tests/auto/corelib/io/qtemporaryfile/tst_qtemporaryfile.cpp index f3ce902bbd..2d87c2193b 100644 --- a/tests/auto/corelib/io/qtemporaryfile/tst_qtemporaryfile.cpp +++ b/tests/auto/corelib/io/qtemporaryfile/tst_qtemporaryfile.cpp @@ -70,6 +70,7 @@ private slots: void io(); void openCloseOpenClose(); void removeAndReOpen(); + void removeUnnamed(); void size(); void resize(); void openOnRootDrives(); @@ -442,11 +443,13 @@ void tst_QTemporaryFile::removeAndReOpen() { QTemporaryFile file; file.open(); - fileName = file.fileName(); + fileName = file.fileName(); // materializes any unnamed file QVERIFY(QFile::exists(fileName)); - file.remove(); + QVERIFY(file.remove()); + QVERIFY(file.fileName().isEmpty()); QVERIFY(!QFile::exists(fileName)); + QVERIFY(!file.remove()); QVERIFY(file.open()); QCOMPARE(QFileInfo(file.fileName()).path(), QFileInfo(fileName).path()); @@ -456,6 +459,19 @@ void tst_QTemporaryFile::removeAndReOpen() QVERIFY(!QFile::exists(fileName)); } +void tst_QTemporaryFile::removeUnnamed() +{ + QTemporaryFile file; + file.open(); + + // we did not call fileName(), so the file name may not have a name + QVERIFY(file.remove()); + QVERIFY(file.fileName().isEmpty()); + + // if it was unnamed, this will succeed again, so we can't check the result + file.remove(); +} + void tst_QTemporaryFile::size() { QTemporaryFile file; -- cgit v1.2.3 From 36984dc8cec09703290692ce7e899e88754173c4 Mon Sep 17 00:00:00 2001 From: Jake Petroules Date: Tue, 21 Nov 2017 11:37:31 -0800 Subject: Move a QRegExp out of a deeply nested loop This helps alleviate a performance issues where by building iOS based projects takes a significantly longer amount of time than it should. Task-number: QTBUG-59136 Change-Id: I77ae12f507725ceb11106b484d73bb7d46e0845c Reviewed-by: Oswald Buddenhagen --- qmake/generators/makefile.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/qmake/generators/makefile.cpp b/qmake/generators/makefile.cpp index a1f3352aa3..82573347b6 100644 --- a/qmake/generators/makefile.cpp +++ b/qmake/generators/makefile.cpp @@ -2164,9 +2164,9 @@ MakefileGenerator::writeExtraVariables(QTextStream &t) ProStringList outlist; const ProValueMap &vars = project->variables(); const ProStringList &exports = project->values("QMAKE_EXTRA_VARIABLES"); - for (ProValueMap::ConstIterator it = vars.begin(); it != vars.end(); ++it) { - for (ProStringList::ConstIterator exp_it = exports.begin(); exp_it != exports.end(); ++exp_it) { - QRegExp rx((*exp_it).toQString(), Qt::CaseInsensitive, QRegExp::Wildcard); + for (ProStringList::ConstIterator exp_it = exports.begin(); exp_it != exports.end(); ++exp_it) { + QRegExp rx((*exp_it).toQString(), Qt::CaseInsensitive, QRegExp::Wildcard); + for (ProValueMap::ConstIterator it = vars.begin(); it != vars.end(); ++it) { if (rx.exactMatch(it.key().toQString())) outlist << ("EXPORT_" + it.key() + " = " + it.value().join(' ')); } -- cgit v1.2.3 From 915a81d7122fbcb6b28a5368c4d0364f60159bd6 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Wed, 22 Nov 2017 20:29:45 +0100 Subject: amend changelog, mostly with buildsystem-related stuff Change-Id: I8da9054415457e61c219933622d866b6cd72d30b Reviewed-by: Lars Knoll --- dist/changes-5.10.0 | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/dist/changes-5.10.0 b/dist/changes-5.10.0 index b76f51543b..6c46c900b2 100644 --- a/dist/changes-5.10.0 +++ b/dist/changes-5.10.0 @@ -541,6 +541,12 @@ Windows bitmap fonts and not rendered correctly in Qt Quick. This has now been fixed. +X11 +--- + + - Native painting (instead of software rasterization) has been experimentally + re-introduced. Enabled by the configure option -xcb-native-painting. + **************************************************************************** * Tools * **************************************************************************** @@ -553,12 +559,19 @@ moc qmake ----- + - [QTBUG-1581] Introduced the variable OBJECTIVE_HEADERS. + - [QTBUG-11117][nmake] Added support for precompiled header also for + plain C files. + - Added versionAtLeast() and versionAtMost() test functions. - If you use CONFIG+=qmltestcase with no SOURCES, 'make check' will now run qmltestrunner for you. + - [Darwin] Added support for Info.plist in non-bundle apps and libs. uic --- + - [QTBUG-51602] Added the no-stringliteral option, to be used for building + shared objects which are meant to be unloadable. - Old images embedded in ui files, imported from Qt 3, are now ignored. uic will now behave consistently with Qt Designer - both will ignore them. -- cgit v1.2.3 From 2aaf5753197c87a0b3730850a1ab851ffb854d9e Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Thu, 7 Sep 2017 08:01:00 -0300 Subject: Fix the build if st_atimensec is defined It's a trick used by some C libraries to keep compatibility with BSD extensions while supporting POSIX.1-2008 API. st_atimensec is defined as st_atim.tv_nsec, so the code would expand to invalid C++ In substitution of 'template typename std::enable_if<((&T::st_atim.tv_nsec), true), long long int>::type{anonymous}::GetFileTimes::atime(const T&, int) [with T = stat]': error: invalid use of non-static data member 'stat::st_atim' Change-Id: I38341f8155354cc4a776fffd14e20f4fc0f6d5bb Reviewed-by: BogDan Vatra Reviewed-by: Lars Knoll --- src/corelib/io/qfilesystemengine_unix.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/corelib/io/qfilesystemengine_unix.cpp b/src/corelib/io/qfilesystemengine_unix.cpp index 4051dc43a1..b1f2fca32b 100644 --- a/src/corelib/io/qfilesystemengine_unix.cpp +++ b/src/corelib/io/qfilesystemengine_unix.cpp @@ -202,6 +202,8 @@ static inline typename QtPrivate::QEnableIf<(&T::st_atimespec, &T::st_mtimespec, modification->tv_usec = p->st_mtimespec.tv_nsec / 1000; } +# ifndef st_atimensec +// if "st_atimensec" is defined, this would expand to invalid C++ template static inline typename QtPrivate::QEnableIf<(&T::st_atimensec, &T::st_mtimensec, true)>::Type get(const T *p, struct timeval *access, struct timeval *modification) { @@ -211,6 +213,7 @@ static inline typename QtPrivate::QEnableIf<(&T::st_atimensec, &T::st_mtimensec, modification->tv_sec = p->st_mtime; modification->tv_usec = p->st_mtimensec / 1000; } +# endif #endif qint64 timespecToMSecs(const timespec &spec) @@ -268,6 +271,7 @@ mtime(const T &statBuffer, int) { return timespecToMSecs(statBuffer.st_mtimespec); } #endif +#ifndef st_mtimensec // Xtimensec template Q_DECL_UNUSED static typename std::enable_if<(&T::st_atimensec, true), qint64>::type @@ -288,8 +292,9 @@ template Q_DECL_UNUSED static typename std::enable_if<(&T::st_mtimensec, true), qint64>::type mtime(const T &statBuffer, int) { return statBuffer.st_mtime * Q_INT64_C(1000) + statBuffer.st_mtimensec / 1000000; } -} -} +#endif +} // namespace GetFileTimes +} // unnamed namespace #ifdef STATX_BASIC_STATS static int qt_real_statx(int fd, const char *pathname, int flags, struct statx *statxBuffer) -- cgit v1.2.3 From 7db0436ed2fee71cee086d77a2572886c31e072a Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Thu, 23 Nov 2017 08:48:11 -0800 Subject: Changelog edit: move the X11 entries from "Linux" to "X11" Change-Id: I5892efbfc2924eabbafafffd14f9c4f69a5c6416 Reviewed-by: Gatis Paeglis Reviewed-by: Allan Sandfeld Jensen --- dist/changes-5.10.0 | 33 ++++++++++++++++----------------- 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/dist/changes-5.10.0 b/dist/changes-5.10.0 index 6c46c900b2..002b58d3b4 100644 --- a/dist/changes-5.10.0 +++ b/dist/changes-5.10.0 @@ -499,23 +499,6 @@ iOS Linux ----- - - XInput device property changes are now detected at runtime (no - application restart required). - - [QTBUG-60513][QTBUG-29278][QTBUG-43768][QTBUG-18380] The _NET_WORKAREA - atom is used for calculating QScreen::availableGeometry() only on systems - with one monitor. In all other cases QScreen::availableGeometry() is - equal to QScreen::geometry(). To restore the legacy behavior with - untrustworthy values in QScreen::availableGeometry() set - QT_RELY_ON_NET_WORKAREA_ATOM=1 in the environment. - - The QT_XCB_NO_XI2_MOUSE environment variable is deprecated and will be - removed in Qt 6. If your application relies on behavior set by - QT_XCB_NO_XI2_MOUSE, it should be updated accordingly. - - - Pointer event delivery on X11 is now done starting from XInput version - 2.0 (when available) instead of 2.2. XInput support can be disabled by - setting QT_XCB_NO_XI2=1 in the environment; note that doing so will also - disable tablet and touch support. - - Qt uses the statx(2) system call for obtaining file information on kernels 4.12 and later. Some older container systems install system call protection rules that do not include this system call. If you experience @@ -546,6 +529,22 @@ X11 - Native painting (instead of software rasterization) has been experimentally re-introduced. Enabled by the configure option -xcb-native-painting. + - XInput device property changes are now detected at runtime (no + application restart required). + - [QTBUG-60513][QTBUG-29278][QTBUG-43768][QTBUG-18380] The _NET_WORKAREA + atom is used for calculating QScreen::availableGeometry() only on systems + with one monitor. In all other cases QScreen::availableGeometry() is + equal to QScreen::geometry(). To restore the legacy behavior with + untrustworthy values in QScreen::availableGeometry() set + QT_RELY_ON_NET_WORKAREA_ATOM=1 in the environment. + - The QT_XCB_NO_XI2_MOUSE environment variable is deprecated and will be + removed in Qt 6. If your application relies on behavior set by + QT_XCB_NO_XI2_MOUSE, it should be updated accordingly. + + - Pointer event delivery on X11 is now done starting from XInput version + 2.0 (when available) instead of 2.2. XInput support can be disabled by + setting QT_XCB_NO_XI2=1 in the environment; note that doing so will also + disable tablet and touch support. **************************************************************************** * Tools * -- cgit v1.2.3 From 07fcfb793d52b94f0f108cbfc025050b2353f9a1 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Fri, 24 Nov 2017 11:41:32 +0100 Subject: Fix regression in painted emoji offset Factor out translation from the matrix applied on bitmap glyphs, as that gets applied as position when painted. Task-number: QTBUG-64313 Change-Id: Iab8d995c00ee02eda0896242903312d837b6d790 Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/platformsupport/fontdatabases/freetype/qfontengine_ft.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/platformsupport/fontdatabases/freetype/qfontengine_ft.cpp b/src/platformsupport/fontdatabases/freetype/qfontengine_ft.cpp index 73def00017..ec2017ced4 100644 --- a/src/platformsupport/fontdatabases/freetype/qfontengine_ft.cpp +++ b/src/platformsupport/fontdatabases/freetype/qfontengine_ft.cpp @@ -1773,7 +1773,10 @@ QFixed QFontEngineFT::scaledBitmapMetrics(QFixed m) const glyph_metrics_t QFontEngineFT::scaledBitmapMetrics(const glyph_metrics_t &m, const QTransform &t) const { - QTransform trans(t); + QTransform trans; + trans.setMatrix(t.m11(), t.m12(), t.m13(), + t.m21(), t.m22(), t.m23(), + 0, 0, t.m33()); const qreal scaleFactor = scalableBitmapScaleFactor.toReal(); trans.scale(scaleFactor, scaleFactor); -- cgit v1.2.3 From 150e5055251ae9a5c40d821d377e72b14e38868d Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Sun, 26 Nov 2017 23:01:57 -0800 Subject: Stop depending on test.macieira.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We have had test.qt-project.org for close to 3 years now. Change-Id: I71488efd29b645f7b228fffd14fadf4627288243 Reviewed-by: Jędrzej Nowacki (cherry picked from commit 5f66f871816d083da9795d71f746413d6f6118f7) Reviewed-by: Frederik Gladhorn --- .../auto/network/kernel/qdnslookup_appless/tst_qdnslookup_appless.cpp | 4 ++-- tests/auto/network/kernel/qhostinfo/tst_qhostinfo.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/auto/network/kernel/qdnslookup_appless/tst_qdnslookup_appless.cpp b/tests/auto/network/kernel/qdnslookup_appless/tst_qdnslookup_appless.cpp index 7874221da9..e302fe8c74 100644 --- a/tests/auto/network/kernel/qdnslookup_appless/tst_qdnslookup_appless.cpp +++ b/tests/auto/network/kernel/qdnslookup_appless/tst_qdnslookup_appless.cpp @@ -43,7 +43,7 @@ private slots: void tst_QDnsLookup_Appless::noApplication() { QTest::ignoreMessage(QtWarningMsg, "QDnsLookup requires a QCoreApplication"); - QDnsLookup dns(QDnsLookup::A, "a-single.test.macieira.org"); + QDnsLookup dns(QDnsLookup::A, "a-single.test.qt-project.org"); dns.lookup(); } @@ -53,7 +53,7 @@ void tst_QDnsLookup_Appless::recreateApplication() char **argv = 0; for (int i = 0; i < 10; ++i) { QCoreApplication app(argc, argv); - QDnsLookup dns(QDnsLookup::A, "a-single.test.macieira.org"); + QDnsLookup dns(QDnsLookup::A, "a-single.test.qt-project.org"); dns.lookup(); if (!dns.isFinished()) { QObject::connect(&dns, SIGNAL(finished()), diff --git a/tests/auto/network/kernel/qhostinfo/tst_qhostinfo.cpp b/tests/auto/network/kernel/qhostinfo/tst_qhostinfo.cpp index f5f5146eb5..82825f608c 100644 --- a/tests/auto/network/kernel/qhostinfo/tst_qhostinfo.cpp +++ b/tests/auto/network/kernel/qhostinfo/tst_qhostinfo.cpp @@ -72,7 +72,7 @@ #include "../../../network-settings.h" -#define TEST_DOMAIN ".test.macieira.org" +#define TEST_DOMAIN ".test.qt-project.org" class tst_QHostInfo : public QObject -- cgit v1.2.3 From 275c748ada9d869d803d5f446b48b915d686ab33 Mon Sep 17 00:00:00 2001 From: David Faure Date: Mon, 28 Aug 2017 16:28:03 +0200 Subject: Fix naming of new property QSortFilterProxyModel::recursiveFiltering Add "Enabled" to match Qt API naming rules. + fix \since tag. Change-Id: Iaf312648f7385cd7e8d3d101b561fbd4e955df25 Reviewed-by: Friedemann Kleint Reviewed-by: Edward Welbourne Reviewed-by: Thiago Macieira Reviewed-by: Lars Knoll --- src/corelib/itemmodels/qsortfilterproxymodel.cpp | 8 ++++---- src/corelib/itemmodels/qsortfilterproxymodel.h | 6 +++--- .../tst_qsortfilterproxymodel_recursive.cpp | 3 ++- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/corelib/itemmodels/qsortfilterproxymodel.cpp b/src/corelib/itemmodels/qsortfilterproxymodel.cpp index ef3281df30..7dad892606 100644 --- a/src/corelib/itemmodels/qsortfilterproxymodel.cpp +++ b/src/corelib/itemmodels/qsortfilterproxymodel.cpp @@ -2657,8 +2657,8 @@ void QSortFilterProxyModel::setFilterRole(int role) } /*! - \since 5.9 - \property QSortFilterProxyModel::recursiveFiltering + \since 5.10 + \property QSortFilterProxyModel::recursiveFilteringEnabled \brief whether the filter to be applied recursively on children, and for any matching child, its parents will be visible as well. @@ -2666,13 +2666,13 @@ void QSortFilterProxyModel::setFilterRole(int role) \sa filterAcceptsRow() */ -bool QSortFilterProxyModel::recursiveFiltering() const +bool QSortFilterProxyModel::isRecursiveFilteringEnabled() const { Q_D(const QSortFilterProxyModel); return d->filter_recursive; } -void QSortFilterProxyModel::setRecursiveFiltering(bool recursive) +void QSortFilterProxyModel::setRecursiveFilteringEnabled(bool recursive) { Q_D(QSortFilterProxyModel); if (d->filter_recursive == recursive) diff --git a/src/corelib/itemmodels/qsortfilterproxymodel.h b/src/corelib/itemmodels/qsortfilterproxymodel.h index 6f2e9806ed..9f9b59733d 100644 --- a/src/corelib/itemmodels/qsortfilterproxymodel.h +++ b/src/corelib/itemmodels/qsortfilterproxymodel.h @@ -67,7 +67,7 @@ class Q_CORE_EXPORT QSortFilterProxyModel : public QAbstractProxyModel Q_PROPERTY(bool isSortLocaleAware READ isSortLocaleAware WRITE setSortLocaleAware) Q_PROPERTY(int sortRole READ sortRole WRITE setSortRole) Q_PROPERTY(int filterRole READ filterRole WRITE setFilterRole) - Q_PROPERTY(bool recursiveFiltering READ recursiveFiltering WRITE setRecursiveFiltering) + Q_PROPERTY(bool recursiveFilteringEnabled READ isRecursiveFilteringEnabled WRITE setRecursiveFilteringEnabled) public: explicit QSortFilterProxyModel(QObject *parent = Q_NULLPTR); @@ -108,8 +108,8 @@ public: int filterRole() const; void setFilterRole(int role); - bool recursiveFiltering() const; - void setRecursiveFiltering(bool recursive); + bool isRecursiveFilteringEnabled() const; + void setRecursiveFilteringEnabled(bool recursive); public Q_SLOTS: void setFilterRegExp(const QString &pattern); diff --git a/tests/auto/corelib/itemmodels/qsortfilterproxymodel_recursive/tst_qsortfilterproxymodel_recursive.cpp b/tests/auto/corelib/itemmodels/qsortfilterproxymodel_recursive/tst_qsortfilterproxymodel_recursive.cpp index 54c79e0893..9cf005af01 100644 --- a/tests/auto/corelib/itemmodels/qsortfilterproxymodel_recursive/tst_qsortfilterproxymodel_recursive.cpp +++ b/tests/auto/corelib/itemmodels/qsortfilterproxymodel_recursive/tst_qsortfilterproxymodel_recursive.cpp @@ -100,7 +100,7 @@ public: TestModel(QAbstractItemModel *sourceModel) : QSortFilterProxyModel() { - setRecursiveFiltering(true); + setRecursiveFilteringEnabled(true); setSourceModel(sourceModel); } @@ -213,6 +213,7 @@ private Q_SLOTS: QCOMPARE(treeAsString(model), sourceStr); TestModel proxy(&model); + QVERIFY(proxy.isRecursiveFilteringEnabled()); QCOMPARE(treeAsString(proxy), proxyStr); } -- cgit v1.2.3 From 8298956eb084d8f0e478240a674c5ae131c8be97 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Fri, 24 Nov 2017 10:48:36 +0100 Subject: Fix namespaced linux builds Using "struct statx" as argument type is forward declaration which then will expect the namespace where it was first encountered. Change-Id: I2d4ba930bd5b4e264228f2549bd6ef75e5cf3a67 Reviewed-by: Oswald Buddenhagen Reviewed-by: Thiago Macieira --- src/corelib/io/qfilesystemengine_unix.cpp | 5 ++++- src/corelib/io/qfilesystemmetadata_p.h | 4 ++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/corelib/io/qfilesystemengine_unix.cpp b/src/corelib/io/qfilesystemengine_unix.cpp index b1f2fca32b..77d154c6b4 100644 --- a/src/corelib/io/qfilesystemengine_unix.cpp +++ b/src/corelib/io/qfilesystemengine_unix.cpp @@ -102,6 +102,10 @@ static int statx(int dirfd, const char *pathname, int flag, unsigned mask, struc # endif #endif +#ifndef STATX_BASIC_STATS +struct statx { mode_t stx_mode; }; +#endif + QT_BEGIN_NAMESPACE #define emptyFileEntryWarning() emptyFileEntryWarning_(QT_MESSAGELOG_FILE, QT_MESSAGELOG_LINE, QT_MESSAGELOG_FUNC) @@ -390,7 +394,6 @@ inline void QFileSystemMetaData::fillFromStatxBuf(const struct statx &statxBuffe groupId_ = statxBuffer.stx_gid; } #else -struct statx { mode_t stx_mode; }; static int qt_statx(const char *, struct statx *) { return -ENOSYS; } diff --git a/src/corelib/io/qfilesystemmetadata_p.h b/src/corelib/io/qfilesystemmetadata_p.h index 55e44d52c7..4d2a5acb9b 100644 --- a/src/corelib/io/qfilesystemmetadata_p.h +++ b/src/corelib/io/qfilesystemmetadata_p.h @@ -64,6 +64,10 @@ # endif #endif +#ifdef Q_OS_UNIX +struct statx; +#endif + QT_BEGIN_NAMESPACE class QFileSystemEngine; -- cgit v1.2.3 From 984ad6124992c9831f57c2776aa2ed0a760149e6 Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Tue, 10 Oct 2017 09:42:41 +0200 Subject: Improve readability of code that uses the Qt signed size type During the container BoF session at the Qt Contributor Summit 2017 the name of the signed size type became a subject of discussion in the context of readability of code using this type and the intention of using it for all length, size and count properties throughout the entire framework in future versions of Qt. This change proposes qsizetype as new name for qssize_t to emphasize the readability of code over POSIX compatibility, the former being potentially more relevant than the latter to the majority of users of Qt. Change-Id: Idb99cb4a8782703c054fa463a9e5af23a918e7f3 Reviewed-by: Samuel Gaist Reviewed-by: David Faure --- src/corelib/global/qglobal.cpp | 8 ++--- src/corelib/global/qglobal.h | 4 +-- src/corelib/global/qrandom.cpp | 40 +++++++++++----------- src/corelib/global/qrandom.h | 10 +++--- src/corelib/io/qresource.cpp | 4 +-- src/corelib/io/qtemporaryfile_p.h | 4 +-- src/corelib/tools/qlocale.cpp | 4 +-- src/corelib/tools/qstring.cpp | 4 +-- src/corelib/tools/qstringalgorithms.h | 2 +- src/corelib/tools/qstringiterator.qdoc | 2 +- src/corelib/tools/qstringiterator_p.h | 2 +- src/corelib/tools/qstringview.cpp | 26 +++++++------- src/corelib/tools/qstringview.h | 40 +++++++++++----------- src/gui/image/qbmphandler.cpp | 4 +-- src/gui/image/qimage.cpp | 4 +-- src/gui/image/qimage.h | 2 +- src/gui/image/qimage_conversions.cpp | 28 +++++++-------- src/gui/image/qimage_p.h | 4 +-- src/gui/image/qpixmap_blitter.cpp | 2 +- src/gui/painting/qdrawhelper.cpp | 4 +-- src/gui/painting/qdrawhelper_avx2.cpp | 2 +- src/gui/painting/qdrawhelper_p.h | 4 +-- src/gui/painting/qpaintengine_raster.cpp | 10 +++--- .../corelib/tools/qstringview/tst_qstringview.cpp | 4 +-- tests/auto/gui/image/qimage/tst_qimage.cpp | 4 +-- 25 files changed, 111 insertions(+), 111 deletions(-) diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp index 36b7560398..2c2dcb663b 100644 --- a/src/corelib/global/qglobal.cpp +++ b/src/corelib/global/qglobal.cpp @@ -160,8 +160,8 @@ Q_STATIC_ASSERT_X(std::numeric_limits::radix == 2, // not required by the definition of size_t, but we depend on this Q_STATIC_ASSERT_X(sizeof(size_t) == sizeof(void *), "size_t and a pointer don't have the same size"); -Q_STATIC_ASSERT(sizeof(size_t) == sizeof(qssize_t)); // implied by the definition -Q_STATIC_ASSERT((std::is_same::value)); +Q_STATIC_ASSERT(sizeof(size_t) == sizeof(qsizetype)); // implied by the definition +Q_STATIC_ASSERT((std::is_same::value)); /*! \class QFlag @@ -824,7 +824,7 @@ Q_STATIC_ASSERT((std::is_same::value)); */ /*! - \typedef qssize_t + \typedef qsizetype \relates \since 5.10 @@ -833,7 +833,7 @@ Q_STATIC_ASSERT((std::is_same::value)); This type is guaranteed to be the same size as a \c size_t on all platforms supported by Qt. - Note that qssize_t is signed. Use \c size_t for unsigned values. + Note that qsizetype is signed. Use \c size_t for unsigned values. \sa qptrdiff */ diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index 7b691ca59e..4e7c1b59be 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -439,7 +439,7 @@ namespace QtPrivate { sizeof(void *) == sizeof(quintptr) && sizeof(void *) == sizeof(qptrdiff) - size_t and qssize_t are not guaranteed to be the same size as a pointer, but + size_t and qsizetype are not guaranteed to be the same size as a pointer, but they usually are. */ template struct QIntegerForSize; @@ -456,7 +456,7 @@ typedef QIntegerForSize::Unsigned qregisteruint; typedef QIntegerForSizeof::Unsigned quintptr; typedef QIntegerForSizeof::Signed qptrdiff; typedef qptrdiff qintptr; -using qssize_t = QIntegerForSizeof::Signed; +using qsizetype = QIntegerForSizeof::Signed; /* moc compats (signals/slots) */ #ifndef QT_MOC_COMPAT diff --git a/src/corelib/global/qrandom.cpp b/src/corelib/global/qrandom.cpp index 72ac8d332b..6769190335 100644 --- a/src/corelib/global/qrandom.cpp +++ b/src/corelib/global/qrandom.cpp @@ -93,7 +93,7 @@ DECLSPEC_IMPORT BOOLEAN WINAPI SystemFunction036(PVOID RandomBuffer, ULONG Rando QT_BEGIN_NAMESPACE #if defined(Q_PROCESSOR_X86) && QT_COMPILER_SUPPORTS_HERE(RDRND) -static qssize_t qt_random_cpu(void *buffer, qssize_t count) Q_DECL_NOTHROW; +static qsizetype qt_random_cpu(void *buffer, qsizetype count) Q_DECL_NOTHROW; # ifdef Q_PROCESSOR_X86_64 # define _rdrandXX_step _rdrand64_step @@ -101,7 +101,7 @@ static qssize_t qt_random_cpu(void *buffer, qssize_t count) Q_DECL_NOTHROW; # define _rdrandXX_step _rdrand32_step # endif -static QT_FUNCTION_TARGET(RDRND) qssize_t qt_random_cpu(void *buffer, qssize_t count) Q_DECL_NOTHROW +static QT_FUNCTION_TARGET(RDRND) qsizetype qt_random_cpu(void *buffer, qsizetype count) Q_DECL_NOTHROW { unsigned *ptr = reinterpret_cast(buffer); unsigned *end = ptr + count; @@ -122,7 +122,7 @@ out: return ptr - reinterpret_cast(buffer); } #else -static qssize_t qt_random_cpu(void *, qssize_t) +static qsizetype qt_random_cpu(void *, qsizetype) { return 0; } @@ -136,10 +136,10 @@ enum { struct QRandomGenerator::SystemGenerator { #if QT_CONFIG(getentropy) - static qssize_t fillBuffer(void *buffer, qssize_t count) Q_DECL_NOTHROW + static qsizetype fillBuffer(void *buffer, qsizetype count) Q_DECL_NOTHROW { // getentropy can read at most 256 bytes, so break the reading - qssize_t read = 0; + qsizetype read = 0; while (count - read > 256) { // getentropy can't fail under normal circumstances int ret = getentropy(reinterpret_cast(buffer) + read, 256); @@ -195,24 +195,24 @@ struct QRandomGenerator::SystemGenerator Q_DECL_CONSTEXPR SystemGenerator() : fdp1 Q_BASIC_ATOMIC_INITIALIZER(0) {} - qssize_t fillBuffer(void *buffer, qssize_t count) + qsizetype fillBuffer(void *buffer, qsizetype count) { int fd = openDevice(); if (Q_UNLIKELY(fd < 0)) return 0; qint64 n = qt_safe_read(fd, buffer, count); - return qMax(n, 0); // ignore any errors + return qMax(n, 0); // ignore any errors } #elif defined(Q_OS_WIN) && !defined(Q_OS_WINRT) - qssize_t fillBuffer(void *buffer, qssize_t count) Q_DECL_NOTHROW + qsizetype fillBuffer(void *buffer, qsizetype count) Q_DECL_NOTHROW { auto RtlGenRandom = SystemFunction036; return RtlGenRandom(buffer, ULONG(count)) ? count: 0; } #elif defined(Q_OS_WINRT) - qssize_t fillBuffer(void *, qssize_t) Q_DECL_NOTHROW + qsizetype fillBuffer(void *, qsizetype) Q_DECL_NOTHROW { // always use the fallback return 0; @@ -243,7 +243,7 @@ struct QRandomGenerator::SystemGenerator #if defined(Q_OS_WIN) static void fallback_update_seed(unsigned) {} -static void fallback_fill(quint32 *ptr, qssize_t left) Q_DECL_NOTHROW +static void fallback_fill(quint32 *ptr, qsizetype left) Q_DECL_NOTHROW { // on Windows, rand_s is a high-quality random number generator // and it requires no seeding @@ -255,14 +255,14 @@ static void fallback_fill(quint32 *ptr, qssize_t left) Q_DECL_NOTHROW } #elif QT_CONFIG(getentropy) static void fallback_update_seed(unsigned) {} -static void fallback_fill(quint32 *, qssize_t) Q_DECL_NOTHROW +static void fallback_fill(quint32 *, qsizetype) Q_DECL_NOTHROW { // no fallback necessary, getentropy cannot fail under normal circumstances Q_UNREACHABLE(); } #elif defined(Q_OS_BSD4) static void fallback_update_seed(unsigned) {} -static void fallback_fill(quint32 *ptr, qssize_t left) Q_DECL_NOTHROW +static void fallback_fill(quint32 *ptr, qsizetype left) Q_DECL_NOTHROW { // BSDs have arc4random(4) and these work even in chroot(2) arc4random_buf(ptr, left * sizeof(*ptr)); @@ -281,7 +281,7 @@ Q_NEVER_INLINE #ifdef Q_CC_GNU __attribute__((cold)) // this function is pretty big, so optimize for size #endif -static void fallback_fill(quint32 *ptr, qssize_t left) Q_DECL_NOTHROW +static void fallback_fill(quint32 *ptr, qsizetype left) Q_DECL_NOTHROW { quint32 scratch[12]; // see element count below quint32 *end = scratch; @@ -358,7 +358,7 @@ Q_NEVER_INLINE void QRandomGenerator::SystemGenerator::generate(quint32 *begin, Q_DECL_NOEXCEPT_EXPR(FillBufferNoexcept) { quint32 *buffer = begin; - qssize_t count = end - begin; + qsizetype count = end - begin; if (Q_UNLIKELY(uint(qt_randomdevice_control) & SetRandomData)) { uint value = uint(qt_randomdevice_control) & RandomDataMask; @@ -366,14 +366,14 @@ Q_NEVER_INLINE void QRandomGenerator::SystemGenerator::generate(quint32 *begin, return; } - qssize_t filled = 0; + qsizetype filled = 0; if (qt_has_hwrng() && (uint(qt_randomdevice_control) & SkipHWRNG) == 0) filled += qt_random_cpu(buffer, count); if (filled != count && (uint(qt_randomdevice_control) & SkipSystemRNG) == 0) { - qssize_t bytesFilled = - fillBuffer(buffer + filled, (count - filled) * qssize_t(sizeof(*buffer))); - filled += bytesFilled / qssize_t(sizeof(*buffer)); + qsizetype bytesFilled = + fillBuffer(buffer + filled, (count - filled) * qsizetype(sizeof(*buffer))); + filled += bytesFilled / qsizetype(sizeof(*buffer)); } if (filled) fallback_update_seed(*buffer); @@ -677,7 +677,7 @@ inline QRandomGenerator::SystemGenerator &QRandomGenerator::SystemGenerator::sel */ /*! - \fn QRandomGenerator::QRandomGenerator(const quint32 *seedBuffer, qssize_t len) + \fn QRandomGenerator::QRandomGenerator(const quint32 *seedBuffer, qsizetype len) \overload Initializes this QRandomGenerator object with \a len values found in @@ -853,7 +853,7 @@ inline QRandomGenerator::SystemGenerator &QRandomGenerator::SystemGenerator::sel */ /*! - \fn void QRandomGenerator::fillRange(UInt *buffer, qssize_t count) + \fn void QRandomGenerator::fillRange(UInt *buffer, qsizetype count) Generates \a count 32- or 64-bit quantities (depending on the type \c UInt) and stores them in the buffer pointed by \a buffer. This is the most diff --git a/src/corelib/global/qrandom.h b/src/corelib/global/qrandom.h index 005de0941f..cbeab19a7b 100644 --- a/src/corelib/global/qrandom.h +++ b/src/corelib/global/qrandom.h @@ -55,10 +55,10 @@ public: QRandomGenerator(quint32 seedValue = 1) : QRandomGenerator(&seedValue, 1) {} - template QRandomGenerator(const quint32 (&seedBuffer)[N]) + template QRandomGenerator(const quint32 (&seedBuffer)[N]) : QRandomGenerator(seedBuffer, seedBuffer + N) {} - QRandomGenerator(const quint32 *seedBuffer, qssize_t len) + QRandomGenerator(const quint32 *seedBuffer, qsizetype len) : QRandomGenerator(seedBuffer, seedBuffer + len) {} Q_CORE_EXPORT QRandomGenerator(std::seed_seq &sseq) Q_DECL_NOTHROW; @@ -131,7 +131,7 @@ public: } template = true> - void fillRange(UInt *buffer, qssize_t count) + void fillRange(UInt *buffer, qsizetype count) { _fillRange(buffer, buffer + count); } @@ -215,10 +215,10 @@ public: QRandomGenerator64(quint32 seedValue = 1) : QRandomGenerator(seedValue) {} - template QRandomGenerator64(const quint32 (&seedBuffer)[N]) + template QRandomGenerator64(const quint32 (&seedBuffer)[N]) : QRandomGenerator(seedBuffer) {} - QRandomGenerator64(const quint32 *seedBuffer, qssize_t len) + QRandomGenerator64(const quint32 *seedBuffer, qsizetype len) : QRandomGenerator(seedBuffer, len) {} QRandomGenerator64(std::seed_seq &sseq) Q_DECL_NOTHROW diff --git a/src/corelib/io/qresource.cpp b/src/corelib/io/qresource.cpp index c1187e5145..31f02e977d 100644 --- a/src/corelib/io/qresource.cpp +++ b/src/corelib/io/qresource.cpp @@ -86,8 +86,8 @@ public: } const QChar *m_data; - qssize_t m_len; - qssize_t m_pos = 0; + qsizetype m_len; + qsizetype m_pos = 0; QChar m_splitChar = QLatin1Char('/'); }; diff --git a/src/corelib/io/qtemporaryfile_p.h b/src/corelib/io/qtemporaryfile_p.h index c3a2c01790..fb8887af53 100644 --- a/src/corelib/io/qtemporaryfile_p.h +++ b/src/corelib/io/qtemporaryfile_p.h @@ -74,8 +74,8 @@ QT_BEGIN_NAMESPACE struct QTemporaryFileName { QFileSystemEntry::NativePath path; - qssize_t pos; - qssize_t length; + qsizetype pos; + qsizetype length; QTemporaryFileName(const QString &templateName); QFileSystemEntry::NativePath generateNext(); diff --git a/src/corelib/tools/qlocale.cpp b/src/corelib/tools/qlocale.cpp index 723e63114d..166cbe8dee 100644 --- a/src/corelib/tools/qlocale.cpp +++ b/src/corelib/tools/qlocale.cpp @@ -576,7 +576,7 @@ int qt_repeatCount(QStringView s) if (s.isEmpty()) return 0; const QChar c = s.front(); - qssize_t j = 1; + qsizetype j = 1; while (j < s.size() && s.at(j) == c) ++j; return int(j); @@ -3443,7 +3443,7 @@ bool QLocaleData::validateChars(QStringView str, NumberMode numMode, QByteArray bool dec = false; int decDigitCnt = 0; - for (qssize_t i = 0; i < str.size(); ++i) { + for (qsizetype i = 0; i < str.size(); ++i) { char c = digitToCLocale(str.at(i)); if (c >= '0' && c <= '9') { diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp index c10987a5fe..bba0a85319 100644 --- a/src/corelib/tools/qstring.cpp +++ b/src/corelib/tools/qstring.cpp @@ -160,9 +160,9 @@ static inline bool qt_ends_with(QStringView haystack, QStringView needle, Qt::Ca static inline bool qt_ends_with(QStringView haystack, QLatin1String needle, Qt::CaseSensitivity cs); static inline bool qt_ends_with(QStringView haystack, QChar needle, Qt::CaseSensitivity cs); -qssize_t QtPrivate::qustrlen(const ushort *str) Q_DECL_NOTHROW +qsizetype QtPrivate::qustrlen(const ushort *str) Q_DECL_NOTHROW { - qssize_t result = 0; + qsizetype result = 0; #ifdef __SSE2__ // find the 16-byte alignment immediately prior or equal to str diff --git a/src/corelib/tools/qstringalgorithms.h b/src/corelib/tools/qstringalgorithms.h index 336da87468..aaa702301e 100644 --- a/src/corelib/tools/qstringalgorithms.h +++ b/src/corelib/tools/qstringalgorithms.h @@ -55,7 +55,7 @@ template class QVector; namespace QtPrivate { -Q_REQUIRED_RESULT Q_CORE_EXPORT Q_DECL_PURE_FUNCTION qssize_t qustrlen(const ushort *str) Q_DECL_NOTHROW; +Q_REQUIRED_RESULT Q_CORE_EXPORT Q_DECL_PURE_FUNCTION qsizetype qustrlen(const ushort *str) Q_DECL_NOTHROW; Q_REQUIRED_RESULT Q_CORE_EXPORT Q_DECL_PURE_FUNCTION int compareStrings(QStringView lhs, QStringView rhs, Qt::CaseSensitivity cs = Qt::CaseSensitive) Q_DECL_NOTHROW; Q_REQUIRED_RESULT Q_CORE_EXPORT Q_DECL_PURE_FUNCTION int compareStrings(QStringView lhs, QLatin1String rhs, Qt::CaseSensitivity cs = Qt::CaseSensitive) Q_DECL_NOTHROW; diff --git a/src/corelib/tools/qstringiterator.qdoc b/src/corelib/tools/qstringiterator.qdoc index 95c2247bc1..caec8803f3 100644 --- a/src/corelib/tools/qstringiterator.qdoc +++ b/src/corelib/tools/qstringiterator.qdoc @@ -120,7 +120,7 @@ */ /*! - \fn QStringIterator::QStringIterator(QStringView string, qssize_t idx) + \fn QStringIterator::QStringIterator(QStringView string, qsizetype idx) Constructs an iterator over the contents of \a string. The iterator will point before position \a idx in the string. diff --git a/src/corelib/tools/qstringiterator_p.h b/src/corelib/tools/qstringiterator_p.h index 8b1a6a1cd3..219589b6e4 100644 --- a/src/corelib/tools/qstringiterator_p.h +++ b/src/corelib/tools/qstringiterator_p.h @@ -62,7 +62,7 @@ class QStringIterator QString::const_iterator i, pos, e; Q_STATIC_ASSERT((std::is_same::value)); public: - explicit QStringIterator(QStringView string, qssize_t idx = 0) + explicit QStringIterator(QStringView string, qsizetype idx = 0) : i(string.begin()), pos(i + idx), e(string.end()) diff --git a/src/corelib/tools/qstringview.cpp b/src/corelib/tools/qstringview.cpp index 8eefc6d814..bb22239b66 100644 --- a/src/corelib/tools/qstringview.cpp +++ b/src/corelib/tools/qstringview.cpp @@ -131,9 +131,9 @@ QT_BEGIN_NAMESPACE /*! \typedef QStringView::size_type - Alias for qssize_t. Provided for compatibility with the STL. + Alias for qsizetype. Provided for compatibility with the STL. - Unlike other Qt classes, QStringView uses qssize_t as its \c size_type, to allow + Unlike other Qt classes, QStringView uses qsizetype as its \c size_type, to allow accepting data from \c{std::basic_string} without truncation. The Qt API functions, for example length(), return \c int, while the STL-compatible functions, for example size(), return \c size_type. @@ -224,7 +224,7 @@ QT_BEGIN_NAMESPACE */ /*! - \fn QStringView::QStringView(const Char *str, qssize_t len) + \fn QStringView::QStringView(const Char *str, qsizetype len) Constructs a string view on \a str with length \a len. @@ -486,7 +486,7 @@ QT_BEGIN_NAMESPACE */ /*! - \fn qssize_t QStringView::size() const + \fn qsizetype QStringView::size() const Returns the size of this string view, in UTF-16 code points (that is, surrogate pairs count as two for the purposes of this function, the same @@ -510,7 +510,7 @@ QT_BEGIN_NAMESPACE */ /*! - \fn QChar QStringView::operator[](qssize_t n) const + \fn QChar QStringView::operator[](qsizetype n) const Returns the character at position \a n in this string view. @@ -520,7 +520,7 @@ QT_BEGIN_NAMESPACE */ /*! - \fn QChar QStringView::at(qssize_t n) const + \fn QChar QStringView::at(qsizetype n) const Returns the character at position \a n in this string view. @@ -582,7 +582,7 @@ QT_BEGIN_NAMESPACE */ /*! - \fn QStringView QStringView::mid(qssize_t start) const + \fn QStringView QStringView::mid(qsizetype start) const Returns the substring starting at position \a start in this object, and extending to the end of the string. @@ -593,7 +593,7 @@ QT_BEGIN_NAMESPACE */ /*! - \fn QStringView QStringView::mid(qssize_t start, qssize_t length) const + \fn QStringView QStringView::mid(qsizetype start, qsizetype length) const \overload Returns the substring of length \a length starting at position @@ -606,7 +606,7 @@ QT_BEGIN_NAMESPACE */ /*! - \fn QStringView QStringView::left(qssize_t length) const + \fn QStringView QStringView::left(qsizetype length) const Returns the substring of length \a length starting at position 0 in this object. @@ -617,7 +617,7 @@ QT_BEGIN_NAMESPACE */ /*! - \fn QStringView QStringView::right(qssize_t length) const + \fn QStringView QStringView::right(qsizetype length) const Returns the substring of length \a length starting at position size() - \a length in this object. @@ -628,7 +628,7 @@ QT_BEGIN_NAMESPACE */ /*! - \fn QStringView QStringView::chopped(qssize_t length) const + \fn QStringView QStringView::chopped(qsizetype length) const Returns the substring of length size() - \a length starting at the beginning of this object. @@ -641,7 +641,7 @@ QT_BEGIN_NAMESPACE */ /*! - \fn void QStringView::truncate(qssize_t length) + \fn void QStringView::truncate(qsizetype length) Truncates this string view to length \a length. @@ -653,7 +653,7 @@ QT_BEGIN_NAMESPACE */ /*! - \fn void QStringView::chop(qssize_t length) + \fn void QStringView::chop(qsizetype length) Truncates this string view by \a length characters. diff --git a/src/corelib/tools/qstringview.h b/src/corelib/tools/qstringview.h index 14405f325d..903d7ccb24 100644 --- a/src/corelib/tools/qstringview.h +++ b/src/corelib/tools/qstringview.h @@ -111,7 +111,7 @@ public: #endif typedef const QChar value_type; typedef std::ptrdiff_t difference_type; - typedef qssize_t size_type; + typedef qsizetype size_type; typedef value_type &reference; typedef value_type &const_reference; typedef value_type *pointer; @@ -139,24 +139,24 @@ private: using if_compatible_qstring_like = typename std::enable_if::value || std::is_same::value, bool>::type; template - static Q_DECL_CONSTEXPR qssize_t lengthHelperArray(const Char (&)[N]) Q_DECL_NOTHROW + static Q_DECL_CONSTEXPR qsizetype lengthHelperArray(const Char (&)[N]) Q_DECL_NOTHROW { - return qssize_t(N - 1); + return qsizetype(N - 1); } template - static qssize_t lengthHelperPointer(const Char *str) Q_DECL_NOTHROW + static qsizetype lengthHelperPointer(const Char *str) Q_DECL_NOTHROW { #if defined(Q_CC_GNU) && !defined(Q_CC_CLANG) && !defined(Q_CC_INTEL) if (__builtin_constant_p(*str)) { - qssize_t result = 0; + qsizetype result = 0; while (*str++) ++result; } #endif return QtPrivate::qustrlen(reinterpret_cast(str)); } - static qssize_t lengthHelperPointer(const QChar *str) Q_DECL_NOTHROW + static qsizetype lengthHelperPointer(const QChar *str) Q_DECL_NOTHROW { return QtPrivate::qustrlen(reinterpret_cast(str)); } @@ -174,7 +174,7 @@ public: : QStringView() {} template = true> - Q_DECL_CONSTEXPR QStringView(const Char *str, qssize_t len) + Q_DECL_CONSTEXPR QStringView(const Char *str, qsizetype len) : m_size((Q_ASSERT(len >= 0), Q_ASSERT(str || !len), len)), m_data(castHelper(str)) {} @@ -204,20 +204,20 @@ public: #else template = true> QStringView(const String &str) Q_DECL_NOTHROW - : QStringView(str.isNull() ? nullptr : str.data(), qssize_t(str.size())) {} + : QStringView(str.isNull() ? nullptr : str.data(), qsizetype(str.size())) {} #endif template = true> QStringView(const StdBasicString &str) Q_DECL_NOTHROW - : QStringView(str.data(), qssize_t(str.size())) {} + : QStringView(str.data(), qsizetype(str.size())) {} Q_REQUIRED_RESULT inline QString toString() const; // defined in qstring.h - Q_REQUIRED_RESULT Q_DECL_CONSTEXPR qssize_t size() const Q_DECL_NOTHROW { return m_size; } + Q_REQUIRED_RESULT Q_DECL_CONSTEXPR qsizetype size() const Q_DECL_NOTHROW { return m_size; } Q_REQUIRED_RESULT const_pointer data() const Q_DECL_NOTHROW { return reinterpret_cast(m_data); } Q_REQUIRED_RESULT Q_DECL_CONSTEXPR const storage_type *utf16() const Q_DECL_NOTHROW { return m_data; } - Q_REQUIRED_RESULT Q_DECL_CONSTEXPR QChar operator[](qssize_t n) const + Q_REQUIRED_RESULT Q_DECL_CONSTEXPR QChar operator[](qsizetype n) const { return Q_ASSERT(n >= 0), Q_ASSERT(n < size()), QChar(m_data[n]); } // @@ -229,22 +229,22 @@ public: Q_REQUIRED_RESULT QByteArray toLocal8Bit() const { return QtPrivate::convertToLocal8Bit(*this); } Q_REQUIRED_RESULT inline QVector toUcs4() const; // defined in qvector.h - Q_REQUIRED_RESULT Q_DECL_CONSTEXPR QChar at(qssize_t n) const { return (*this)[n]; } + Q_REQUIRED_RESULT Q_DECL_CONSTEXPR QChar at(qsizetype n) const { return (*this)[n]; } - Q_REQUIRED_RESULT Q_DECL_CONSTEXPR QStringView mid(qssize_t pos) const + Q_REQUIRED_RESULT Q_DECL_CONSTEXPR QStringView mid(qsizetype pos) const { return Q_ASSERT(pos >= 0), Q_ASSERT(pos <= size()), QStringView(m_data + pos, m_size - pos); } - Q_REQUIRED_RESULT Q_DECL_CONSTEXPR QStringView mid(qssize_t pos, qssize_t n) const + Q_REQUIRED_RESULT Q_DECL_CONSTEXPR QStringView mid(qsizetype pos, qsizetype n) const { return Q_ASSERT(pos >= 0), Q_ASSERT(n >= 0), Q_ASSERT(pos + n <= size()), QStringView(m_data + pos, n); } - Q_REQUIRED_RESULT Q_DECL_CONSTEXPR QStringView left(qssize_t n) const + Q_REQUIRED_RESULT Q_DECL_CONSTEXPR QStringView left(qsizetype n) const { return Q_ASSERT(n >= 0), Q_ASSERT(n <= size()), QStringView(m_data, n); } - Q_REQUIRED_RESULT Q_DECL_CONSTEXPR QStringView right(qssize_t n) const + Q_REQUIRED_RESULT Q_DECL_CONSTEXPR QStringView right(qsizetype n) const { return Q_ASSERT(n >= 0), Q_ASSERT(n <= size()), QStringView(m_data + m_size - n, n); } - Q_REQUIRED_RESULT Q_DECL_CONSTEXPR QStringView chopped(qssize_t n) const + Q_REQUIRED_RESULT Q_DECL_CONSTEXPR QStringView chopped(qsizetype n) const { return Q_ASSERT(n >= 0), Q_ASSERT(n <= size()), QStringView(m_data, m_size - n); } - Q_DECL_RELAXED_CONSTEXPR void truncate(qssize_t n) + Q_DECL_RELAXED_CONSTEXPR void truncate(qsizetype n) { Q_ASSERT(n >= 0); Q_ASSERT(n <= size()); m_size = n; } - Q_DECL_RELAXED_CONSTEXPR void chop(qssize_t n) + Q_DECL_RELAXED_CONSTEXPR void chop(qsizetype n) { Q_ASSERT(n >= 0); Q_ASSERT(n <= size()); m_size -= n; } Q_REQUIRED_RESULT QStringView trimmed() const Q_DECL_NOTHROW { return QtPrivate::trimmed(*this); } @@ -291,7 +291,7 @@ public: Q_REQUIRED_RESULT Q_DECL_CONSTEXPR QChar first() const { return front(); } Q_REQUIRED_RESULT Q_DECL_CONSTEXPR QChar last() const { return back(); } private: - qssize_t m_size; + qsizetype m_size; const storage_type *m_data; }; Q_DECLARE_TYPEINFO(QStringView, Q_PRIMITIVE_TYPE); diff --git a/src/gui/image/qbmphandler.cpp b/src/gui/image/qbmphandler.cpp index 1ec45a7491..587f375ce7 100644 --- a/src/gui/image/qbmphandler.cpp +++ b/src/gui/image/qbmphandler.cpp @@ -49,10 +49,10 @@ QT_BEGIN_NAMESPACE static void swapPixel01(QImage *image) // 1-bpp: swap 0 and 1 pixels { - qssize_t i; + qsizetype i; if (image->depth() == 1 && image->colorCount() == 2) { uint *p = (uint *)image->bits(); - qssize_t nbytes = static_cast(image->sizeInBytes()); + qsizetype nbytes = static_cast(image->sizeInBytes()); for (i=0; i::max()/depth < width || bytes_per_line <= 0 || height <= 0 - || std::numeric_limits::max()/uint(bytes_per_line) < height + || std::numeric_limits::max()/uint(bytes_per_line) < height || std::numeric_limits::max()/sizeof(uchar *) < uint(height)) return 0; @@ -1470,7 +1470,7 @@ int QImage::byteCount() const \sa byteCount(), bytesPerLine(), bits(), {QImage#Image Information}{Image Information} */ -qssize_t QImage::sizeInBytes() const +qsizetype QImage::sizeInBytes() const { return d ? d->nbytes : 0; } diff --git a/src/gui/image/qimage.h b/src/gui/image/qimage.h index eccff480bb..cddb5fe632 100644 --- a/src/gui/image/qimage.h +++ b/src/gui/image/qimage.h @@ -217,7 +217,7 @@ public: #if QT_DEPRECATED_SINCE(5, 10) QT_DEPRECATED int byteCount() const; #endif - qssize_t sizeInBytes() const; + qsizetype sizeInBytes() const; uchar *scanLine(int); const uchar *scanLine(int) const; diff --git a/src/gui/image/qimage_conversions.cpp b/src/gui/image/qimage_conversions.cpp index 6abaa2887e..4eef617336 100644 --- a/src/gui/image/qimage_conversions.cpp +++ b/src/gui/image/qimage_conversions.cpp @@ -823,8 +823,8 @@ static bool convert_indexed8_to_ARGB_PM_inplace(QImageData *data, Qt::ImageConve const int depth = 32; - const qssize_t dst_bytes_per_line = ((data->width * depth + 31) >> 5) << 2; - const qssize_t nbytes = dst_bytes_per_line * data->height; + const qsizetype dst_bytes_per_line = ((data->width * depth + 31) >> 5) << 2; + const qsizetype nbytes = dst_bytes_per_line * data->height; uchar *const newData = (uchar *)realloc(data->data, nbytes); if (!newData) return false; @@ -877,8 +877,8 @@ static bool convert_indexed8_to_ARGB_inplace(QImageData *data, Qt::ImageConversi const int depth = 32; - const qssize_t dst_bytes_per_line = ((data->width * depth + 31) >> 5) << 2; - const qssize_t nbytes = dst_bytes_per_line * data->height; + const qsizetype dst_bytes_per_line = ((data->width * depth + 31) >> 5) << 2; + const qsizetype nbytes = dst_bytes_per_line * data->height; uchar *const newData = (uchar *)realloc(data->data, nbytes); if (!newData) return false; @@ -945,8 +945,8 @@ static bool convert_indexed8_to_RGB16_inplace(QImageData *data, Qt::ImageConvers const int depth = 16; - const qssize_t dst_bytes_per_line = ((data->width * depth + 31) >> 5) << 2; - const qssize_t nbytes = dst_bytes_per_line * data->height; + const qsizetype dst_bytes_per_line = ((data->width * depth + 31) >> 5) << 2; + const qsizetype nbytes = dst_bytes_per_line * data->height; uchar *const newData = (uchar *)realloc(data->data, nbytes); if (!newData) return false; @@ -1002,8 +1002,8 @@ static bool convert_RGB_to_RGB16_inplace(QImageData *data, Qt::ImageConversionFl const int depth = 16; - const qssize_t dst_bytes_per_line = ((data->width * depth + 31) >> 5) << 2; - const qssize_t src_bytes_per_line = data->bytes_per_line; + const qsizetype dst_bytes_per_line = ((data->width * depth + 31) >> 5) << 2; + const qsizetype src_bytes_per_line = data->bytes_per_line; quint32 *src_data = (quint32 *) data->data; quint16 *dst_data = (quint16 *) data->data; @@ -1257,9 +1257,9 @@ void dither_to_Mono(QImageData *dst, const QImageData *src, } uchar *dst_data = dst->data; - qssize_t dst_bpl = dst->bytes_per_line; + qsizetype dst_bpl = dst->bytes_per_line; const uchar *src_data = src->data; - qssize_t src_bpl = src->bytes_per_line; + qsizetype src_bpl = src->bytes_per_line; switch (dithermode) { case Diffuse: { @@ -1912,8 +1912,8 @@ static void convert_Indexed8_to_Alpha8(QImageData *dest, const QImageData *src, if (simpleCase) memcpy(dest->data, src->data, src->bytes_per_line * src->height); else { - qssize_t size = src->bytes_per_line * src->height; - for (qssize_t i = 0; i < size; ++i) { + qsizetype size = src->bytes_per_line * src->height; + for (qsizetype i = 0; i < size; ++i) { dest->data[i] = translate[src->data[i]]; } } @@ -1936,8 +1936,8 @@ static void convert_Indexed8_to_Grayscale8(QImageData *dest, const QImageData *s if (simpleCase) memcpy(dest->data, src->data, src->bytes_per_line * src->height); else { - qssize_t size = src->bytes_per_line * src->height; - for (qssize_t i = 0; i < size; ++i) { + qsizetype size = src->bytes_per_line * src->height; + for (qsizetype i = 0; i < size; ++i) { dest->data[i] = translate[src->data[i]]; } } diff --git a/src/gui/image/qimage_p.h b/src/gui/image/qimage_p.h index 9ba4945dc5..befecbfe8b 100644 --- a/src/gui/image/qimage_p.h +++ b/src/gui/image/qimage_p.h @@ -71,12 +71,12 @@ struct Q_GUI_EXPORT QImageData { // internal image data int width; int height; int depth; - qssize_t nbytes; // number of bytes data + qsizetype nbytes; // number of bytes data qreal devicePixelRatio; QVector colortable; uchar *data; QImage::Format format; - qssize_t bytes_per_line; + qsizetype bytes_per_line; int ser_no; // serial number int detach_no; diff --git a/src/gui/image/qpixmap_blitter.cpp b/src/gui/image/qpixmap_blitter.cpp index d694352fc1..646e737afa 100644 --- a/src/gui/image/qpixmap_blitter.cpp +++ b/src/gui/image/qpixmap_blitter.cpp @@ -191,7 +191,7 @@ void QBlittablePlatformPixmap::fromImage(const QImage &image, uchar *mem = thisImg->bits(); const uchar *bits = correctFormatPic.constBits(); - qssize_t bytesCopied = 0; + qsizetype bytesCopied = 0; while (bytesCopied < correctFormatPic.sizeInBytes()) { memcpy(mem,bits,correctFormatPic.bytesPerLine()); mem += thisImg->bytesPerLine(); diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp index 5ec570a5db..6a24c02aaa 100644 --- a/src/gui/painting/qdrawhelper.cpp +++ b/src/gui/painting/qdrawhelper.cpp @@ -2383,7 +2383,7 @@ static void QT_FASTCALL fetchTransformedBilinearARGB32PM_fast_rotate_helper(uint __m128i v_fy = _mm_setr_epi32(fy, fy + fdy, fy + fdy + fdy, fy + fdy + fdy + fdy); const uchar *textureData = image.imageData; - const qssize_t bytesPerLine = image.bytesPerLine; + const qsizetype bytesPerLine = image.bytesPerLine; const __m128i vbpl = _mm_shufflelo_epi16(_mm_cvtsi32_si128(bytesPerLine/4), _MM_SHUFFLE(0, 0, 0, 0)); while (b < boundedEnd - 3) { @@ -4959,7 +4959,7 @@ static void blend_transformed_tiled_argb(int count, const QSpan *spans, void *us int image_width = data->texture.width; int image_height = data->texture.height; - const qssize_t scanline_offset = data->texture.bytesPerLine / 4; + const qsizetype scanline_offset = data->texture.bytesPerLine / 4; if (data->fast_matrix) { // The increment pr x in the scanline diff --git a/src/gui/painting/qdrawhelper_avx2.cpp b/src/gui/painting/qdrawhelper_avx2.cpp index d6c3319c76..2619539788 100644 --- a/src/gui/painting/qdrawhelper_avx2.cpp +++ b/src/gui/painting/qdrawhelper_avx2.cpp @@ -685,7 +685,7 @@ void QT_FASTCALL fetchTransformedBilinearARGB32PM_fast_rotate_helper_avx2(uint * v_fy = _mm256_add_epi32(v_fy, _mm256_mullo_epi32(_mm256_set1_epi32(fdy), v_index)); const uchar *textureData = image.imageData; - const qssize_t bytesPerLine = image.bytesPerLine; + const qsizetype bytesPerLine = image.bytesPerLine; const __m256i vbpl = _mm256_set1_epi16(bytesPerLine/4); while (b < boundedEnd - 7) { diff --git a/src/gui/painting/qdrawhelper_p.h b/src/gui/painting/qdrawhelper_p.h index 2be10d2cfb..df9f762314 100644 --- a/src/gui/painting/qdrawhelper_p.h +++ b/src/gui/painting/qdrawhelper_p.h @@ -293,7 +293,7 @@ struct QTextureData int y1; int x2; int y2; - qssize_t bytesPerLine; + qsizetype bytesPerLine; QImage::Format format; const QVector *colorTable; bool hasAlpha; @@ -847,7 +847,7 @@ inline void qt_memfill(T *dest, T value, int count) template Q_STATIC_TEMPLATE_FUNCTION inline void qt_rectfill(T *dest, T value, - int x, int y, int width, int height, qssize_t stride) + int x, int y, int width, int height, qsizetype stride) { char *d = reinterpret_cast(dest + x) + y * stride; if (uint(stride) == (width * sizeof(T))) { diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp index d0d948bbb7..1637a933b1 100644 --- a/src/gui/painting/qpaintengine_raster.cpp +++ b/src/gui/painting/qpaintengine_raster.cpp @@ -994,7 +994,7 @@ void QRasterPaintEnginePrivate::drawImage(const QPointF &pt, Q_ASSERT(img.depth() >= 8); - qssize_t srcBPL = img.bytesPerLine(); + qsizetype srcBPL = img.bytesPerLine(); const uchar *srcBits = img.bits(); int srcSize = img.depth() >> 3; // This is the part that is incompatible with lower than 8-bit.. int iw = img.width(); @@ -1043,7 +1043,7 @@ void QRasterPaintEnginePrivate::drawImage(const QPointF &pt, // call the blend function... int dstSize = rasterBuffer->bytesPerPixel(); - qssize_t dstBPL = rasterBuffer->bytesPerLine(); + qsizetype dstBPL = rasterBuffer->bytesPerLine(); func(rasterBuffer->buffer() + x * dstSize + y * dstBPL, dstBPL, srcBits, srcBPL, iw, ih, @@ -2318,8 +2318,8 @@ void QRasterPaintEngine::drawImage(const QRectF &r, const QImage &img, const QRe clippedSourceRect = clippedSourceRect.intersected(img.rect()); - const qssize_t dbpl = d->rasterBuffer->bytesPerLine(); - const qssize_t sbpl = img.bytesPerLine(); + const qsizetype dbpl = d->rasterBuffer->bytesPerLine(); + const qsizetype sbpl = img.bytesPerLine(); uchar *dst = d->rasterBuffer->buffer(); uint bpp = img.depth() >> 3; @@ -2828,7 +2828,7 @@ bool QRasterPaintEngine::drawCachedGlyphs(int numGlyphs, const glyph_t *glyphs, cache->fillInPendingGlyphs(); const QImage &image = cache->image(); - qssize_t bpl = image.bytesPerLine(); + qsizetype bpl = image.bytesPerLine(); int depth = image.depth(); int rightShift = 0; diff --git a/tests/auto/corelib/tools/qstringview/tst_qstringview.cpp b/tests/auto/corelib/tools/qstringview/tst_qstringview.cpp index 4174b85f4c..8a8aa8c6e1 100644 --- a/tests/auto/corelib/tools/qstringview/tst_qstringview.cpp +++ b/tests/auto/corelib/tools/qstringview/tst_qstringview.cpp @@ -461,9 +461,9 @@ void tst_QStringView::fromLiteral(const Char *arg) const const Char *null = nullptr; const Char empty[] = { 0 }; - QCOMPARE(QStringView(null).size(), qssize_t(0)); + QCOMPARE(QStringView(null).size(), qsizetype(0)); QCOMPARE(QStringView(null).data(), nullptr); - QCOMPARE(QStringView(empty).size(), qssize_t(0)); + QCOMPARE(QStringView(empty).size(), qsizetype(0)); QCOMPARE(static_cast(QStringView(empty).data()), static_cast(empty)); diff --git a/tests/auto/gui/image/qimage/tst_qimage.cpp b/tests/auto/gui/image/qimage/tst_qimage.cpp index 54eb8ab99c..7ad4a9e9bb 100644 --- a/tests/auto/gui/image/qimage/tst_qimage.cpp +++ b/tests/auto/gui/image/qimage/tst_qimage.cpp @@ -3441,10 +3441,10 @@ void tst_QImage::hugeQImage() QVERIFY(!image.isNull()); QCOMPARE(image.height(), 25000); QCOMPARE(image.width(), 25000); - QCOMPARE(image.sizeInBytes(), qssize_t(25000)*25000*4); + QCOMPARE(image.sizeInBytes(), qsizetype(25000)*25000*4); QCOMPARE(image.bytesPerLine(), 25000 * 4); - QCOMPARE(image.constScanLine(24990), image.constBits() + qssize_t(25000)*24990*4); + QCOMPARE(image.constScanLine(24990), image.constBits() + qsizetype(25000)*24990*4); image.setPixel(20000, 24990, 0xffaabbcc); QCOMPARE(image.pixel(20000, 24990), 0xffaabbcc); -- cgit v1.2.3 From 50117d738af526cbfbd5afa50b9a501acb0fb9ce Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Thu, 30 Nov 2017 14:20:32 +0100 Subject: Android: use a canonical data dir for Qt environment variables ApplicationInfo.dataDir holds "/data/user/0" (Blackberry PRIV running Android 6.0.1), which is in fact a soft link to "/data/data". This directory is used as a prefix for various Qt environment variables, including QML2_IMPORT_PATH, which in turn is used for resolving QML type URIs, looking up Qt Quick Controls 2 styles, and so on. The QML engine is not happy with "/data/data" and "/data/user/0" being wildly mixed for QML types in the same module. Use the canonical path instead to avoid such conflicts. Change-Id: I1fd45736728ee662942d7ef48c3fbc553981c59b Task-number: QTBUG-64868 Reviewed-by: Lars Knoll --- src/android/java/src/org/qtproject/qt5/android/bindings/QtLoader.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/android/java/src/org/qtproject/qt5/android/bindings/QtLoader.java b/src/android/java/src/org/qtproject/qt5/android/bindings/QtLoader.java index 99c4ecca07..6e92e64028 100644 --- a/src/android/java/src/org/qtproject/qt5/android/bindings/QtLoader.java +++ b/src/android/java/src/org/qtproject/qt5/android/bindings/QtLoader.java @@ -569,7 +569,8 @@ public abstract class QtLoader { boolean bundlingQtLibs = false; if (m_contextInfo.metaData.containsKey("android.app.bundle_local_qt_libs") && m_contextInfo.metaData.getInt("android.app.bundle_local_qt_libs") == 1) { - localPrefix = m_context.getApplicationInfo().dataDir + "/"; + File dataDir = new File(m_context.getApplicationInfo().dataDir); + localPrefix = dataDir.getCanonicalPath() + "/"; pluginsPrefix = localPrefix + "qt-reserved-files/"; if (libsDir == null) -- cgit v1.2.3