diff options
Diffstat (limited to 'src/corelib')
-rw-r--r-- | src/corelib/configure.json | 23 | ||||
-rw-r--r-- | src/corelib/global/minimum-linux_p.h | 6 | ||||
-rw-r--r-- | src/corelib/itemmodels/qabstractitemmodel.cpp | 14 | ||||
-rw-r--r-- | src/corelib/kernel/qsignalmapper.cpp | 2 | ||||
-rw-r--r-- | src/corelib/mimetypes/mimetypes.pri | 2 | ||||
-rw-r--r-- | src/corelib/mimetypes/qmimeprovider.cpp | 2 | ||||
-rw-r--r-- | src/corelib/platform/wasm/qstdweb.cpp | 2 | ||||
-rw-r--r-- | src/corelib/tools/qtimezoneprivate_p.h | 1 | ||||
-rw-r--r-- | src/corelib/tools/qtimezoneprivate_tz.cpp | 48 |
9 files changed, 67 insertions, 33 deletions
diff --git a/src/corelib/configure.json b/src/corelib/configure.json index 81768507f6..a6091d4825 100644 --- a/src/corelib/configure.json +++ b/src/corelib/configure.json @@ -11,6 +11,7 @@ "icu": "boolean", "inotify": "boolean", "journald": "boolean", + "mimetype-database": "boolean", "pcre": { "type": "enum", "values": [ "no", "qt", "system" ] }, "posix-ipc": { "type": "boolean", "name": "ipc_posix" }, "pps": { "type": "boolean", "name": "qqnx_pps" }, @@ -374,6 +375,16 @@ ] } }, + "glibc": { + "label": "GNU libc", + "type": "compile", + "test": { + "include": "stdlib.h", + "main": [ + "return __GLIBC__;" + ] + } + }, "inotify": { "label": "inotify", "type": "compile", @@ -593,6 +604,12 @@ "condition": "libs.glib", "output": [ "privateFeature", "feature" ] }, + "glibc": { + "label": "GNU libc", + "autoDetect": "config.linux", + "condition": "tests.glibc", + "output": [ "privateFeature" ] + }, "iconv": { "label": "iconv", "purpose": "Provides internationalization on Unix.", @@ -662,6 +679,11 @@ "condition": "features.textcodec", "output": [ "publicFeature", "feature" ] }, + "mimetype-database": { + "label": "Built-in copy of the MIME database", + "condition": "features.mimetype", + "output": [ "privateFeature" ] + }, "pcre2": { "label": "PCRE2", "disable": "input.pcre == 'no' || input.pcre == 'system'", @@ -1036,6 +1058,7 @@ Please apply the patch corresponding to your Standard Library vendor, found in "glib", "iconv", "icu", + "mimetype-database", { "message": "Tracing backend", "type": "firstAvailableFeature", diff --git a/src/corelib/global/minimum-linux_p.h b/src/corelib/global/minimum-linux_p.h index 9c074e13ba..5112015663 100644 --- a/src/corelib/global/minimum-linux_p.h +++ b/src/corelib/global/minimum-linux_p.h @@ -78,7 +78,11 @@ QT_BEGIN_NAMESPACE * - statx 4.11 QT_CONFIG(statx) */ -#if QT_CONFIG(statx) +#if QT_CONFIG(statx) && !QT_CONFIG(glibc) +// if using glibc, the statx() function in sysdeps/unix/sysv/linux/statx.c +// falls back to stat() for us. +// (Using QT_CONFIG(glibc) instead of __GLIBC__ because the macros aren't +// defined in assembler mode) # define MINLINUX_MAJOR 4 # define MINLINUX_MINOR 11 # define MINLINUX_PATCH 0 diff --git a/src/corelib/itemmodels/qabstractitemmodel.cpp b/src/corelib/itemmodels/qabstractitemmodel.cpp index abd86f2b49..18f0f6f55f 100644 --- a/src/corelib/itemmodels/qabstractitemmodel.cpp +++ b/src/corelib/itemmodels/qabstractitemmodel.cpp @@ -2355,6 +2355,7 @@ QModelIndexList QAbstractItemModel::match(const QModelIndex &start, int role, bool wrap = flags & Qt::MatchWrap; bool allHits = (hits == -1); QString text; // only convert to a string if it is needed + const int column = start.column(); QModelIndex p = parent(start); int from = start.row(); int to = rowCount(p); @@ -2362,7 +2363,7 @@ QModelIndexList QAbstractItemModel::match(const QModelIndex &start, int role, // iterates twice if wrapping for (int i = 0; (wrap && i < 2) || (!wrap && i < 1); ++i) { for (int r = from; (r < to) && (allHits || result.count() < hits); ++r) { - QModelIndex idx = index(r, start.column(), p); + QModelIndex idx = index(r, column, p); if (!idx.isValid()) continue; QVariant v = data(idx, role); @@ -2401,10 +2402,13 @@ QModelIndexList QAbstractItemModel::match(const QModelIndex &start, int role, result.append(idx); } } - if (recurse && hasChildren(idx)) { // search the hierarchy - result += match(index(0, idx.column(), idx), role, - (text.isEmpty() ? value : text), - (allHits ? -1 : hits - result.count()), flags); + if (recurse) { + const auto parent = column != 0 ? idx.sibling(idx.row(), 0) : idx; + if (hasChildren(parent)) { // search the hierarchy + result += match(index(0, column, parent), role, + (text.isEmpty() ? value : text), + (allHits ? -1 : hits - result.count()), flags); + } } } // prepare for the next iteration diff --git a/src/corelib/kernel/qsignalmapper.cpp b/src/corelib/kernel/qsignalmapper.cpp index d56965281e..02a1281f92 100644 --- a/src/corelib/kernel/qsignalmapper.cpp +++ b/src/corelib/kernel/qsignalmapper.cpp @@ -61,7 +61,7 @@ public: /*! \class QSignalMapper \inmodule QtCore - \obsolete + \obsolete The recommended solution is connecting the signal to a lambda. \brief The QSignalMapper class bundles signals from identifiable senders. \ingroup objectmodel diff --git a/src/corelib/mimetypes/mimetypes.pri b/src/corelib/mimetypes/mimetypes.pri index 870b6c65a5..62bbe348e4 100644 --- a/src/corelib/mimetypes/mimetypes.pri +++ b/src/corelib/mimetypes/mimetypes.pri @@ -21,5 +21,5 @@ qtConfig(mimetype) { mimetypes/qmimeglobpattern.cpp \ mimetypes/qmimeprovider.cpp - RESOURCES += mimetypes/mimetypes.qrc + qtConfig(mimetype-database): RESOURCES += mimetypes/mimetypes.qrc } diff --git a/src/corelib/mimetypes/qmimeprovider.cpp b/src/corelib/mimetypes/qmimeprovider.cpp index 5e1447aaa9..7e2696b719 100644 --- a/src/corelib/mimetypes/qmimeprovider.cpp +++ b/src/corelib/mimetypes/qmimeprovider.cpp @@ -54,7 +54,9 @@ static void initResources() { +#if QT_CONFIG(mimetype_database) Q_INIT_RESOURCE(mimetypes); +#endif } QT_BEGIN_NAMESPACE diff --git a/src/corelib/platform/wasm/qstdweb.cpp b/src/corelib/platform/wasm/qstdweb.cpp index 1afd91d860..198ce897ca 100644 --- a/src/corelib/platform/wasm/qstdweb.cpp +++ b/src/corelib/platform/wasm/qstdweb.cpp @@ -227,7 +227,7 @@ std::string EventCallback::contextPropertyName(const std::string &eventName) return std::string("data-qtEventCallbackContext") + eventName; } -EMSCRIPTEN_BINDINGS(QtStdwebCalback) { +EMSCRIPTEN_BINDINGS(qtStdwebCalback) { emscripten::function("qtStdWebEventCallbackActivate", &EventCallback::activate); } diff --git a/src/corelib/tools/qtimezoneprivate_p.h b/src/corelib/tools/qtimezoneprivate_p.h index c9a5726216..24a9a00f11 100644 --- a/src/corelib/tools/qtimezoneprivate_p.h +++ b/src/corelib/tools/qtimezoneprivate_p.h @@ -331,6 +331,7 @@ public: private: void init(const QByteArray &ianaId); + QVector<QTimeZonePrivate::Data> getPosixTransitions(qint64 msNear) const; Data dataForTzTransition(QTzTransitionTime tran) const; QVector<QTzTransitionTime> m_tranTimes; diff --git a/src/corelib/tools/qtimezoneprivate_tz.cpp b/src/corelib/tools/qtimezoneprivate_tz.cpp index bed62a02bd..f75a61977d 100644 --- a/src/corelib/tools/qtimezoneprivate_tz.cpp +++ b/src/corelib/tools/qtimezoneprivate_tz.cpp @@ -943,19 +943,21 @@ QTimeZonePrivate::Data QTzTimeZonePrivate::dataForTzTransition(QTzTransitionTime return data; } -QTimeZonePrivate::Data QTzTimeZonePrivate::data(qint64 forMSecsSinceEpoch) const +QVector<QTimeZonePrivate::Data> QTzTimeZonePrivate::getPosixTransitions(qint64 msNear) const { - // If we have no rules (so probably an invalid tz), return invalid data: - if (!m_tranTimes.size()) - return invalidData(); + const int year = QDateTime::fromMSecsSinceEpoch(msNear, Qt::UTC).date().year(); + // The Data::atMSecsSinceEpoch of the single entry if zone is constant: + qint64 atTime = m_tranTimes.isEmpty() ? msNear : m_tranTimes.last().atMSecsSinceEpoch; + return calculatePosixTransitions(m_posixRule, year - 1, year + 1, atTime); +} - // If the required time is after the last transition and we have a POSIX rule then use it - if (m_tranTimes.last().atMSecsSinceEpoch < forMSecsSinceEpoch +QTimeZonePrivate::Data QTzTimeZonePrivate::data(qint64 forMSecsSinceEpoch) const +{ + // If the required time is after the last transition (or there were none) + // and we have a POSIX rule then use it: + if ((m_tranTimes.isEmpty() || m_tranTimes.last().atMSecsSinceEpoch < forMSecsSinceEpoch) && !m_posixRule.isEmpty() && forMSecsSinceEpoch >= 0) { - const int year = QDateTime::fromMSecsSinceEpoch(forMSecsSinceEpoch, Qt::UTC).date().year(); - QVector<QTimeZonePrivate::Data> posixTrans = - calculatePosixTransitions(m_posixRule, year - 1, year + 1, - m_tranTimes.last().atMSecsSinceEpoch); + QVector<QTimeZonePrivate::Data> posixTrans = getPosixTransitions(forMSecsSinceEpoch); auto it = std::partition_point(posixTrans.cbegin(), posixTrans.cend(), [forMSecsSinceEpoch] (const QTimeZonePrivate::Data &at) { return at.atMSecsSinceEpoch <= forMSecsSinceEpoch; @@ -986,13 +988,11 @@ bool QTzTimeZonePrivate::hasTransitions() const QTimeZonePrivate::Data QTzTimeZonePrivate::nextTransition(qint64 afterMSecsSinceEpoch) const { - // If the required time is after the last transition and we have a POSIX rule then use it - if (m_tranTimes.size() > 0 && m_tranTimes.last().atMSecsSinceEpoch < afterMSecsSinceEpoch + // If the required time is after the last transition (or there were none) + // and we have a POSIX rule then use it: + if ((m_tranTimes.isEmpty() || m_tranTimes.last().atMSecsSinceEpoch < afterMSecsSinceEpoch) && !m_posixRule.isEmpty() && afterMSecsSinceEpoch >= 0) { - const int year = QDateTime::fromMSecsSinceEpoch(afterMSecsSinceEpoch, Qt::UTC).date().year(); - QVector<QTimeZonePrivate::Data> posixTrans = - calculatePosixTransitions(m_posixRule, year - 1, year + 1, - m_tranTimes.last().atMSecsSinceEpoch); + QVector<QTimeZonePrivate::Data> posixTrans = getPosixTransitions(afterMSecsSinceEpoch); auto it = std::partition_point(posixTrans.cbegin(), posixTrans.cend(), [afterMSecsSinceEpoch] (const QTimeZonePrivate::Data &at) { return at.atMSecsSinceEpoch <= afterMSecsSinceEpoch; @@ -1011,19 +1011,19 @@ QTimeZonePrivate::Data QTzTimeZonePrivate::nextTransition(qint64 afterMSecsSince QTimeZonePrivate::Data QTzTimeZonePrivate::previousTransition(qint64 beforeMSecsSinceEpoch) const { - // If the required time is after the last transition and we have a POSIX rule then use it - if (m_tranTimes.size() > 0 && m_tranTimes.last().atMSecsSinceEpoch < beforeMSecsSinceEpoch + // If the required time is after the last transition (or there were none) + // and we have a POSIX rule then use it: + if ((m_tranTimes.isEmpty() || m_tranTimes.last().atMSecsSinceEpoch < beforeMSecsSinceEpoch) && !m_posixRule.isEmpty() && beforeMSecsSinceEpoch > 0) { - const int year = QDateTime::fromMSecsSinceEpoch(beforeMSecsSinceEpoch, Qt::UTC).date().year(); - QVector<QTimeZonePrivate::Data> posixTrans = - calculatePosixTransitions(m_posixRule, year - 1, year + 1, - m_tranTimes.last().atMSecsSinceEpoch); + QVector<QTimeZonePrivate::Data> posixTrans = getPosixTransitions(beforeMSecsSinceEpoch); auto it = std::partition_point(posixTrans.cbegin(), posixTrans.cend(), [beforeMSecsSinceEpoch] (const QTimeZonePrivate::Data &at) { return at.atMSecsSinceEpoch < beforeMSecsSinceEpoch; }); - Q_ASSERT(it > posixTrans.cbegin()); - return *--it; + if (it > posixTrans.cbegin()) + return *--it; + // It fell between the last transition (if any) and the first of the POSIX rule: + return m_tranTimes.isEmpty() ? invalidData() : dataForTzTransition(m_tranTimes.last()); } // Otherwise if we can find a valid tran then use its rule |