From 13f5e5c6b2c320c33dd0b9305de410bef1b3c2c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mi=C5=82osz=20Kosobucki?= Date: Sat, 11 Nov 2017 21:05:39 +0100 Subject: Improve QObject::moveToThread doc MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change mentions of parameter value being "zero" to nullptr. Clarify that when nullptr is passed to moveToThread() event processing is stopped because the object is no longer associated with any thread. Also, reitarete this fact in the paragraph about processing of new events. There's an exception to the rule that QObjects cannot be "pulled" by moveToThread that is buried in the implementation and not mentioned in the doc. This information is worth noting explicitly. Change-Id: I816ff737c48d8057b39e36b566079710aeb8e690 Reviewed-by: André Hartmann Reviewed-by: Edward Welbourne --- src/corelib/kernel/qobject.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'src/corelib') diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp index a791d2e8b3..2a05f7f383 100644 --- a/src/corelib/kernel/qobject.cpp +++ b/src/corelib/kernel/qobject.cpp @@ -1445,8 +1445,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 @@ -1457,13 +1458,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() */ -- cgit v1.2.3 From e5eaae100b35d97f22a388831a5b9cd712053f3f Mon Sep 17 00:00:00 2001 From: Milian Wolff Date: Fri, 26 Apr 2019 15:16:18 +0200 Subject: Refactor QMetaObject::activate tracepoints Use Q_TRACE_SCOPE and the corresponding naming scheme. Additionally, don't change the behavior of the code when tracing is enabled, i.e. continue to return early if possible. Change-Id: I9ba9679869db1541a19bc832beede902224c52f2 Reviewed-by: Thiago Macieira --- src/corelib/kernel/qobject.cpp | 34 +++++++++++++++++----------------- src/corelib/qtcore.tracepoints | 16 ++++++++-------- 2 files changed, 25 insertions(+), 25 deletions(-) (limited to 'src/corelib') diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp index 2a05f7f383..68c5460b6a 100644 --- a/src/corelib/kernel/qobject.cpp +++ b/src/corelib/kernel/qobject.cpp @@ -3664,19 +3664,18 @@ void QMetaObject::activate(QObject *sender, int signalOffset, int local_signal_i if (sender->d_func()->blockSig) return; + Q_TRACE_SCOPE(QMetaObject_activate, sender, signal_index); + if (sender->d_func()->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(sender->d_func()->declarativeData, sender, signal_index, argv); - Q_TRACE(QMetaObject_activate_end_declarative_signal, sender, signal_index); } if (!sender->d_func()->isSignalConnected(signal_index, /*checkDeclarative =*/ false) && !qt_signal_spy_callback_set.signal_begin_callback - && !qt_signal_spy_callback_set.signal_end_callback - && !Q_TRACE_ENABLED(QMetaObject_activate_begin_signal) - && !Q_TRACE_ENABLED(QMetaObject_activate_end_signal)) { + && !qt_signal_spy_callback_set.signal_end_callback) { // The possible declarative connection is done, and nothing else is connected, so: return; } @@ -3686,7 +3685,6 @@ void QMetaObject::activate(QObject *sender, int signalOffset, int local_signal_i qt_signal_spy_callback_set.signal_begin_callback(sender, signal_index, argv ? argv : empty_argv); } - Q_TRACE(QMetaObject_activate_begin_signal, sender, signal_index); { QMutexLocker locker(signalSlotLock(sender)); @@ -3717,7 +3715,6 @@ void QMetaObject::activate(QObject *sender, int signalOffset, int local_signal_i locker.unlock(); if (qt_signal_spy_callback_set.signal_end_callback != 0) qt_signal_spy_callback_set.signal_end_callback(sender, signal_index); - Q_TRACE(QMetaObject_activate_end_signal, sender, signal_index); return; } @@ -3778,9 +3775,11 @@ void QMetaObject::activate(QObject *sender, int signalOffset, int local_signal_i c->slotObj->ref(); QScopedPointer obj(c->slotObj); locker.unlock(); - Q_TRACE(QMetaObject_activate_begin_slot_functor, obj.data()); - obj->call(receiver, argv ? argv : empty_argv); - Q_TRACE(QMetaObject_activate_end_slot_functor, obj.data()); + + { + Q_TRACE_SCOPE(QMetaObject_activate_slot_functor, obj.data()); + obj->call(receiver, argv ? argv : empty_argv); + } // Make sure the slot object gets destroyed before the mutex is locked again, as the // destructor of the slot object might also lock a mutex from the signalSlotLock() mutex pool, @@ -3796,11 +3795,12 @@ void QMetaObject::activate(QObject *sender, int signalOffset, int local_signal_i locker.unlock(); if (qt_signal_spy_callback_set.slot_begin_callback != 0) qt_signal_spy_callback_set.slot_begin_callback(receiver, methodIndex, argv ? argv : empty_argv); - Q_TRACE(QMetaObject_activate_begin_slot, receiver, methodIndex); - callFunction(receiver, QMetaObject::InvokeMetaMethod, method_relative, argv ? argv : empty_argv); + { + Q_TRACE_SCOPE(QMetaObject_activate_slot, receiver, methodIndex); + callFunction(receiver, QMetaObject::InvokeMetaMethod, method_relative, argv ? argv : empty_argv); + } - Q_TRACE(QMetaObject_activate_end_slot, receiver, methodIndex); if (qt_signal_spy_callback_set.slot_end_callback != 0) qt_signal_spy_callback_set.slot_end_callback(receiver, methodIndex); locker.relock(); @@ -3813,11 +3813,12 @@ void QMetaObject::activate(QObject *sender, int signalOffset, int local_signal_i method, argv ? argv : empty_argv); } - Q_TRACE(QMetaObject_activate_begin_slot, receiver, method); - metacall(receiver, QMetaObject::InvokeMetaMethod, method, argv ? argv : empty_argv); + { + Q_TRACE_SCOPE(QMetaObject_activate_slot, receiver, method); + metacall(receiver, QMetaObject::InvokeMetaMethod, method, argv ? argv : empty_argv); + } - Q_TRACE(QMetaObject_activate_end_slot, receiver, method); if (qt_signal_spy_callback_set.slot_end_callback != 0) qt_signal_spy_callback_set.slot_end_callback(receiver, method); @@ -3838,7 +3839,6 @@ void QMetaObject::activate(QObject *sender, int signalOffset, int local_signal_i if (qt_signal_spy_callback_set.signal_end_callback != 0) qt_signal_spy_callback_set.signal_end_callback(sender, signal_index); - Q_TRACE(QMetaObject_activate_end_signal, sender, signal_index); } /*! diff --git a/src/corelib/qtcore.tracepoints b/src/corelib/qtcore.tracepoints index 3a70136741..7078950027 100644 --- a/src/corelib/qtcore.tracepoints +++ b/src/corelib/qtcore.tracepoints @@ -32,13 +32,13 @@ QCoreApplication_notify_after_delivery(QObject *receiver, QEvent *event, int typ 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(QObject *sender, int signalIndex) +QMetaObject_activate_slot_entry(QObject *receiver, int slotIndex) +QMetaObject_activate_slot_exit(QObject *receiver, int slotIndex) +QMetaObject_activate_slot_functor_entry(void *slotObject) +QMetaObject_activate_slot_functor_exit(void *slotObject) +QMetaObject_activate_declarative_signal_entry(QObject *sender, int signalIndex) +QMetaObject_activate_declarative_signal_exit(QObject *sender, int signalIndex) qt_message_print(int type, const char *category, const char *function, const char *file, int line, const QString &message) -- cgit v1.2.3 From 75c0c026414239919603d6a5a35e333f257368c9 Mon Sep 17 00:00:00 2001 From: Milian Wolff Date: Fri, 26 Apr 2019 15:21:12 +0200 Subject: Don't pass scope args to _exit trace points When we trace a scope, then we pass the scope args to the _entry trace point. There is no need to do that also for the _exit trace points, it just blows up the trace data for no obvious gain. Any decent tracing consumer can easily find the args for the _exit call by matching it to its _entry call. Note that this is standard practice in trace points, and also done like this in the Linux Kernel trace points for example. Change-Id: I273293b0c7e799767acc1960b50ab675fc765a36 Reviewed-by: Thiago Macieira --- src/corelib/global/qtrace_p.h | 2 +- src/corelib/qtcore.tracepoints | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) (limited to 'src/corelib') diff --git a/src/corelib/global/qtrace_p.h b/src/corelib/global/qtrace_p.h index 20f2beac98..4cef126bb6 100644 --- a/src/corelib/global/qtrace_p.h +++ b/src/corelib/global/qtrace_p.h @@ -127,7 +127,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/qtcore.tracepoints b/src/corelib/qtcore.tracepoints index 7078950027..a1bc957fe5 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,7 +24,7 @@ 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_exit() 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) @@ -33,12 +33,12 @@ QObject_ctor(QObject *object) QObject_dtor(QObject *object) QMetaObject_activate_entry(QObject *sender, int signalIndex) -QMetaObject_activate_exit(QObject *sender, int signalIndex) +QMetaObject_activate_exit() QMetaObject_activate_slot_entry(QObject *receiver, int slotIndex) -QMetaObject_activate_slot_exit(QObject *receiver, int slotIndex) +QMetaObject_activate_slot_exit() QMetaObject_activate_slot_functor_entry(void *slotObject) -QMetaObject_activate_slot_functor_exit(void *slotObject) +QMetaObject_activate_slot_functor_exit() QMetaObject_activate_declarative_signal_entry(QObject *sender, int signalIndex) -QMetaObject_activate_declarative_signal_exit(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) -- cgit v1.2.3 From ef05c48898e90e4ff40d8c4493f4b80bc22c1703 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Tue, 13 Nov 2018 17:14:43 +0100 Subject: Fix -Wdeprecated-copy warnings Implicit copy constructors or methods are considered deprecated for classes that has one of the two or a destructor. The warning is enabled with -Wextra in gcc 9 Change-Id: Ic9be654f2a142fb186a4d5a7d6b4f7d6f4e611d8 Reviewed-by: Thiago Macieira --- src/corelib/io/qprocess_p.h | 3 +-- src/corelib/kernel/qvariant.h | 5 ++++- src/corelib/tools/qbytearraylist.h | 2 +- src/corelib/tools/qlist.h | 6 +++++- src/corelib/tools/qstringlist.h | 2 +- 5 files changed, 12 insertions(+), 6 deletions(-) (limited to 'src/corelib') diff --git a/src/corelib/io/qprocess_p.h b/src/corelib/io/qprocess_p.h index aa7ecbe91d..eb2d1ed048 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/qvariant.h b/src/corelib/kernel/qvariant.h index f95502e75f..3cc6d559c1 100644 --- a/src/corelib/kernel/qvariant.h +++ b/src/corelib/kernel/qvariant.h @@ -398,10 +398,13 @@ class Q_CORE_EXPORT QVariant : type(variantType), is_shared(false), is_null(false) {} - inline Private(const Private &other) Q_DECL_NOTHROW +#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) + Private(const Private &other) Q_DECL_NOTHROW : data(other.data), type(other.type), is_shared(other.is_shared), is_null(other.is_null) {} + Private &operator=(const Private &other) Q_DECL_NOTHROW = default; +#endif union Data { char c; 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 { #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 6643288bd5..e593ba9aa3 100644 --- a/src/corelib/tools/qlist.h +++ b/src/corelib/tools/qlist.h @@ -73,7 +73,7 @@ template class QSet; template struct QListSpecialMethods { protected: - ~QListSpecialMethods() {} + ~QListSpecialMethods() = default; }; template <> struct QListSpecialMethods; template <> struct QListSpecialMethods; @@ -249,6 +249,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) Q_DECL_NOTHROW : i(o.i){} + inline iterator &operator=(const iterator &o) Q_DECL_NOTHROW + { i = o.i; return *this; } #endif inline T &operator*() const { return i->t(); } inline T *operator->() const { return &i->t(); } @@ -302,6 +304,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) Q_DECL_NOTHROW : i(o.i) {} + inline const_iterator &operator=(const const_iterator &o) Q_DECL_NOTHROW + { i = o.i; return *this; } #endif #ifdef QT_STRICT_ITERATORS inline explicit const_iterator(const iterator &o) Q_DECL_NOTHROW : i(o.i) {} diff --git a/src/corelib/tools/qstringlist.h b/src/corelib/tools/qstringlist.h index b6c48488df..6b04b7aef1 100644 --- a/src/corelib/tools/qstringlist.h +++ b/src/corelib/tools/qstringlist.h @@ -66,7 +66,7 @@ template <> struct QListSpecialMethods { #ifndef Q_QDOC protected: - ~QListSpecialMethods() {} + ~QListSpecialMethods() = default; #endif public: inline void sort(Qt::CaseSensitivity cs = Qt::CaseSensitive); -- cgit v1.2.3 From 75634c9a53133d03c245bbaab4b2047ff823ef03 Mon Sep 17 00:00:00 2001 From: Milian Wolff Date: Mon, 29 Apr 2019 10:39:37 +0200 Subject: Reduce amount of tracepoints required for event tracking Encode the consumed/filtered state in the _exit tracepoint and remove the separate tracking of receiver event handling. Combined, this reduces the size of the trace file. Change-Id: Icb3cb2dd47798543905cea450046d6fad559a15b Reviewed-by: Thiago Macieira --- src/corelib/kernel/qcoreapplication.cpp | 20 +++++++++----------- src/corelib/qtcore.tracepoints | 5 +---- 2 files changed, 10 insertions(+), 15 deletions(-) (limited to 'src/corelib') diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp index 596941b5a9..e5f39a8d35 100644 --- a/src/corelib/kernel/qcoreapplication.cpp +++ b/src/corelib/kernel/qcoreapplication.cpp @@ -1197,28 +1197,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/qtcore.tracepoints b/src/corelib/qtcore.tracepoints index a1bc957fe5..4647b440a8 100644 --- a/src/corelib/qtcore.tracepoints +++ b/src/corelib/qtcore.tracepoints @@ -24,10 +24,7 @@ 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() -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) -- cgit v1.2.3 From 513e29af1d1742abec5034e5d376f743c92f9e77 Mon Sep 17 00:00:00 2001 From: Giuseppe D'Angelo Date: Thu, 2 May 2019 13:31:17 +0200 Subject: QSharedPointer: fix docs for create() In 5.12 only the variadic argument version is left (as all supported compilers have variadic templates). Remove the docs of the nullary overload, and fix the docs for the remaining overload. Change-Id: I54cc7ea71cc61ba1330a9ad92e4fa2ae7f749bac Reviewed-by: Thiago Macieira --- src/corelib/tools/qsharedpointer.cpp | 27 ++------------------------- src/corelib/tools/qsharedpointer.h | 4 ++-- 2 files changed, 4 insertions(+), 27 deletions(-) (limited to 'src/corelib') diff --git a/src/corelib/tools/qsharedpointer.cpp b/src/corelib/tools/qsharedpointer.cpp index 6ab84cf3d8..95b584e914 100644 --- a/src/corelib/tools/qsharedpointer.cpp +++ b/src/corelib/tools/qsharedpointer.cpp @@ -649,19 +649,7 @@ */ /*! - \fn template QSharedPointer QSharedPointer::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 QSharedPointer QSharedPointer::create(...) + \fn template template QSharedPointer QSharedPointer::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 QSharedPointer constCast() const; template QSharedPointer objectCast() const; - static inline QSharedPointer create(); - static inline QSharedPointer create(...); + template + static inline QSharedPointer create(Args &&... args); }; template -- cgit v1.2.3 From 047633a9457891a5b1132c6be7b6b5b17729133c Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Thu, 2 May 2019 08:49:37 +0200 Subject: Cocoa: Get the right zero digit for the locale MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Ic23e541e1b12b3c94f8d191cb8fb0f76086b69a5 Reviewed-by: Tor Arne Vestbø Reviewed-by: Thiago Macieira --- src/corelib/tools/qlocale_mac.mm | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'src/corelib') 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 locale = CFLocaleCopyCurrent(); + QCFType numberFormatter = + CFNumberFormatterCreate(nullptr, locale, kCFNumberFormatterNoStyle); + static const int zeroDigit = 0; + QCFType 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(macMeasurementSystem())); -- cgit v1.2.3 From 615b02bfa2fb861f362c511087e6962660c25ea3 Mon Sep 17 00:00:00 2001 From: Christian Ehrlicher Date: Sun, 28 Apr 2019 13:39:29 +0200 Subject: QtCore: compile with QT_DISABLE_DEPRECATED_BEFORE=0x050d00 Don't call or implement functions which are not available when compiling with QT_DISABLE_DEPRECATED_BEFORE=0x050d00 Change-Id: I949b12bba880c516391f312f58c8748303a1790d Reviewed-by: Lars Knoll Reviewed-by: Thiago Macieira --- src/corelib/io/qprocess.cpp | 5 +++++ src/corelib/kernel/qcoreapplication.cpp | 2 ++ src/corelib/kernel/qsignalmapper.cpp | 4 ++++ 3 files changed, 11 insertions(+) (limited to 'src/corelib') diff --git a/src/corelib/io/qprocess.cpp b/src/corelib/io/qprocess.cpp index a4d0962b33..9557a1d24b 100644 --- a/src/corelib/io/qprocess.cpp +++ b/src/corelib/io/qprocess.cpp @@ -998,7 +998,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/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp index 0711914e2d..69b2a9bf41 100644 --- a/src/corelib/kernel/qcoreapplication.cpp +++ b/src/corelib/kernel/qcoreapplication.cpp @@ -1013,6 +1013,7 @@ void QCoreApplication::setQuitLockEnabled(bool enabled) quitLockRefEnabled = enabled; } +#if QT_DEPRECATED_SINCE(5, 6) /*! \internal \deprecated @@ -1024,6 +1025,7 @@ bool QCoreApplication::notifyInternal(QObject *receiver, QEvent *event) { return notifyInternal2(receiver, event); } +#endif /*! \internal 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 -- cgit v1.2.3 From 5d76529580b72ead582b6e09112b5b94c0b11113 Mon Sep 17 00:00:00 2001 From: Nick Shaforostov Date: Wed, 26 Sep 2018 17:16:10 +0200 Subject: fix crash when using ALDI usb-stick with broken filesystem I was using a cheap usb-stick from ALDI supermarket with fat32, and my application crashed because filesystem was empty. Unrealistic scenario, but still just returning here false is better than a crash Change-Id: I8979d5a4e19ce57770ab03983e847b272ebf7019 Reviewed-by: Thiago Macieira --- src/corelib/io/qdiriterator.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/corelib') diff --git a/src/corelib/io/qdiriterator.cpp b/src/corelib/io/qdiriterator.cpp index 648593b020..ccde9745bf 100644 --- a/src/corelib/io/qdiriterator.cpp +++ b/src/corelib/io/qdiriterator.cpp @@ -320,7 +320,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(); -- cgit v1.2.3