summaryrefslogtreecommitdiffstats
path: root/src/corelib
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib')
-rw-r--r--src/corelib/global/qtrace_p.h2
-rw-r--r--src/corelib/io/qdiriterator.cpp3
-rw-r--r--src/corelib/io/qprocess.cpp5
-rw-r--r--src/corelib/io/qprocess_p.h3
-rw-r--r--src/corelib/kernel/qcoreapplication.cpp22
-rw-r--r--src/corelib/kernel/qobject.cpp46
-rw-r--r--src/corelib/kernel/qsignalmapper.cpp4
-rw-r--r--src/corelib/kernel/qvariant.h5
-rw-r--r--src/corelib/qtcore.tracepoints23
-rw-r--r--src/corelib/tools/qbytearraylist.h2
-rw-r--r--src/corelib/tools/qlist.h6
-rw-r--r--src/corelib/tools/qlocale_mac.mm14
-rw-r--r--src/corelib/tools/qsharedpointer.cpp27
-rw-r--r--src/corelib/tools/qsharedpointer.h4
-rw-r--r--src/corelib/tools/qstringlist.h2
15 files changed, 88 insertions, 80 deletions
diff --git a/src/corelib/global/qtrace_p.h b/src/corelib/global/qtrace_p.h
index b72fdd886d..d9011c6066 100644
--- a/src/corelib/global/qtrace_p.h
+++ b/src/corelib/global/qtrace_p.h
@@ -128,7 +128,7 @@ QT_BEGIN_NAMESPACE
const auto qTraceExit_ ## x ## __COUNTER__ = qScopeGuard([&]() { Q_TRACE(x, __VA_ARGS__); });
# define Q_TRACE_SCOPE(x, ...) \
Q_TRACE(x ## _entry, __VA_ARGS__); \
- Q_TRACE_EXIT(x ## _exit, __VA_ARGS__);
+ Q_TRACE_EXIT(x ## _exit);
# define Q_UNCONDITIONAL_TRACE(x, ...) QtPrivate::do_trace_ ## x(__VA_ARGS__)
# define Q_TRACE_ENABLED(x) QtPrivate::trace_ ## x ## _enabled()
#else
diff --git a/src/corelib/io/qdiriterator.cpp b/src/corelib/io/qdiriterator.cpp
index 69d61bf5a8..21214ee273 100644
--- a/src/corelib/io/qdiriterator.cpp
+++ b/src/corelib/io/qdiriterator.cpp
@@ -321,7 +321,8 @@ void QDirIteratorPrivate::checkAndPushDirectory(const QFileInfo &fileInfo)
bool QDirIteratorPrivate::matchesFilters(const QString &fileName, const QFileInfo &fi) const
{
- Q_ASSERT(!fileName.isEmpty());
+ if (fileName.isEmpty())
+ return false;
// filter . and ..?
const int fileNameSize = fileName.size();
diff --git a/src/corelib/io/qprocess.cpp b/src/corelib/io/qprocess.cpp
index 642393955b..0b964e6a21 100644
--- a/src/corelib/io/qprocess.cpp
+++ b/src/corelib/io/qprocess.cpp
@@ -999,7 +999,12 @@ void QProcessPrivate::setErrorAndEmit(QProcess::ProcessError error, const QStrin
Q_ASSERT(error != QProcess::UnknownError);
setError(error, description);
emit q->errorOccurred(processError);
+#if QT_DEPRECATED_SINCE(5, 6)
+QT_WARNING_PUSH
+QT_WARNING_DISABLE_DEPRECATED
emit q->error(processError);
+QT_WARNING_POP
+#endif
}
/*!
diff --git a/src/corelib/io/qprocess_p.h b/src/corelib/io/qprocess_p.h
index 1bc63240fe..00acb81158 100644
--- a/src/corelib/io/qprocess_p.h
+++ b/src/corelib/io/qprocess_p.h
@@ -108,8 +108,7 @@ using QProcEnvKey = QByteArray;
class QProcEnvValue
{
public:
- QProcEnvValue() {}
- QProcEnvValue(const QProcEnvValue &other) { *this = other; }
+ QProcEnvValue() = default;
explicit QProcEnvValue(const QString &value) : stringValue(value) {}
explicit QProcEnvValue(const QByteArray &value) : byteValue(value) {}
bool operator==(const QProcEnvValue &other) const
diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp
index d9fdb7f785..7a6faf2e2b 100644
--- a/src/corelib/kernel/qcoreapplication.cpp
+++ b/src/corelib/kernel/qcoreapplication.cpp
@@ -999,6 +999,7 @@ void QCoreApplication::setQuitLockEnabled(bool enabled)
quitLockRefEnabled = enabled;
}
+#if QT_DEPRECATED_SINCE(5, 6)
/*!
\internal
\deprecated
@@ -1010,6 +1011,7 @@ bool QCoreApplication::notifyInternal(QObject *receiver, QEvent *event)
{
return notifyInternal2(receiver, event);
}
+#endif
/*!
\internal
@@ -1183,28 +1185,26 @@ bool QCoreApplicationPrivate::notify_helper(QObject *receiver, QEvent * event)
{
// Note: when adjusting the tracepoints in here
// consider adjusting QApplicationPrivate::notify_helper too.
- Q_TRACE_SCOPE(QCoreApplication_notify, receiver, event, event->type());
+ Q_TRACE(QCoreApplication_notify_entry, receiver, event, event->type());
+ bool consumed = false;
+ bool filtered = false;
+ Q_TRACE_EXIT(QCoreApplication_notify_exit, consumed, filtered);
// send to all application event filters (only does anything in the main thread)
if (QCoreApplication::self
&& receiver->d_func()->threadData->thread == mainThread()
&& QCoreApplication::self->d_func()->sendThroughApplicationEventFilters(receiver, event)) {
- Q_TRACE(QCoreApplication_notify_event_filtered, receiver, event, event->type());
- return true;
+ filtered = true;
+ return filtered;
}
// send to all receiver event filters
if (sendThroughObjectEventFilters(receiver, event)) {
- Q_TRACE(QCoreApplication_notify_event_filtered, receiver, event, event->type());
- return true;
+ filtered = true;
+ return filtered;
}
- Q_TRACE(QCoreApplication_notify_before_delivery, receiver, event, event->type());
-
// deliver the event
- const bool consumed = receiver->event(event);
-
- Q_TRACE(QCoreApplication_notify_after_delivery, receiver, event, event->type(), consumed);
-
+ consumed = receiver->event(event);
return consumed;
}
diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp
index eaf35adb90..b034455cc1 100644
--- a/src/corelib/kernel/qobject.cpp
+++ b/src/corelib/kernel/qobject.cpp
@@ -1457,8 +1457,9 @@ QThread *QObject::thread() const
\snippet code/src_corelib_kernel_qobject.cpp 7
- If \a targetThread is zero, all event processing for this object
- and its children stops.
+ If \a targetThread is \nullptr, all event processing for this object
+ and its children stops, as they are no longer associated with any
+ thread.
Note that all active timers for the object will be reset. The
timers are first stopped in the current thread and restarted (with
@@ -1469,13 +1470,18 @@ QThread *QObject::thread() const
A QEvent::ThreadChange event is sent to this object just before
the thread affinity is changed. You can handle this event to
perform any special processing. Note that any new events that are
- posted to this object will be handled in the \a targetThread.
+ posted to this object will be handled in the \a targetThread,
+ provided it is non-null: when it is \nullptr, no event processing
+ for this object or its children can happen, as they are no longer
+ associated with any thread.
\warning This function is \e not thread-safe; the current thread
must be same as the current thread affinity. In other words, this
function can only "push" an object from the current thread to
another thread, it cannot "pull" an object from any arbitrary
- thread to the current thread.
+ thread to the current thread. There is one exception to this rule
+ however: objects with no thread affinity can be "pulled" to the
+ current thread.
\sa thread()
*/
@@ -3653,12 +3659,13 @@ void doActivate(QObject *sender, int signal_index, void **argv)
if (sp->blockSig)
return;
+ Q_TRACE_SCOPE(QMetaObject_activate, sender, signal_index);
+
if (sp->isDeclarativeSignalConnected(signal_index)
&& QAbstractDeclarativeData::signalEmitted) {
- Q_TRACE(QMetaObject_activate_begin_declarative_signal, sender, signal_index);
+ Q_TRACE_SCOPE(QMetaObject_activate_declarative_signal, sender, signal_index);
QAbstractDeclarativeData::signalEmitted(sp->declarativeData, sender,
signal_index, argv);
- Q_TRACE(QMetaObject_activate_end_declarative_signal, sender, signal_index);
}
const QSignalSpyCallbackSet *signal_spy_set = callbacks_enabled ? qt_signal_spy_callback_set.load() : nullptr;
@@ -3671,8 +3678,6 @@ void doActivate(QObject *sender, int signal_index, void **argv)
// The possible declarative connection is done, and nothing else is connected
if (callbacks_enabled && signal_spy_set->signal_begin_callback != nullptr)
signal_spy_set->signal_begin_callback(sender, signal_index, argv);
- Q_TRACE(QMetaObject_activate_begin_signal, sender, signal_index);
- Q_TRACE(QMetaObject_activate_end_signal, sender, signal_index);
if (callbacks_enabled && signal_spy_set->signal_end_callback != nullptr)
signal_spy_set->signal_end_callback(sender, signal_index);
return;
@@ -3680,7 +3685,6 @@ void doActivate(QObject *sender, int signal_index, void **argv)
if (callbacks_enabled && signal_spy_set->signal_begin_callback != nullptr)
signal_spy_set->signal_begin_callback(sender, signal_index, argv);
- Q_TRACE(QMetaObject_activate_begin_signal, sender, signal_index);
bool senderDeleted = false;
{
@@ -3758,9 +3762,11 @@ void doActivate(QObject *sender, int signal_index, void **argv)
if (c->isSlotObject) {
c->slotObj->ref();
QScopedPointer<QtPrivate::QSlotObjectBase, QSlotObjectBaseDeleter> obj(c->slotObj);
- Q_TRACE(QMetaObject_activate_begin_slot_functor, obj.data());
- obj->call(receiver, argv);
- Q_TRACE(QMetaObject_activate_end_slot_functor, obj.data());
+
+ {
+ Q_TRACE_SCOPE(QMetaObject_activate_slot_functor, obj.data());
+ obj->call(receiver, argv);
+ }
} else if (c->callFunction && c->method_offset <= receiver->metaObject()->methodOffset()) {
//we compare the vtable to make sure we are not in the destructor of the object.
const int method_relative = c->method_relative;
@@ -3768,11 +3774,12 @@ void doActivate(QObject *sender, int signal_index, void **argv)
const int methodIndex = (Q_HAS_TRACEPOINTS || callbacks_enabled) ? c->method() : 0;
if (callbacks_enabled && signal_spy_set->slot_begin_callback != nullptr)
signal_spy_set->slot_begin_callback(receiver, methodIndex, argv);
- Q_TRACE(QMetaObject_activate_begin_slot, receiver, methodIndex);
- callFunction(receiver, QMetaObject::InvokeMetaMethod, method_relative, argv);
+ {
+ Q_TRACE_SCOPE(QMetaObject_activate_slot, receiver, methodIndex);
+ callFunction(receiver, QMetaObject::InvokeMetaMethod, method_relative, argv);
+ }
- Q_TRACE(QMetaObject_activate_end_slot, receiver, methodIndex);
if (callbacks_enabled && signal_spy_set->slot_end_callback != nullptr)
signal_spy_set->slot_end_callback(receiver, methodIndex);
} else {
@@ -3781,11 +3788,12 @@ void doActivate(QObject *sender, int signal_index, void **argv)
if (callbacks_enabled && signal_spy_set->slot_begin_callback != nullptr) {
signal_spy_set->slot_begin_callback(receiver, method, argv);
}
- Q_TRACE(QMetaObject_activate_begin_slot, receiver, method);
- QMetaObject::metacall(receiver, QMetaObject::InvokeMetaMethod, method, argv);
+ {
+ Q_TRACE_SCOPE(QMetaObject_activate_slot, receiver, method);
+ QMetaObject::metacall(receiver, QMetaObject::InvokeMetaMethod, method, argv);
+ }
- Q_TRACE(QMetaObject_activate_end_slot, receiver, method);
if (callbacks_enabled && signal_spy_set->slot_end_callback != nullptr)
signal_spy_set->slot_end_callback(receiver, method);
}
@@ -3803,8 +3811,6 @@ void doActivate(QObject *sender, int signal_index, void **argv)
if (callbacks_enabled && signal_spy_set->signal_end_callback != nullptr)
signal_spy_set->signal_end_callback(sender, signal_index);
- Q_TRACE(QMetaObject_activate_end_signal, sender, signal_index);
-
}
/*!
diff --git a/src/corelib/kernel/qsignalmapper.cpp b/src/corelib/kernel/qsignalmapper.cpp
index 02a1281f92..34fea861cd 100644
--- a/src/corelib/kernel/qsignalmapper.cpp
+++ b/src/corelib/kernel/qsignalmapper.cpp
@@ -37,6 +37,9 @@
**
****************************************************************************/
+#include "qglobal.h"
+#if QT_DEPRECATED_SINCE(5, 10)
+
#include "qsignalmapper.h"
#include "qhash.h"
#include "qobject_p.h"
@@ -312,3 +315,4 @@ QT_END_NAMESPACE
#include "moc_qsignalmapper.cpp"
+#endif
diff --git a/src/corelib/kernel/qvariant.h b/src/corelib/kernel/qvariant.h
index 924cfa1e1a..e094ebff52 100644
--- a/src/corelib/kernel/qvariant.h
+++ b/src/corelib/kernel/qvariant.h
@@ -393,10 +393,13 @@ class Q_CORE_EXPORT QVariant
: type(variantType), is_shared(false), is_null(false)
{}
- inline Private(const Private &other) noexcept
+#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
+ Private(const Private &other) noexcept
: data(other.data), type(other.type),
is_shared(other.is_shared), is_null(other.is_null)
{}
+ Private &operator=(const Private &other) noexcept = default;
+#endif
union Data
{
char c;
diff --git a/src/corelib/qtcore.tracepoints b/src/corelib/qtcore.tracepoints
index 3a70136741..4647b440a8 100644
--- a/src/corelib/qtcore.tracepoints
+++ b/src/corelib/qtcore.tracepoints
@@ -16,7 +16,7 @@ QEvent_ctor(QEvent *event, int type)
QEvent_dtor(QEvent *event, int type)
QCoreApplication_postEvent_entry(QObject *receiver, QEvent *event, int type)
-QCoreApplication_postEvent_exit(QObject *receiver, QEvent *event, int type)
+QCoreApplication_postEvent_exit()
QCoreApplication_postEvent_event_compressed(QObject *receiver, QEvent *event)
QCoreApplication_postEvent_event_posted(QObject *receiver, QEvent *event, int type)
@@ -24,21 +24,18 @@ QCoreApplication_sendEvent(QObject *receiver, QEvent *event, int type)
QCoreApplication_sendSpontaneousEvent(QObject *receiver, QEvent *event, int type)
QCoreApplication_notify_entry(QObject *receiver, QEvent *event, int type)
-QCoreApplication_notify_exit(QObject *receiver, QEvent *event, int type)
-QCoreApplication_notify_event_filtered(QObject *receiver, QEvent *event, int type)
-QCoreApplication_notify_before_delivery(QObject *receiver, QEvent *event, int type)
-QCoreApplication_notify_after_delivery(QObject *receiver, QEvent *event, int type, bool consumed)
+QCoreApplication_notify_exit(bool consumed, bool filtered)
QObject_ctor(QObject *object)
QObject_dtor(QObject *object)
-QMetaObject_activate_begin_signal(QObject *sender, int signalIndex)
-QMetaObject_activate_end_signal(QObject *sender, int signalIndex)
-QMetaObject_activate_begin_slot(QObject *receiver, int slotIndex)
-QMetaObject_activate_end_slot(QObject *receiver, int slotIndex)
-QMetaObject_activate_begin_slot_functor(void *slotObject)
-QMetaObject_activate_end_slot_functor(void *slotObject)
-QMetaObject_activate_begin_declarative_signal(QObject *sender, int signalIndex)
-QMetaObject_activate_end_declarative_signal(QObject *sender, int signalIndex)
+QMetaObject_activate_entry(QObject *sender, int signalIndex)
+QMetaObject_activate_exit()
+QMetaObject_activate_slot_entry(QObject *receiver, int slotIndex)
+QMetaObject_activate_slot_exit()
+QMetaObject_activate_slot_functor_entry(void *slotObject)
+QMetaObject_activate_slot_functor_exit()
+QMetaObject_activate_declarative_signal_entry(QObject *sender, int signalIndex)
+QMetaObject_activate_declarative_signal_exit()
qt_message_print(int type, const char *category, const char *function, const char *file, int line, const QString &message)
diff --git a/src/corelib/tools/qbytearraylist.h b/src/corelib/tools/qbytearraylist.h
index d69e8bb54b..1261e1757c 100644
--- a/src/corelib/tools/qbytearraylist.h
+++ b/src/corelib/tools/qbytearraylist.h
@@ -67,7 +67,7 @@ template <> struct QListSpecialMethods<QByteArray>
{
#ifndef Q_CLANG_QDOC
protected:
- ~QListSpecialMethods() {}
+ ~QListSpecialMethods() = default;
#endif
public:
inline QByteArray join() const
diff --git a/src/corelib/tools/qlist.h b/src/corelib/tools/qlist.h
index 513d7eafe1..25380d45ec 100644
--- a/src/corelib/tools/qlist.h
+++ b/src/corelib/tools/qlist.h
@@ -74,7 +74,7 @@ template <typename T> class QSet;
template <typename T> struct QListSpecialMethods
{
protected:
- ~QListSpecialMethods() {}
+ ~QListSpecialMethods() = default;
};
template <> struct QListSpecialMethods<QByteArray>;
template <> struct QListSpecialMethods<QString>;
@@ -247,6 +247,8 @@ public:
// can't remove it in Qt 5, since doing so would make the type trivial,
// which changes the way it's passed to functions by value.
inline iterator(const iterator &o) noexcept : i(o.i){}
+ inline iterator &operator=(const iterator &o) noexcept
+ { i = o.i; return *this; }
#endif
inline T &operator*() const { return i->t(); }
inline T *operator->() const { return &i->t(); }
@@ -300,6 +302,8 @@ public:
// can't remove it in Qt 5, since doing so would make the type trivial,
// which changes the way it's passed to functions by value.
inline const_iterator(const const_iterator &o) noexcept : i(o.i) {}
+ inline const_iterator &operator=(const const_iterator &o) noexcept
+ { i = o.i; return *this; }
#endif
#ifdef QT_STRICT_ITERATORS
inline explicit const_iterator(const iterator &o) noexcept : i(o.i) {}
diff --git a/src/corelib/tools/qlocale_mac.mm b/src/corelib/tools/qlocale_mac.mm
index edbaaf5d18..574cb0714c 100644
--- a/src/corelib/tools/qlocale_mac.mm
+++ b/src/corelib/tools/qlocale_mac.mm
@@ -332,6 +332,17 @@ static QString macCurrencySymbol(QLocale::CurrencySymbolFormat format)
return QString();
}
+static QString macZeroDigit()
+{
+ QCFType<CFLocaleRef> locale = CFLocaleCopyCurrent();
+ QCFType<CFNumberFormatterRef> numberFormatter =
+ CFNumberFormatterCreate(nullptr, locale, kCFNumberFormatterNoStyle);
+ static const int zeroDigit = 0;
+ QCFType<CFStringRef> value = CFNumberFormatterCreateStringWithValue(nullptr, numberFormatter,
+ kCFNumberIntType, &zeroDigit);
+ return QString::fromCFString(value);
+}
+
#ifndef QT_NO_SYSTEMLOCALE
static QString macFormatCurrency(const QSystemLocale::CurrencyToStringArgument &arg)
{
@@ -437,8 +448,9 @@ QVariant QSystemLocale::query(QueryType type, QVariant in = QVariant()) const
case NegativeSign:
case PositiveSign:
- case ZeroDigit:
break;
+ case ZeroDigit:
+ return QVariant(macZeroDigit());
case MeasurementSystem:
return QVariant(static_cast<int>(macMeasurementSystem()));
diff --git a/src/corelib/tools/qsharedpointer.cpp b/src/corelib/tools/qsharedpointer.cpp
index 0aedf4c6d6..cb6ba38f29 100644
--- a/src/corelib/tools/qsharedpointer.cpp
+++ b/src/corelib/tools/qsharedpointer.cpp
@@ -649,19 +649,7 @@
*/
/*!
- \fn template <class T> QSharedPointer<T> QSharedPointer<T>::create()
- \since 5.1
-
- Creates a QSharedPointer object and allocates a new item of type \tt T. The
- QSharedPointer internals and the object are allocated in one single memory
- allocation, which could help reduce memory fragmentation in a long-running
- application.
-
- This function calls the default constructor for type \tt T.
-*/
-
-/*!
- \fn template <class T> QSharedPointer<T> QSharedPointer<T>::create(...)
+ \fn template <class T> template <typename... Args> QSharedPointer<T> QSharedPointer<T>::create(Args &&... args)
\overload
\since 5.1
@@ -671,18 +659,7 @@
application.
This function will attempt to call a constructor for type \tt T that can
- accept all the arguments passed. Arguments will be perfectly-forwarded.
-
- \note This function is only fully available with a C++11 compiler that
- supports perfect forwarding of an arbitrary number of arguments.
-
- If the compiler does not support the necessary C++11 features,
- then a restricted version is available since Qt 5.4: you may pass
- one (but just one) argument, and it will always be passed by const
- reference.
-
- If you target Qt before version 5.4, you must use the overload
- that calls the default constructor.
+ accept all the arguments passed (\a args). Arguments will be perfectly-forwarded.
*/
/*!
diff --git a/src/corelib/tools/qsharedpointer.h b/src/corelib/tools/qsharedpointer.h
index 98b38b97d3..a2c5f990fc 100644
--- a/src/corelib/tools/qsharedpointer.h
+++ b/src/corelib/tools/qsharedpointer.h
@@ -97,8 +97,8 @@ public:
template <class X> QSharedPointer<X> constCast() const;
template <class X> QSharedPointer<X> objectCast() const;
- static inline QSharedPointer<T> create();
- static inline QSharedPointer<T> create(...);
+ template <typename... Args>
+ static inline QSharedPointer<T> create(Args &&... args);
};
template <class T>
diff --git a/src/corelib/tools/qstringlist.h b/src/corelib/tools/qstringlist.h
index cf136a64c6..81748e9a0b 100644
--- a/src/corelib/tools/qstringlist.h
+++ b/src/corelib/tools/qstringlist.h
@@ -67,7 +67,7 @@ template <> struct QListSpecialMethods<QString>
{
#ifndef Q_QDOC
protected:
- ~QListSpecialMethods() {}
+ ~QListSpecialMethods() = default;
#endif
public:
inline void sort(Qt::CaseSensitivity cs = Qt::CaseSensitive);