From 5f52974860a9fc62ec5e7c56853156fed01b3aed Mon Sep 17 00:00:00 2001 From: Kurt Pattyn Date: Sun, 12 Jan 2014 17:58:56 +0100 Subject: Retain compiler warning state MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Added push and pop pragma warning statements. Suppression of warnings should not propagate to user code. Therefore, suppression of warnings is restricted to the file where it is used. Change-Id: Ib7973cbc0205ebbe75e002d035e44fd9b447460f Reviewed-by: Jędrzej Nowacki --- src/corelib/tools/qvector.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/corelib') diff --git a/src/corelib/tools/qvector.h b/src/corelib/tools/qvector.h index 505e1a32e4..075e8e83e8 100644 --- a/src/corelib/tools/qvector.h +++ b/src/corelib/tools/qvector.h @@ -254,7 +254,10 @@ private: }; #ifdef Q_CC_MSVC -# pragma warning ( disable : 4345 ) // behavior change: an object of POD type constructed with an initializer of the form () will be default-initialized +// behavior change: an object of POD type constructed with an initializer of the form () +// will be default-initialized +# pragma warning ( push ) +# pragma warning ( disable : 4345 ) #endif template @@ -270,7 +273,7 @@ void QVector::defaultConstruct(T *from, T *to) } #ifdef Q_CC_MSVC -# pragma warning ( default: 4345 ) +# pragma warning ( pop ) #endif template -- cgit v1.2.3 From 9eba69d7f914e4823e94699c5653df5ad279eb46 Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Tue, 21 Jan 2014 08:42:05 +0100 Subject: Fix a bug in some QString comparison operators MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Some comparison operators comparing to const char * where not implemented correctly. Task-number: QTBUG-34024 Change-Id: Idbdc64c8ed93e88d9f2b2f55213bc785b33cb543 Reviewed-by: Jędrzej Nowacki --- src/corelib/tools/qstring.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/corelib') diff --git a/src/corelib/tools/qstring.h b/src/corelib/tools/qstring.h index 0a0a609728..9778d42c1d 100644 --- a/src/corelib/tools/qstring.h +++ b/src/corelib/tools/qstring.h @@ -1029,13 +1029,13 @@ inline QT_ASCII_CAST_WARN bool operator==(const char *s1, const QString &s2) inline QT_ASCII_CAST_WARN bool operator!=(const char *s1, const QString &s2) { return QString::compare_helper(s2.constData(), s2.size(), s1, -1) != 0; } inline QT_ASCII_CAST_WARN bool operator<(const char *s1, const QString &s2) -{ return QString::compare_helper(s2.constData(), s2.size(), s1, -1) < 0; } -inline QT_ASCII_CAST_WARN bool operator>(const char *s1, const QString &s2) { return QString::compare_helper(s2.constData(), s2.size(), s1, -1) > 0; } +inline QT_ASCII_CAST_WARN bool operator>(const char *s1, const QString &s2) +{ return QString::compare_helper(s2.constData(), s2.size(), s1, -1) < 0; } inline QT_ASCII_CAST_WARN bool operator<=(const char *s1, const QString &s2) -{ return QString::compare_helper(s2.constData(), s2.size(), s1, -1) <= 0; } -inline QT_ASCII_CAST_WARN bool operator>=(const char *s1, const QString &s2) { return QString::compare_helper(s2.constData(), s2.size(), s1, -1) >= 0; } +inline QT_ASCII_CAST_WARN bool operator>=(const char *s1, const QString &s2) +{ return QString::compare_helper(s2.constData(), s2.size(), s1, -1) <= 0; } inline QT_ASCII_CAST_WARN bool operator==(const char *s1, QLatin1String s2) { return QString::fromUtf8(s1) == s2; } -- cgit v1.2.3 From 5b570c287f0ddd8897a22acc53416b1f89c11da7 Mon Sep 17 00:00:00 2001 From: Kurt Pattyn Date: Sun, 12 Jan 2014 19:10:30 +0100 Subject: Conditionally disable deprecated warnings Warning C4786 has been removed from MSVC2013. Warning C4231 has been removed since MSVC2003 .net. Added #ifdef statements to only suppress these warnings when the compiler versions supports them. Change-Id: I47d6116bc02cdeef6b2172be0b09d105af9d0059 Reviewed-by: Thiago Macieira --- src/corelib/global/qglobal.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/corelib') diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index 9bba21210c..30db4e75cf 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -826,9 +826,13 @@ Q_CORE_EXPORT void qFreeAligned(void *ptr); # pragma warning(disable: 4800) /* 'type' : forcing value to bool 'true' or 'false' (performance warning) */ # pragma warning(disable: 4097) /* typedef-name 'identifier1' used as synonym for class-name 'identifier2' */ # pragma warning(disable: 4706) /* assignment within conditional expression */ -# pragma warning(disable: 4786) /* 'identifier' : identifier was truncated to 'number' characters in the debug information */ +# if _MSC_VER <= 1310 // MSVC 2003 +# pragma warning(disable: 4786) /* 'identifier' : identifier was truncated to 'number' characters in the debug information */ +# endif # pragma warning(disable: 4355) /* 'this' : used in base member initializer list */ -# pragma warning(disable: 4231) /* nonstandard extension used : 'identifier' before template explicit instantiation */ +# if _MSC_VER < 1800 // MSVC 2013 +# pragma warning(disable: 4231) /* nonstandard extension used : 'identifier' before template explicit instantiation */ +# endif # pragma warning(disable: 4710) /* function not inlined */ # pragma warning(disable: 4530) /* C++ exception handler used, but unwind semantics are not enabled. Specify /EHsc */ # elif defined(Q_CC_BOR) -- cgit v1.2.3 From b5241296f8600ea3ba962c45ed8038abec5343f1 Mon Sep 17 00:00:00 2001 From: Orgad Shaneh Date: Wed, 4 Dec 2013 14:33:25 +0200 Subject: QDir: Do not assume that root ends with a slash Root can also be "//server" Task-number: QTBUG-35402 Change-Id: I25250b7dcb10cba7b676a0c88b64a402494d7481 Reviewed-by: Friedemann Kleint Reviewed-by: Thiago Macieira --- src/corelib/io/qdir.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src/corelib') diff --git a/src/corelib/io/qdir.cpp b/src/corelib/io/qdir.cpp index 015f4cfe14..b704126efa 100644 --- a/src/corelib/io/qdir.cpp +++ b/src/corelib/io/qdir.cpp @@ -716,11 +716,12 @@ QString QDir::absoluteFilePath(const QString &fileName) const return fileName; d->resolveAbsoluteEntry(); + const QString absoluteDirPath = d->absoluteDirEntry.filePath(); if (fileName.isEmpty()) - return d->absoluteDirEntry.filePath(); - if (!d->absoluteDirEntry.isRoot()) - return d->absoluteDirEntry.filePath() % QLatin1Char('/') % fileName; - return d->absoluteDirEntry.filePath() % fileName; + return absoluteDirPath; + if (!absoluteDirPath.endsWith(QLatin1Char('/'))) + return absoluteDirPath % QLatin1Char('/') % fileName; + return absoluteDirPath % fileName; } /*! -- cgit v1.2.3 From 5aee85ec23f5c28fdccd9bd9d6ac90882bda348e Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Mon, 20 Jan 2014 11:53:21 -0800 Subject: Don't allow the QLibraryStore to be recreated during shutdown When QtCore's global destructors are run, they delete the global QLibraryStore qt_library_data and set the pointer to null. If something happened to call QLibraryStore::instance() later, it would be recreated and then weird things might happen. So prevent that from happening. That usually cannot happen, since the only thing that can run after QtCore global destructors are other QtCore global destructors or global destructors from libraries that do not depend on QtCore. So we're reasonably safe. There are two conditions in which something could run after QLibraryStore::cleanup() and still try to access QLibraryStore: 1) indirect dependency, like a global destructor from a library that doesn't depend on QtCore running code from another module that does. 2) static builds of Qt modules. In that case, the order of the global destructors is totally arbitrary and we could get one from a module that depends on QtCore running after QtCore's. That is the case from the bug report. Task-number: QTBUG-36294 Change-Id: Id199671275fd2535acf2d158857ce46b474e579b Reviewed-by: Kai Koehne Reviewed-by: Tim Jenssen --- src/corelib/plugin/qlibrary.cpp | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) (limited to 'src/corelib') diff --git a/src/corelib/plugin/qlibrary.cpp b/src/corelib/plugin/qlibrary.cpp index 468f759189..9736950c89 100644 --- a/src/corelib/plugin/qlibrary.cpp +++ b/src/corelib/plugin/qlibrary.cpp @@ -374,6 +374,7 @@ private: static QBasicMutex qt_library_mutex; static QLibraryStore *qt_library_data = 0; +static bool qt_library_data_once; QLibraryStore::~QLibraryStore() { @@ -429,8 +430,11 @@ Q_DESTRUCTOR_FUNCTION(qlibraryCleanup) // must be called with a locked mutex QLibraryStore *QLibraryStore::instance() { - if (Q_UNLIKELY(!qt_library_data)) + if (Q_UNLIKELY(!qt_library_data_once && !qt_library_data)) { + // only create once per process lifetime qt_library_data = new QLibraryStore; + qt_library_data_once = true; + } return qt_library_data; } @@ -440,12 +444,15 @@ inline QLibraryPrivate *QLibraryStore::findOrCreate(const QString &fileName, con QLibraryStore *data = instance(); // check if this library is already loaded - QLibraryPrivate *lib = data->libraryMap.value(fileName); + QLibraryPrivate *lib = 0; + if (Q_LIKELY(data)) + lib = data->libraryMap.value(fileName); if (!lib) lib = new QLibraryPrivate(fileName, version); // track this library - data->libraryMap.insert(fileName, lib); + if (Q_LIKELY(data)) + data->libraryMap.insert(fileName, lib); lib->libraryRefCount.ref(); return lib; @@ -464,9 +471,11 @@ inline void QLibraryStore::releaseLibrary(QLibraryPrivate *lib) // no one else is using Q_ASSERT(lib->libraryUnloadCount.load() == 0); - QLibraryPrivate *that = data->libraryMap.take(lib->fileName); - Q_ASSERT(lib == that); - Q_UNUSED(that); + if (Q_LIKELY(data)) { + QLibraryPrivate *that = data->libraryMap.take(lib->fileName); + Q_ASSERT(lib == that); + Q_UNUSED(that); + } delete lib; } -- cgit v1.2.3 From 4fab72a5eb19d34eb9b96a192fd901ddf7db2c92 Mon Sep 17 00:00:00 2001 From: Nico Vertriest Date: Thu, 12 Dec 2013 10:22:34 +0100 Subject: Doc: corrected broken links Links fixed: Extra Filters Basic Tools blockingfortuneclient Thread Support Drag and drop examples qBinaryFind qmake common project types imagegestures Task-number: QTBUG-34749 Change-Id: Ib93dda00716dc596db327fee5b97e110a9f27fa7 Reviewed-by: Martin Smith --- src/corelib/tools/qalgorithms.qdoc | 3 --- 1 file changed, 3 deletions(-) (limited to 'src/corelib') diff --git a/src/corelib/tools/qalgorithms.qdoc b/src/corelib/tools/qalgorithms.qdoc index 40eb2ed41d..8feb180248 100644 --- a/src/corelib/tools/qalgorithms.qdoc +++ b/src/corelib/tools/qalgorithms.qdoc @@ -662,9 +662,6 @@ This function requires the item type (in the example above, QString) to implement \c operator<(). - See the \l{#binaryFind example}{detailed - description} for an example usage. - \sa qLowerBound(), qUpperBound(), {random access iterators} */ -- cgit v1.2.3 From ac2988477204c4efe5d4b60de89270bade35dde1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C4=99drzej=20Nowacki?= Date: Fri, 24 Jan 2014 09:39:28 +0100 Subject: Remove invalid comment from qabstractanimation_p. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I4087c80061ad2fd9458730e4e3515eb4695c8b14 Reviewed-by: Jan Arve Sæther --- src/corelib/animation/qabstractanimation_p.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/corelib') diff --git a/src/corelib/animation/qabstractanimation_p.h b/src/corelib/animation/qabstractanimation_p.h index 322de22caf..39d9cf0fe6 100644 --- a/src/corelib/animation/qabstractanimation_p.h +++ b/src/corelib/animation/qabstractanimation_p.h @@ -46,8 +46,8 @@ // W A R N I N G // ------------- // -// This file is not part of the Qt API. It exists for the convenience -// of QIODevice. This header file may change from version to +// This file is not part of the Qt API. +// This header file may change from version to // version without notice, or even be removed. // // We mean it. -- cgit v1.2.3 From 81e69ffdbac1e6f2066c2de3e5cfecbb923f2b15 Mon Sep 17 00:00:00 2001 From: Venu Date: Tue, 7 Jan 2014 15:14:27 +0100 Subject: Doc: Added more information about the WriteOnly mode MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Task-number: QTBUG-34336 Change-Id: I4a9995dde400145cb1e33e625715eea8aaed3191 Reviewed-by: Topi Reiniö --- src/corelib/io/qiodevice.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/corelib') diff --git a/src/corelib/io/qiodevice.cpp b/src/corelib/io/qiodevice.cpp index a81b8580c4..53019e1ff4 100644 --- a/src/corelib/io/qiodevice.cpp +++ b/src/corelib/io/qiodevice.cpp @@ -259,9 +259,10 @@ QIODevicePrivate::~QIODevicePrivate() \value NotOpen The device is not open. \value ReadOnly The device is open for reading. - \value WriteOnly The device is open for writing. + \value WriteOnly The device is open for writing. Note that this mode implies + Truncate. \value ReadWrite The device is open for reading and writing. - \value Append The device is opened in append mode, so that all data is + \value Append The device is opened in append mode so that all data is written to the end of the file. \value Truncate If possible, the device is truncated before it is opened. All earlier contents of the device are lost. -- cgit v1.2.3 From a8f1bd6b659d9ece7b5655f739ad6c1b6d834045 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Sat, 18 Jan 2014 13:56:06 -0800 Subject: Fix typo in the function argument of QRect::moveTo: t -> y Task-number: QTBUG-36259 Change-Id: If6f8da7f36d9a2bc171f2f50d36b37af8f13d8d0 Reviewed-by: Robin Burchell Reviewed-by: Konstantin Ritt --- src/corelib/tools/qrect.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/corelib') diff --git a/src/corelib/tools/qrect.h b/src/corelib/tools/qrect.h index 62ebdd10cd..22696f9edf 100644 --- a/src/corelib/tools/qrect.h +++ b/src/corelib/tools/qrect.h @@ -512,7 +512,7 @@ public: Q_DECL_CONSTEXPR inline QRectF translated(qreal dx, qreal dy) const; Q_DECL_CONSTEXPR inline QRectF translated(const QPointF &p) const; - inline void moveTo(qreal x, qreal t); + inline void moveTo(qreal x, qreal y); inline void moveTo(const QPointF &p); inline void setRect(qreal x, qreal y, qreal w, qreal h); -- cgit v1.2.3 From 595e24fe2d59e21d71f1eaa8caadf635a5cfbdfb Mon Sep 17 00:00:00 2001 From: Liang Qi Date: Tue, 28 Jan 2014 09:12:51 +0100 Subject: QFileSelector: correct the macro for android platform Task-number: QTBUG-35073 Change-Id: I50d254ae61dac3cedc11291bd5ed35f9f9447622 Reviewed-by: Jake Petroules Reviewed-by: Alan Alpert --- src/corelib/io/qfileselector.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/corelib') diff --git a/src/corelib/io/qfileselector.cpp b/src/corelib/io/qfileselector.cpp index 92d3564a0f..13e5f8e5d1 100644 --- a/src/corelib/io/qfileselector.cpp +++ b/src/corelib/io/qfileselector.cpp @@ -102,7 +102,7 @@ QFileSelectorPrivate::QFileSelectorPrivate() your code might look something like this: \code QString defaultsPath = "data/defaults.conf"; -#if defined(Q_OS_LINUX_ANDROID) +#if defined(Q_OS_ANDROID) defaultsPath = "data/android/defaults.conf"; #elif defined(Q_OS_BLACKBERRY) defaultsPath = "data/blackberry/defaults.conf"; @@ -368,7 +368,7 @@ QStringList QFileSelectorPrivate::platformSelectors() # endif #elif defined(Q_OS_UNIX) ret << QStringLiteral("unix"); -# if defined(Q_OS_LINUX_ANDROID) +# if defined(Q_OS_ANDROID) ret << QStringLiteral("android"); # elif defined(Q_OS_BLACKBERRY) ret << QStringLiteral("blackberry"); -- cgit v1.2.3 From 1090ee664ba14a16036eb4d539006c4f8c7a545a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= Date: Mon, 13 Jan 2014 09:24:32 +0100 Subject: Remove duplicate move assignment operator doc Keep the "since 5.2". Change-Id: I8cfaf81e0b10f67c084e923f846ce0c722eac7fe Reviewed-by: Geir Vattekar --- src/corelib/tools/qbitarray.cpp | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) (limited to 'src/corelib') diff --git a/src/corelib/tools/qbitarray.cpp b/src/corelib/tools/qbitarray.cpp index f583444d3c..02cc321262 100644 --- a/src/corelib/tools/qbitarray.cpp +++ b/src/corelib/tools/qbitarray.cpp @@ -119,14 +119,6 @@ QT_BEGIN_NAMESPACE \since 5.2 */ -/*! - \fn QBitArray &QBitArray::operator=(QBitArray &&other) - - Move-assigns \a other to this QBitArray instance. - - \since 5.2 -*/ - /*! \fn QBitArray::QBitArray() Constructs an empty bit array. @@ -464,6 +456,7 @@ void QBitArray::fill(bool value, int begin, int end) */ /*! \fn QBitArray &QBitArray::operator=(QBitArray &&other) + \since 5.2 Moves \a other to this bit array and returns a reference to this bit array. -- cgit v1.2.3 From cc8e0d85e26f699ffa1e5eec3db9897a8bd417ff Mon Sep 17 00:00:00 2001 From: David Faure Date: Wed, 29 Jan 2014 09:31:18 +0100 Subject: Doc: argument(s) was renamed to value(s), adjust QCommandLineOption docs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Task-number: QTBUG-36264 Change-Id: I132270f35b93b2b1c5230459f48bf9d047f42ab9 Reviewed-by: Topi Reiniö --- src/corelib/tools/qcommandlineoption.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/corelib') diff --git a/src/corelib/tools/qcommandlineoption.cpp b/src/corelib/tools/qcommandlineoption.cpp index 86f087674b..ccf9211b52 100644 --- a/src/corelib/tools/qcommandlineoption.cpp +++ b/src/corelib/tools/qcommandlineoption.cpp @@ -79,7 +79,7 @@ public: This class is used to describe an option on the command line. It allows different ways of defining the same option with multiple aliases possible. It is also used to describe how the option is used - it may be a flag (e.g. \c{-v}) - or take an argument (e.g. \c{-o file}). + or take a value (e.g. \c{-o file}). Examples: \snippet code/src_corelib_tools_qcommandlineoption.cpp 0 @@ -232,8 +232,8 @@ void QCommandLineOptionPrivate::setNames(const QStringList &nameList) for the documentation of the option in the help output. An option with names \c{o} and \c{output}, and a value name of \c{file} will appear as \c{-o, --output }. - Call QCommandLineParser::argument() if you expect the option to be present - only once, and QCommandLineParser::arguments() if you expect that option + Call QCommandLineParser::value() if you expect the option to be present + only once, and QCommandLineParser::values() if you expect that option to be present multiple times. \sa valueName() -- cgit v1.2.3 From 7e5b3e57e30394c9b2fc463adf15445307b19ed6 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Thu, 30 Jan 2014 09:16:27 -0800 Subject: Add the default argument for the new connection syntax Task-number: QTBUG-36549 Change-Id: I3addacf4b0698df91960f7b8e9c2ed93e935f848 Reviewed-by: Branislav Katreniak Reviewed-by: Olivier Goffart --- src/corelib/kernel/qobject.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/corelib') diff --git a/src/corelib/kernel/qobject.h b/src/corelib/kernel/qobject.h index e2000afc82..c65d54e85a 100644 --- a/src/corelib/kernel/qobject.h +++ b/src/corelib/kernel/qobject.h @@ -206,9 +206,9 @@ public: const char *member, Qt::ConnectionType type = Qt::AutoConnection) const; #ifdef Q_QDOC - static QMetaObject::Connection connect(const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method, Qt::ConnectionType type); + static QMetaObject::Connection connect(const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method, Qt::ConnectionType type = Qt::AutoConnection); static QMetaObject::Connection connect(const QObject *sender, PointerToMemberFunction signal, Functor functor); - static QMetaObject::Connection connect(const QObject *sender, PointerToMemberFunction signal, const QObject *context, Functor functor, Qt::ConnectionType type); + static QMetaObject::Connection connect(const QObject *sender, PointerToMemberFunction signal, const QObject *context, Functor functor, Qt::ConnectionType type = Qt::AutoConnection); #else //Connect a signal to a pointer to qobject member function template -- cgit v1.2.3 From e5fd2417701c1ecf35a3c771c647d931cef3f375 Mon Sep 17 00:00:00 2001 From: Giuseppe D'Angelo Date: Fri, 31 Jan 2014 10:36:04 +0100 Subject: Fix QByteArray documentation w.r.t. QString-related methods There's no loss of data when converting a Unicode string to UTF-8, so don't state that in the docs. Change-Id: If26914ec674a994d9c59136448e8e4292d0412e8 Reviewed-by: Thiago Macieira --- src/corelib/tools/qbytearray.cpp | 30 ++++++++++++------------------ 1 file changed, 12 insertions(+), 18 deletions(-) (limited to 'src/corelib') diff --git a/src/corelib/tools/qbytearray.cpp b/src/corelib/tools/qbytearray.cpp index 03b10903ab..3e3bae9a94 100644 --- a/src/corelib/tools/qbytearray.cpp +++ b/src/corelib/tools/qbytearray.cpp @@ -1303,12 +1303,10 @@ void QByteArray::chop(int n) returns a reference to this byte array. The Unicode data is converted into 8-bit characters using QString::toUtf8(). - If the QString contains non-ASCII Unicode characters, using this - operator can lead to loss of information. You can disable this - operator by defining \c QT_NO_CAST_TO_ASCII when you compile your - applications. You then need to call QString::toUtf8() (or - QString::toLatin1() or QString::toUtf8() or QString::toLocal8Bit()) - explicitly if you want to convert the data to \c{const char *}. + You can disable this function by defining \c QT_NO_CAST_TO_ASCII when you + compile your applications. You then need to call QString::toUtf8() (or + QString::toLatin1() or QString::toLocal8Bit()) explicitly if you want to + convert the data to \c{const char *}. */ /*! \fn QByteArray &QByteArray::operator+=(const char *str) @@ -1667,12 +1665,10 @@ QByteArray &QByteArray::append(const QByteArray &ba) Appends the string \a str to this byte array. The Unicode data is converted into 8-bit characters using QString::toUtf8(). - If the QString contains non-ASCII Unicode characters, using this - function can lead to loss of information. You can disable this - function by defining \c QT_NO_CAST_TO_ASCII when you compile your - applications. You then need to call QString::toUtf8() (or - QString::toLatin1() or QString::toUtf8() or QString::toLocal8Bit()) - explicitly if you want to convert the data to \c{const char *}. + You can disable this function by defining \c QT_NO_CAST_TO_ASCII when you + compile your applications. You then need to call QString::toUtf8() (or + QString::toLatin1() or QString::toLocal8Bit()) explicitly if you want to + convert the data to \c{const char *}. */ /*! @@ -2148,12 +2144,10 @@ QByteArray &QByteArray::replace(char before, const QByteArray &after) string \a after. The Unicode data is converted into 8-bit characters using QString::toUtf8(). - If the QString contains non-ASCII Unicode characters, using this - function can lead to loss of information. You can disable this - function by defining \c QT_NO_CAST_TO_ASCII when you compile your - applications. You then need to call QString::toUtf8() (or - QString::toLatin1() or QString::toUtf8() or QString::toLocal8Bit()) - explicitly if you want to convert the data to \c{const char *}. + You can disable this function by defining \c QT_NO_CAST_TO_ASCII when you + compile your applications. You then need to call QString::toUtf8() (or + QString::toLatin1() or QString::toLocal8Bit()) explicitly if you want to + convert the data to \c{const char *}. */ /*! \fn QByteArray &QByteArray::replace(char before, const char *after) -- cgit v1.2.3 From 61e1bcb4dd4995c9a8385aad6f3da10f53de2265 Mon Sep 17 00:00:00 2001 From: El Mehdi Fekari Date: Thu, 19 Dec 2013 11:15:34 +0100 Subject: QLogging: Avoid infinite loop in error case If the user code installs a message handler that uses any API that prints logs (handled by qt_message_print) then this will lead to an infinite loop. This patch adds a thread local storage to check if the message handler is done before the thread is calling it again. Note: This check is performed only if the compiler supports thread_local (__declspec(thread) for MSVC). Change-Id: I43b0460b8f39b26a18de48a5652a5e55f0b336f8 Reviewed-by: Rafael Roquetto --- src/corelib/global/qlogging.cpp | 43 ++++++++++++++++++++++++++++++++++++----- 1 file changed, 38 insertions(+), 5 deletions(-) (limited to 'src/corelib') diff --git a/src/corelib/global/qlogging.cpp b/src/corelib/global/qlogging.cpp index 5b7a674ddb..cff8846cdc 100644 --- a/src/corelib/global/qlogging.cpp +++ b/src/corelib/global/qlogging.cpp @@ -925,6 +925,32 @@ static void qDefaultMsgHandler(QtMsgType type, const char *buf) qDefaultMessageHandler(type, emptyContext, QString::fromLocal8Bit(buf)); } +#if defined(Q_COMPILER_THREAD_LOCAL) || (defined(Q_CC_MSVC) && !defined(Q_OS_WINCE)) +#if defined(Q_CC_MSVC) +static __declspec(thread) bool msgHandlerGrabbed = false; +#else +static thread_local bool msgHandlerGrabbed = false; +#endif + +static bool grabMessageHandler() +{ + if (msgHandlerGrabbed) + return false; + + msgHandlerGrabbed = true; + return true; +} + +static void ungrabMessageHandler() +{ + msgHandlerGrabbed = false; +} + +#else +static bool grabMessageHandler() { return true; } +static void ungrabMessageHandler() { } +#endif // (Q_COMPILER_THREAD_LOCAL) || ((Q_CC_MSVC) && !(Q_OS_WINCE)) + static void qt_message_print(QtMsgType msgType, const QMessageLogContext &context, const QString &message) { #ifndef QT_BOOTSTRAPPED @@ -942,12 +968,19 @@ static void qt_message_print(QtMsgType msgType, const QMessageLogContext &contex if (!messageHandler) messageHandler = qDefaultMessageHandler; - // prefer new message handler over the old one - if (msgHandler == qDefaultMsgHandler - || messageHandler != qDefaultMessageHandler) { - (*messageHandler)(msgType, context, message); + // prevent recursion in case the message handler generates messages + // itself, e.g. by using Qt API + if (grabMessageHandler()) { + // prefer new message handler over the old one + if (msgHandler == qDefaultMsgHandler + || messageHandler != qDefaultMessageHandler) { + (*messageHandler)(msgType, context, message); + } else { + (*msgHandler)(msgType, message.toLocal8Bit().constData()); + } + ungrabMessageHandler(); } else { - (*msgHandler)(msgType, message.toLocal8Bit().constData()); + fprintf(stderr, "%s", message.toLocal8Bit().constData()); } } -- cgit v1.2.3 From 6894bc0f3f8a579529dc0a7ab869ce565abd06ad Mon Sep 17 00:00:00 2001 From: Nils Jeisecke Date: Fri, 6 Dec 2013 19:00:59 +0100 Subject: Fix sorted QSortFilterProxyModel filter update When changing a filter so that a previously empty proxy model becomes populated sorting was not applied correctly. This was caused by using mapToSource for getting source_sort_column from proxy_sort_column. For an empty proxy model this won't work because no valid proxy index can be created in this case. We now directly use the root index column mapping instead by doing essentially the same as QSortFilterProxyModelPrivate::proxy_to_source but without the sanity checks needed for external use. The sorting feature of QSortFilterProxyModel has always assumed that the number of columns is specified by columnCount(QModelIndex()) so the behavior doesn't change. [ChangeLog][QtCore][QSortFilterProxyModel] Fixed sorting when a previously empty proxy model becomes populated because of a change in the filter. Task-number: QTBUG-30662 Change-Id: I21322122e127889dfadc02f838f0119ed322dcab Reviewed-by: Stephen Kelly --- src/corelib/itemmodels/qsortfilterproxymodel.cpp | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'src/corelib') diff --git a/src/corelib/itemmodels/qsortfilterproxymodel.cpp b/src/corelib/itemmodels/qsortfilterproxymodel.cpp index 63e0374740..930c2871d3 100644 --- a/src/corelib/itemmodels/qsortfilterproxymodel.cpp +++ b/src/corelib/itemmodels/qsortfilterproxymodel.cpp @@ -458,10 +458,21 @@ void QSortFilterProxyModelPrivate::sort() */ bool QSortFilterProxyModelPrivate::update_source_sort_column() { - Q_Q(QSortFilterProxyModel); - QModelIndex proxy_index = q->index(0, proxy_sort_column, QModelIndex()); int old_source_sort_column = source_sort_column; - source_sort_column = q->mapToSource(proxy_index).column(); + + if (proxy_sort_column == -1) { + source_sort_column = -1; + } else { + // We cannot use index mapping here because in case of a still-empty + // proxy model there's no valid proxy index we could map to source. + // So always use the root mapping directly instead. + Mapping *m = create_mapping(QModelIndex()).value(); + if (proxy_sort_column < m->source_columns.size()) + source_sort_column = m->source_columns.at(proxy_sort_column); + else + source_sort_column = -1; + } + return old_source_sort_column != source_sort_column; } -- cgit v1.2.3 From 8bb5dba0cba4d953794124d7f1b33887d1b5bd8d Mon Sep 17 00:00:00 2001 From: Sze Howe Koh Date: Sat, 1 Feb 2014 23:30:08 +0800 Subject: Doc: Fix broken links Change-Id: Ic275dfbf0b332fc34ea0fac1c31c4935ad961527 Reviewed-by: Frederik Gladhorn --- src/corelib/doc/qtcore.qdocconf | 2 +- src/corelib/global/qglobal.cpp | 8 ++++---- src/corelib/io/qloggingcategory.cpp | 2 +- src/corelib/kernel/qvariant.cpp | 6 +++--- src/corelib/tools/qstring.cpp | 2 +- 5 files changed, 10 insertions(+), 10 deletions(-) (limited to 'src/corelib') diff --git a/src/corelib/doc/qtcore.qdocconf b/src/corelib/doc/qtcore.qdocconf index fa5afb033c..18fdfb18f3 100644 --- a/src/corelib/doc/qtcore.qdocconf +++ b/src/corelib/doc/qtcore.qdocconf @@ -26,7 +26,7 @@ qhp.QtCore.subprojects.classes.sortPages = true tagfile = ../../../doc/qtcore/qtcore.tags -depends += qtgui qtwidgets qtnetwork qtdoc qtquick qtlinguist qtdesigner qtconcurrent qtxml qmake +depends += qtgui qtwidgets qtnetwork qtdoc qtmacextras qtquick qtlinguist qtdesigner qtconcurrent qtxml qmake headerdirs += .. diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp index 6644d6d101..a9f6df6291 100644 --- a/src/corelib/global/qglobal.cpp +++ b/src/corelib/global/qglobal.cpp @@ -1960,7 +1960,7 @@ const QSysInfo::WinVersion QSysInfo::WindowsVersion = QSysInfo::windowsVersion() conditions that it would not otherwise know about. However, there is no guarantee that the compiler will actually use those hints. - This macro could be considered a "lighter" version of \l{Q_ASSERT}. While + This macro could be considered a "lighter" version of \l{Q_ASSERT()}. While Q_ASSERT will abort the program's execution if the condition is false, Q_ASSUME will tell the compiler not to generate code for those conditions. Therefore, it is important that the assumptions always hold, otherwise @@ -3318,7 +3318,7 @@ bool QInternal::activateCallbacks(Callback cb, void **parameters) If you need C++11 noexcept semantics, don't use this macro, use Q_DECL_NOEXCEPT/Q_DECL_NOEXCEPT_EXPR instead. - \sa Q_DECL_NOEXCEPT, Q_DECL_NOEXCEPT_EXPR + \sa Q_DECL_NOEXCEPT, Q_DECL_NOEXCEPT_EXPR() */ /*! @@ -3372,7 +3372,7 @@ bool QInternal::activateCallbacks(Callback cb, void **parameters) function can't possibly throw, don't use this macro, use Q_DECL_NOTHROW instead. - \sa Q_DECL_NOTHROW, Q_DECL_NOEXCEPT_EXPR + \sa Q_DECL_NOTHROW, Q_DECL_NOEXCEPT_EXPR() */ /*! @@ -3394,7 +3394,7 @@ bool QInternal::activateCallbacks(Callback cb, void **parameters) function can't possibly throw, don't use this macro, use Q_DECL_NOTHROW instead. - \sa Q_DECL_NOTHROW, Q_DECL_NOEXCEPT_EXPR + \sa Q_DECL_NOTHROW, Q_DECL_NOEXCEPT */ /*! diff --git a/src/corelib/io/qloggingcategory.cpp b/src/corelib/io/qloggingcategory.cpp index 93a98b1835..4924ac89c6 100644 --- a/src/corelib/io/qloggingcategory.cpp +++ b/src/corelib/io/qloggingcategory.cpp @@ -72,7 +72,7 @@ Q_GLOBAL_STATIC_WITH_ARGS(QLoggingCategory, qtDefaultCategory, \section1 Checking category configuration QLoggingCategory provides \l isDebugEnabled(), \l isWarningEnabled(), - \l isCriticalEnabled(), \l isTraceEnabled(), as well as \l isEnabled() + \l isCriticalEnabled(), as well as \l isEnabled() to check whether messages for the given message type should be logged. \note The qCDebug(), qCWarning(), qCCritical() macros prevent arguments diff --git a/src/corelib/kernel/qvariant.cpp b/src/corelib/kernel/qvariant.cpp index 69cfa7888f..a1b7f398e8 100644 --- a/src/corelib/kernel/qvariant.cpp +++ b/src/corelib/kernel/qvariant.cpp @@ -2833,8 +2833,8 @@ static bool canConvertMetaObject(int fromId, int toId, QObject *fromObject) \snippet code/src_corelib_kernel_qvariant.cpp 10 - \sa convert(), QSequentialIterable, qRegisterSequentialConverter(), QAssociativeIterable, - qRegisterAssociativeConverter() + \sa convert(), QSequentialIterable, Q_DECLARE_SEQUENTIAL_CONTAINER_METATYPE(), QAssociativeIterable, + Q_DECLARE_ASSOCIATIVE_CONTAINER_METATYPE() */ bool QVariant::canConvert(int targetTypeId) const { @@ -3334,7 +3334,7 @@ QDebug operator<<(QDebug dbg, const QVariant::Type p) \snippet code/src_corelib_kernel_qvariant.cpp 9 - \sa setValue(), fromValue(), canConvert(), qRegisterSequentialConverter() + \sa setValue(), fromValue(), canConvert(), Q_DECLARE_SEQUENTIAL_CONTAINER_METATYPE() */ /*! \fn bool QVariant::canConvert() const diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp index d682207314..2c505ef033 100644 --- a/src/corelib/tools/qstring.cpp +++ b/src/corelib/tools/qstring.cpp @@ -7691,7 +7691,7 @@ QString &QString::setRawData(const QChar *unicode, int size) \snippet code/src_corelib_tools_qstring.cpp 6 - \sa QString, QLatin1Char, QStringLiteral + \sa QString, QLatin1Char, {QStringLiteral()}{QStringLiteral} */ /*! \fn QLatin1String::QLatin1String(const char *str) -- cgit v1.2.3 From fdef360bad0f2f1059ff81f1bdd608332541abac Mon Sep 17 00:00:00 2001 From: Jake Petroules Date: Tue, 28 Jan 2014 07:29:53 -0500 Subject: QFileSelector: correct the macros for Apple platforms. This fixes a serious regression from 7d72516b52b20b0782d972224a55a43e74b8ae5a. [ChangeLog] QFileSelector: the identifier for OS X has been changed back to 'osx' from 'mac', and 'mac' and 'darwin' have now been added as selectors for Darwin OS (which is the base of both OS X and iOS). Task-number: QTBUG-35073 Change-Id: I83183e34c5a697338cc1ddcac33a41bd379ded12 Reviewed-by: Alan Alpert --- src/corelib/io/qfileselector.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'src/corelib') diff --git a/src/corelib/io/qfileselector.cpp b/src/corelib/io/qfileselector.cpp index 13e5f8e5d1..b4021c060f 100644 --- a/src/corelib/io/qfileselector.cpp +++ b/src/corelib/io/qfileselector.cpp @@ -157,7 +157,7 @@ QFileSelectorPrivate::QFileSelectorPrivate() Selectors normally available are \list \li platform, any of the following strings which match the platform the application is running - on: android, blackberry, ios, mac, linux, wince, unix, windows. + on: android, blackberry, ios, osx, darwin, mac, linux, wince, unix, windows. \li locale, same as QLocale::system().name(). \endlist @@ -374,12 +374,16 @@ QStringList QFileSelectorPrivate::platformSelectors() ret << QStringLiteral("blackberry"); # elif defined(Q_OS_QNX) ret << QStringLiteral("qnx"); -# elif defined(Q_OS_IOS) - ret << QStringLiteral("ios"); # elif defined(Q_OS_LINUX) ret << QStringLiteral("linux"); -# elif defined(Q_OS_MAC) - ret << QStringLiteral("mac"); +# elif defined(Q_OS_DARWIN) + ret << QStringLiteral("darwin"); + ret << QStringLiteral("mac"); // compatibility synonym +# if defined(Q_OS_IOS) + ret << QStringLiteral("ios"); +# elif defined(Q_OS_OSX) + ret << QStringLiteral("osx"); +# endif # else struct utsname u; if (uname(&u) != -1) -- cgit v1.2.3