summaryrefslogtreecommitdiffstats
path: root/src/corelib
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2019-03-26 08:27:02 +0100
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2019-03-26 08:27:02 +0100
commit8f1acd29e4d39383752899d6d05d484eb9d7935b (patch)
treee749c4bebdd49ff702dfaa062902cbb6016cfd82 /src/corelib
parent945198fd237a83348feb4537d811565a2c2cd8e0 (diff)
parent2fedce8ed8451fd9b14bc214dc26e79b0d5ab7bd (diff)
Merge remote-tracking branch 'origin/5.12' into 5.13
Diffstat (limited to 'src/corelib')
-rw-r--r--src/corelib/configure.json16
-rw-r--r--src/corelib/global/minimum-linux_p.h6
-rw-r--r--src/corelib/itemmodels/qabstractitemmodel.cpp14
-rw-r--r--src/corelib/kernel/qsignalmapper.cpp2
-rw-r--r--src/corelib/tools/qtimezoneprivate_p.h1
-rw-r--r--src/corelib/tools/qtimezoneprivate_tz.cpp48
6 files changed, 56 insertions, 31 deletions
diff --git a/src/corelib/configure.json b/src/corelib/configure.json
index 948aa0829b..ed31299603 100644
--- a/src/corelib/configure.json
+++ b/src/corelib/configure.json
@@ -374,6 +374,16 @@
]
}
},
+ "glibc": {
+ "label": "GNU libc",
+ "type": "compile",
+ "test": {
+ "include": "stdlib.h",
+ "main": [
+ "return __GLIBC__;"
+ ]
+ }
+ },
"inotify": {
"label": "inotify",
"type": "compile",
@@ -593,6 +603,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.",
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/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