summaryrefslogtreecommitdiffstats
path: root/src/corelib
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2017-01-30 12:39:22 +0100
committerLiang Qi <liang.qi@qt.io>2017-01-30 12:46:20 +0100
commit246799d8a7bf42c1f22fca7ef6d77e8d58054bad (patch)
treea0b92a804d7d2a30cd68fa327df5777d8bcc36ba /src/corelib
parent5ad191850becd7dc1d61d0975f141a5db64e6373 (diff)
parent02cc57f4edbae450ecfa8368052afa44f8aeee19 (diff)
Merge remote-tracking branch 'origin/5.8' into dev
Conflicts: examples/network/network-chat/peermanager.cpp src/widgets/util/qsystemtrayicon.cpp src/widgets/util/qsystemtrayicon_qpa.cpp src/widgets/util/qsystemtrayicon_win.cpp src/widgets/util/qsystemtrayicon_x11.cpp Change-Id: I1c026df83818c0ccaf956980370e7522960627db
Diffstat (limited to 'src/corelib')
-rw-r--r--src/corelib/doc/snippets/qstring/main.cpp4
-rw-r--r--src/corelib/doc/snippets/qstringlist/main.cpp2
-rw-r--r--src/corelib/global/qlibraryinfo.cpp26
-rw-r--r--src/corelib/global/qprocessordetection.h6
-rw-r--r--src/corelib/io/qsettings.cpp4
-rw-r--r--src/corelib/kernel/qeventdispatcher_win.cpp22
-rw-r--r--src/corelib/kernel/qeventdispatcher_win_p.h2
-rw-r--r--src/corelib/kernel/qobject.cpp8
-rw-r--r--src/corelib/kernel/qvariant_p.h22
-rw-r--r--src/corelib/thread/qatomic.h3
-rw-r--r--src/corelib/tools/qstring.cpp2
-rw-r--r--src/corelib/tools/qstringlist.cpp4
-rw-r--r--src/corelib/tools/qvarlengtharray.h2
13 files changed, 61 insertions, 46 deletions
diff --git a/src/corelib/doc/snippets/qstring/main.cpp b/src/corelib/doc/snippets/qstring/main.cpp
index 5871026f95..41ee5a9cef 100644
--- a/src/corelib/doc/snippets/qstring/main.cpp
+++ b/src/corelib/doc/snippets/qstring/main.cpp
@@ -380,14 +380,14 @@ void Widget::fillFunction()
void Widget::fromRawDataFunction()
{
//! [22]
- QRegExp pattern;
+ QRegularExpression pattern("\u00A4");
static const QChar unicode[] = {
0x005A, 0x007F, 0x00A4, 0x0060,
0x1009, 0x0020, 0x0020};
int size = sizeof(unicode) / sizeof(QChar);
QString str = QString::fromRawData(unicode, size);
- if (str.contains(QRegExp(pattern))) {
+ if (str.contains(pattern) {
// ...
//! [22] //! [23]
}
diff --git a/src/corelib/doc/snippets/qstringlist/main.cpp b/src/corelib/doc/snippets/qstringlist/main.cpp
index 7e7d55ca30..4d9c015747 100644
--- a/src/corelib/doc/snippets/qstringlist/main.cpp
+++ b/src/corelib/doc/snippets/qstringlist/main.cpp
@@ -97,7 +97,7 @@ Widget::Widget(QWidget *parent)
//! [6]
//! [7]
- QStringList monospacedFonts = fonts.filter(QRegExp("Courier|Fixed"));
+ QStringList monospacedFonts = fonts.filter(QRegularExpression("Courier|Fixed"));
//! [7]
//! [8]
diff --git a/src/corelib/global/qlibraryinfo.cpp b/src/corelib/global/qlibraryinfo.cpp
index 0de8b50900..03ee0730db 100644
--- a/src/corelib/global/qlibraryinfo.cpp
+++ b/src/corelib/global/qlibraryinfo.cpp
@@ -530,14 +530,24 @@ QLibraryInfo::rawLocation(LibraryLocation loc, PathGroup group)
}
#endif
- // expand environment variables in the form $(ENVVAR)
- int rep;
- QRegExp reg_var(QLatin1String("\\$\\(.*\\)"));
- reg_var.setMinimal(true);
- while((rep = reg_var.indexIn(ret)) != -1) {
- ret.replace(rep, reg_var.matchedLength(),
- QString::fromLocal8Bit(qgetenv(ret.midRef(rep + 2,
- reg_var.matchedLength() - 3).toLatin1().constData()).constData()));
+ int startIndex = 0;
+ forever {
+ startIndex = ret.indexOf(QLatin1Char('$'), startIndex);
+ if (startIndex < 0)
+ break;
+ if (ret.length() < startIndex + 3)
+ break;
+ if (ret.at(startIndex + 1) != QLatin1Char('(')) {
+ startIndex++;
+ continue;
+ }
+ int endIndex = ret.indexOf(QLatin1Char(')'), startIndex + 2);
+ if (endIndex < 0)
+ break;
+ QStringRef envVarName = ret.midRef(startIndex + 2, endIndex - startIndex - 2);
+ QString value = QString::fromLocal8Bit(qgetenv(envVarName.toLocal8Bit().constData()));
+ ret.replace(startIndex, endIndex - startIndex + 1, value);
+ startIndex += value.length();
}
config->endGroup();
diff --git a/src/corelib/global/qprocessordetection.h b/src/corelib/global/qprocessordetection.h
index 9fb3473ed3..ed11e013f2 100644
--- a/src/corelib/global/qprocessordetection.h
+++ b/src/corelib/global/qprocessordetection.h
@@ -234,9 +234,6 @@
# if defined(_MIPS_ARCH_MIPS2) || (defined(__mips) && __mips - 0 >= 2)
# define Q_PROCESSOR_MIPS_II
# endif
-# if defined(_MIPS_ARCH_MIPS32) || defined(__mips32)
-# define Q_PROCESSOR_MIPS_32
-# endif
# if defined(_MIPS_ARCH_MIPS3) || (defined(__mips) && __mips - 0 >= 3)
# define Q_PROCESSOR_MIPS_III
# endif
@@ -246,6 +243,9 @@
# if defined(_MIPS_ARCH_MIPS5) || (defined(__mips) && __mips - 0 >= 5)
# define Q_PROCESSOR_MIPS_V
# endif
+# if defined(_MIPS_ARCH_MIPS32) || defined(__mips32) || (defined(__mips) && __mips - 0 >= 32)
+# define Q_PROCESSOR_MIPS_32
+# endif
# if defined(_MIPS_ARCH_MIPS64) || defined(__mips64)
# define Q_PROCESSOR_MIPS_64
# define Q_PROCESSOR_WORDSIZE 8
diff --git a/src/corelib/io/qsettings.cpp b/src/corelib/io/qsettings.cpp
index 1a69891d3b..16dab38a60 100644
--- a/src/corelib/io/qsettings.cpp
+++ b/src/corelib/io/qsettings.cpp
@@ -1494,7 +1494,7 @@ void QConfFileSettingsPrivate::syncConfFile(QConfFile *confFile)
ensureAllSectionsParsed(confFile);
ParsedSettingsMap mergedKeys = confFile->mergedKeyMap();
-#ifndef QT_BOOTSTRAPPED
+#if !defined(QT_BOOTSTRAPPED) && QT_CONFIG(temporaryfile)
QSaveFile sf(confFile->name);
#else
QFile sf(confFile->name);
@@ -1522,7 +1522,7 @@ void QConfFileSettingsPrivate::syncConfFile(QConfFile *confFile)
ok = writeFunc(sf, tempOriginalKeys);
}
-#ifndef QT_BOOTSTRAPPED
+#if !defined(QT_BOOTSTRAPPED) && QT_CONFIG(temporaryfile)
if (ok)
ok = sf.commit();
#endif
diff --git a/src/corelib/kernel/qeventdispatcher_win.cpp b/src/corelib/kernel/qeventdispatcher_win.cpp
index 75ac104155..79146dac34 100644
--- a/src/corelib/kernel/qeventdispatcher_win.cpp
+++ b/src/corelib/kernel/qeventdispatcher_win.cpp
@@ -97,9 +97,7 @@ QEventDispatcherWin32Private::QEventDispatcherWin32Private()
: threadId(GetCurrentThreadId()), interrupt(false), closingDown(false), internalHwnd(0),
getMessageHook(0), serialNumber(0), lastSerialNumber(0), sendPostedEventsWindowsTimerId(0),
wakeUps(0)
-#ifndef Q_OS_WINCE
, activateNotifiersPosted(false)
-#endif
{
}
@@ -180,11 +178,9 @@ LRESULT QT_WIN_CALLBACK qt_internal_proc(HWND hwnd, UINT message, WPARAM wp, LPA
QSockNot *sn = dict ? dict->value(wp) : 0;
if (sn) {
-#ifndef Q_OS_WINCE
d->doWsaAsyncSelect(sn->fd, 0);
d->active_fd[sn->fd].selected = false;
d->postActivateSocketNotifiers();
-#endif
if (type < 3) {
QEvent event(QEvent::SockAct);
QCoreApplication::sendEvent(sn->obj, &event);
@@ -195,7 +191,6 @@ LRESULT QT_WIN_CALLBACK qt_internal_proc(HWND hwnd, UINT message, WPARAM wp, LPA
}
}
return 0;
-#ifndef Q_OS_WINCE
} else if (message == WM_QT_ACTIVATENOTIFIERS) {
Q_ASSERT(d != 0);
@@ -210,7 +205,6 @@ LRESULT QT_WIN_CALLBACK qt_internal_proc(HWND hwnd, UINT message, WPARAM wp, LPA
}
d->activateNotifiersPosted = false;
return 0;
-#endif // !Q_OS_WINCE
} else if (message == WM_QT_SENDPOSTEDEVENTS
// we also use a Windows timer to send posted events when the message queue is full
|| (message == WM_TIMER
@@ -445,13 +439,11 @@ void QEventDispatcherWin32Private::doWsaAsyncSelect(int socket, long event)
WSAAsyncSelect(socket, internalHwnd, event ? int(WM_QT_SOCKETNOTIFIER) : 0, event);
}
-#ifndef Q_OS_WINCE
void QEventDispatcherWin32Private::postActivateSocketNotifiers()
{
if (!activateNotifiersPosted)
activateNotifiersPosted = PostMessage(internalHwnd, WM_QT_ACTIVATENOTIFIERS, 0, 0);
}
-#endif // !Q_OS_WINCE
void QEventDispatcherWin32::createInternalHwnd()
{
@@ -705,22 +697,16 @@ void QEventDispatcherWin32::registerSocketNotifier(QSocketNotifier *notifier)
QSFDict::iterator it = d->active_fd.find(sockfd);
if (it != d->active_fd.end()) {
QSockFd &sd = it.value();
-#ifndef Q_OS_WINCE
if (sd.selected) {
d->doWsaAsyncSelect(sockfd, 0);
sd.selected = false;
}
-#endif // !Q_OS_WINCE
sd.event |= event;
} else {
d->active_fd.insert(sockfd, QSockFd(event));
}
-#ifndef Q_OS_WINCE
d->postActivateSocketNotifiers();
-#else
- d->doWsaAsyncSelect(sockfd, event);
-#endif
}
void QEventDispatcherWin32::unregisterSocketNotifier(QSocketNotifier *notifier)
@@ -749,7 +735,6 @@ void QEventDispatcherWin32::doUnregisterSocketNotifier(QSocketNotifier *notifier
QSFDict::iterator it = d->active_fd.find(sockfd);
if (it != d->active_fd.end()) {
QSockFd &sd = it.value();
-#ifndef Q_OS_WINCE
if (sd.selected)
d->doWsaAsyncSelect(sockfd, 0);
const long event[3] = { FD_READ | FD_CLOSE | FD_ACCEPT, FD_WRITE | FD_CONNECT, FD_OOB };
@@ -760,13 +745,6 @@ void QEventDispatcherWin32::doUnregisterSocketNotifier(QSocketNotifier *notifier
sd.selected = false;
d->postActivateSocketNotifiers();
}
-#else
- const long event[3] = { FD_READ | FD_CLOSE | FD_ACCEPT, FD_WRITE | FD_CONNECT, FD_OOB };
- sd.event ^= event[type];
- d->doWsaAsyncSelect(sockfd, sd.event);
- if (sd.event == 0)
- d->active_fd.erase(it);
-#endif // !Q_OS_WINCE
}
QSNDict *sn_vec[3] = { &d->sn_read, &d->sn_write, &d->sn_except };
diff --git a/src/corelib/kernel/qeventdispatcher_win_p.h b/src/corelib/kernel/qeventdispatcher_win_p.h
index 227fcf89ff..423dc5b169 100644
--- a/src/corelib/kernel/qeventdispatcher_win_p.h
+++ b/src/corelib/kernel/qeventdispatcher_win_p.h
@@ -187,10 +187,8 @@ public:
QSNDict sn_write;
QSNDict sn_except;
QSFDict active_fd;
-#ifndef Q_OS_WINCE
bool activateNotifiersPosted;
void postActivateSocketNotifiers();
-#endif
void doWsaAsyncSelect(int socket, long event);
QList<QWinEventNotifier *> winEventNotifierList;
diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp
index 5e6c44fb13..8088b18ef4 100644
--- a/src/corelib/kernel/qobject.cpp
+++ b/src/corelib/kernel/qobject.cpp
@@ -2636,6 +2636,9 @@ static inline void check_and_warn_compat(const QMetaObject *sender, const QMetaM
(exact same signal to the exact same slot on the same objects),
the connection will fail and connect will return an invalid QMetaObject::Connection.
+ \note Qt::UniqueConnections do not work for lambdas, non-member functions
+ and functors; they only apply to connecting to member functions.
+
The optional \a type parameter describes the type of connection
to establish. In particular, it determines whether a particular
signal is delivered to a slot immediately or queued for delivery
@@ -4705,7 +4708,10 @@ void qDeleteInEventHandler(QObject *o)
Creates a connection of a given \a type from \a signal in
\a sender object to \a functor to be placed in a specific event
- loop of \a context, and returns a handle to the connection
+ loop of \a context, and returns a handle to the connection.
+
+ \note Qt::UniqueConnections do not work for lambdas, non-member functions
+ and functors; they only apply to connecting to member functions.
The signal must be a function declared as a signal in the header.
The slot function can be any function or functor that can be connected
diff --git a/src/corelib/kernel/qvariant_p.h b/src/corelib/kernel/qvariant_p.h
index bf88def438..487949431c 100644
--- a/src/corelib/kernel/qvariant_p.h
+++ b/src/corelib/kernel/qvariant_p.h
@@ -177,6 +177,26 @@ inline void v_clear(QVariant::Private *d, T* = 0)
}
+template <typename T>
+struct PrimitiveIsNull
+{
+public:
+ static bool isNull(const QVariant::Private *d)
+ {
+ return d->is_null;
+ }
+};
+
+template <>
+struct PrimitiveIsNull<std::nullptr_t>
+{
+public:
+ static bool isNull(const QVariant::Private *)
+ {
+ return true;
+ }
+};
+
template<class Filter>
class QVariantComparator {
template<typename T, bool IsAcceptedType = Filter::template Acceptor<T>::IsAccepted>
@@ -268,7 +288,7 @@ class QVariantIsNull
{
static bool isNull(const QVariant::Private *d)
{
- return d->is_null;
+ return PrimitiveIsNull<T>::isNull(d);
}
};
diff --git a/src/corelib/thread/qatomic.h b/src/corelib/thread/qatomic.h
index bbfc11f6c0..f9eacbf6f0 100644
--- a/src/corelib/thread/qatomic.h
+++ b/src/corelib/thread/qatomic.h
@@ -176,6 +176,9 @@ public:
}
#endif
inline QAtomicPointer(const QAtomicPointer<T> &other) Q_DECL_NOTHROW
+#ifdef QT_BASIC_ATOMIC_HAS_CONSTRUCTORS
+ : QBasicAtomicPointer<T>()
+#endif
{
this->storeRelease(other.loadAcquire());
}
diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp
index fb79ab0e47..66ce29c859 100644
--- a/src/corelib/tools/qstring.cpp
+++ b/src/corelib/tools/qstring.cpp
@@ -8159,7 +8159,7 @@ bool QString::isRightToLeft() const
to create a deep copy of the data, ensuring that the raw data
isn't modified.
- Here's an example of how we can use a QRegExp on raw data in
+ Here's an example of how we can use a QRegularExpression on raw data in
memory without requiring to copy the data into a QString:
\snippet qstring/main.cpp 22
diff --git a/src/corelib/tools/qstringlist.cpp b/src/corelib/tools/qstringlist.cpp
index a0b65ea554..88ceae20b9 100644
--- a/src/corelib/tools/qstringlist.cpp
+++ b/src/corelib/tools/qstringlist.cpp
@@ -143,8 +143,8 @@ QT_BEGIN_NAMESPACE
\snippet qstringlist/main.cpp 6
- The argument to split can be a single character, a string, or a
- QRegExp.
+ The argument to split can be a single character, a string, a
+ QRegularExpression or a (deprecated) QRegExp.
In addition, the \l {QStringList::operator+()}{operator+()}
function allows you to concatenate two string lists into one. To
diff --git a/src/corelib/tools/qvarlengtharray.h b/src/corelib/tools/qvarlengtharray.h
index 1530299303..bb5ae78d2b 100644
--- a/src/corelib/tools/qvarlengtharray.h
+++ b/src/corelib/tools/qvarlengtharray.h
@@ -77,7 +77,7 @@ public:
: a(Prealloc), s(0), ptr(reinterpret_cast<T *>(array))
{
if (args.size())
- append(args.begin(), args.size());
+ append(args.begin(), int(args.size()));
}
#endif