From c7d4858c921c7602dc90d56cdd903cd2cb1111c6 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Sat, 14 May 2016 07:32:03 +0200 Subject: QDBusArgument: deprecate relying on a streamable Base to stream a Derived This was seen in the wild for QList, but, as described in the documentation note, it's a common problem. [ChangeLog][QtDBus][QDBusArgument] Deprecated relying on a streamable Base to stream a Derived without providing operator<>() for Derived. No diagnostic provided. Task-number: QTBUG-53376 Change-Id: If845574f731b537c20641dc7c49fa4369e85db5a Reviewed-by: Thiago Macieira --- src/dbus/qdbusmetatype.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/dbus/qdbusmetatype.cpp b/src/dbus/qdbusmetatype.cpp index 5696290ed3..59a71ade3e 100644 --- a/src/dbus/qdbusmetatype.cpp +++ b/src/dbus/qdbusmetatype.cpp @@ -177,7 +177,7 @@ Q_GLOBAL_STATIC(QReadWriteLock, customTypesLock) \snippet code/src_qdbus_qdbusmetatype.cpp 0 - If \c{T} isn't a type derived from one of + If \c{T} isn't one of Qt's \l{container classes}, the \c{operator<<} and \c{operator>>} streaming operators between \c{T} and QDBusArgument must be already declared. See the \l {qdbustypesystem.html}{Qt D-Bus @@ -187,6 +187,14 @@ Q_GLOBAL_STATIC(QReadWriteLock, customTypesLock) This function returns the Qt meta type id for the type (the same value that is returned from qRegisterMetaType()). + \note The feature that a \c{T} inheriting a streamable type (including + the containers QList, QHash or QMap) can be streamed without providing + custom \c{operator<<} and \c{operator>>} is deprecated as of Qt 5.7, + because it ignores everything in \c{T} except the base class. There is + no diagnostic. You should always provide these operators for all types + you wish to stream and not rely on Qt-provided stream operators for + base classes. + \sa {qdbustypesystem.html}{Qt D-Bus Type System}, qRegisterMetaType(), QMetaType */ -- cgit v1.2.3 From d55f2b1fb9c910bc118f75967a0e6273f8aa98d1 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Sat, 14 May 2016 07:09:33 +0200 Subject: Revert "QDBusArgument: remove useless op<< overloads" This reverts commit 5f542f3cca13f2da58b82aee2efbaffefeee00a7, since it breaks streaming of types derived from QList and the docs state that this should be possible without providing custom op<> for such types. Task-number: QTBUG-53376 Change-Id: I2bde714ac384f2aed67ad30decea702fb79aef1b Reviewed-by: Alex Blasche Reviewed-by: Thiago Macieira --- src/dbus/qdbusargument.h | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/src/dbus/qdbusargument.h b/src/dbus/qdbusargument.h index b4e46eb1c6..85469fbc3d 100644 --- a/src/dbus/qdbusargument.h +++ b/src/dbus/qdbusargument.h @@ -261,6 +261,35 @@ inline const QDBusArgument &operator>>(const QDBusArgument &arg, Container &l return arg; } +// QList specializations +template +inline QDBusArgument &operator<<(QDBusArgument &arg, const QList &list) +{ + int id = qMetaTypeId(); + arg.beginArray(id); + typename QList::ConstIterator it = list.constBegin(); + typename QList::ConstIterator end = list.constEnd(); + for ( ; it != end; ++it) + arg << *it; + arg.endArray(); + return arg; +} + +template +inline const QDBusArgument &operator>>(const QDBusArgument &arg, QList &list) +{ + arg.beginArray(); + list.clear(); + while (!arg.atEnd()) { + T item; + arg >> item; + list.push_back(item); + } + arg.endArray(); + + return arg; +} + inline QDBusArgument &operator<<(QDBusArgument &arg, const QVariantList &list) { int id = qMetaTypeId(); @@ -273,6 +302,7 @@ inline QDBusArgument &operator<<(QDBusArgument &arg, const QVariantList &list) return arg; } +// QMap specializations template inline QDBusArgument &operator<<(QDBusArgument &arg, const QMap &map) { @@ -321,6 +351,7 @@ inline QDBusArgument &operator<<(QDBusArgument &arg, const QVariantMap &map) return arg; } +// QHash specializations template inline QDBusArgument &operator<<(QDBusArgument &arg, const QHash &map) { -- cgit v1.2.3 From 48d14c661df502c78757d6e90ba565c6d970816b Mon Sep 17 00:00:00 2001 From: BogDan Vatra Date: Mon, 23 May 2016 18:00:52 +0300 Subject: Move services documenation to a wiki page. Qt XML parser doesn't like these comments and it breakes QtCreator's manifest editor Task-number: QTCREATORBUG-16139 Change-Id: I6459926b32c39eb6d1ee8a9b5a5ade9b6f72924a Reviewed-by: Christian Stromme --- src/android/templates/AndroidManifest.xml | 44 +------------------------------ 1 file changed, 1 insertion(+), 43 deletions(-) diff --git a/src/android/templates/AndroidManifest.xml b/src/android/templates/AndroidManifest.xml index 808cc82ae9..066ec0a63c 100644 --- a/src/android/templates/AndroidManifest.xml +++ b/src/android/templates/AndroidManifest.xml @@ -63,50 +63,8 @@ - - + - - - - - - - - - - - - - - - - - - - - - - - - - - -- cgit v1.2.3 From 65ae3de2e12ab0d9b28699b419e3d3aa8af3a267 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Tue, 24 May 2016 15:47:19 +0200 Subject: Fix tst_QListView::setCurrentIndexAfterAppendRowCrash(). The test was half-ported from Qt 4 and #ifdefed out depending on WINVER. When it became active, it failed since it queries the window handle too early in the process. Move the code sending the message into showEvent() to ensure a window handle exists and parent the listview properly to prevent a leaking toplevel. Change-Id: I74aa9ddfd0e88dd31e9258400fc3e473b6e0d92e Reviewed-by: Kai Koehne --- .../widgets/itemviews/qlistview/tst_qlistview.cpp | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp b/tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp index 651172e79f..98cc9b29ed 100644 --- a/tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp +++ b/tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp @@ -44,6 +44,7 @@ #include #include #include +#include #if defined(Q_OS_WIN) || defined(Q_OS_WINCE) # include @@ -111,7 +112,7 @@ private slots: void scrollBarAsNeeded(); void moveItems(); void wordWrap(); -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && WINVER >= 0x0500 +#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) void setCurrentIndexAfterAppendRowCrash(); #endif void emptyItemSize(); @@ -1456,8 +1457,10 @@ class SetCurrentIndexAfterAppendRowCrashDialog : public QDialog public: SetCurrentIndexAfterAppendRowCrashDialog() { -#if WINVER >= 0x0500 - listView = new QListView(); + setWindowTitle(QTest::currentTestFunction()); + listView = new QListView(this); + QVBoxLayout *layout = new QVBoxLayout(this); + layout->addWidget(listView); listView->setViewMode(QListView::IconMode); model = new QStandardItemModel(this); @@ -1466,12 +1469,16 @@ public: timer = new QTimer(this); connect(timer, SIGNAL(timeout()), this, SLOT(buttonClicked())); timer->start(1000); + } +protected: + void showEvent(QShowEvent *event) override + { + QDialog::showEvent(event); DWORD lParam = 0xFFFFFFFC/*OBJID_CLIENT*/; DWORD wParam = 0; if (const HWND hwnd =getHWNDForWidget(this)) SendMessage(hwnd, WM_GETOBJECT, wParam, lParam); -#endif } private slots: @@ -1488,16 +1495,13 @@ private: QStandardItemModel *model; QTimer *timer; }; -#endif -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) && WINVER >= 0x0500 -// This test only makes sense on windows 2000 and higher. void tst_QListView::setCurrentIndexAfterAppendRowCrash() { SetCurrentIndexAfterAppendRowCrashDialog w; w.exec(); } -#endif +#endif // Q_OS_WIN && !Q_OS_WINCE && !Q_OS_WINRT void tst_QListView::emptyItemSize() { -- cgit v1.2.3 From efd2ea8ea720833f9602154221d9654aea1f2e6f Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Mon, 2 May 2016 17:09:11 +0200 Subject: Determine the compiler's default include and lib directories at qmake time This fixes a long-standing issue for Qt packages, where the paths detected at configure time do not necessarily match the paths on the user's machine. Hence they have been stripped manually from qconfig.pri so far, preventing moc from resolving some includes. The same logic in configure is left alone for the time being, since the paths there are also used to filter paths returned by pg_config and mysql_config. I expect that this will eventually be removed too in a bigger refactoring going on right now in dev. Asking the compiler for implicit paths only works for non-msvc builds - that is, gcc, clang and icc fortunately have a compatible way to retrieve the paths. MSVC works solely on environment variables, which will be taken into account by a separate patch. [ChangeLog][qmake] The implicit compiler directories that moc needs for resolving include files are now determined when qmake runs. So far QMAKE_DEFAULT_INCDIR was determined at configure time, which might be wrong for relocated installations. Task-number: QTBUG-52687 Change-Id: If0706e8c56a5aca2b6e777e79e90342c498726f3 Reviewed-by: Lars Knoll Reviewed-by: Oswald Buddenhagen --- configure | 9 --------- mkspecs/features/default_pre.prf | 41 ++++++++++++++++++++++++++++++++++++++++ tools/configure/configureapp.cpp | 5 ----- 3 files changed, 41 insertions(+), 14 deletions(-) diff --git a/configure b/configure index 3e455c6163..43b55f07a3 100755 --- a/configure +++ b/configure @@ -115,13 +115,6 @@ shellEscape() echo "$@" | sed 's/ /\ /g' } -shellQuoteLines() -{ - # The call of the outer echo makes the shell word-split the output of - # the nested pipe, thus effectively converting newlines to spaces. - echo `echo "$1" | sed 's,^[^ ]* .*$,"&",'` -} - makeabs() { local FILE="$1" @@ -7163,8 +7156,6 @@ host_build { QT_TARGET_ARCH = $CFG_ARCH } else { QT_ARCH = $CFG_ARCH - QMAKE_DEFAULT_LIBDIRS = `shellQuoteLines "$DEFAULT_LIBDIRS"` - QMAKE_DEFAULT_INCDIRS = `shellQuoteLines "$DEFAULT_INCDIRS"` } QT_CONFIG += $QT_CONFIG diff --git a/mkspecs/features/default_pre.prf b/mkspecs/features/default_pre.prf index a247b46a72..cffffdcf25 100644 --- a/mkspecs/features/default_pre.prf +++ b/mkspecs/features/default_pre.prf @@ -24,3 +24,44 @@ contains(QT_CONFIG, c++11):lessThan(QT_COMPILER_STDCXX, 201103): CONFIG += c++11 } unset(today) } + +isEmpty(QMAKE_DEFAULT_INCDIRS):!host_build { + # + # Get default include and library paths from compiler + # + gcc { + equals(QMAKE_DIR_SEP, /) { + cmd_prefix = "LC_ALL=C" + cmd_suffix = "/dev/null" + } else { + cmd_prefix = "set LC_ALL=C&" + cmd_suffix = "NUL" + } + output = $$system("$$cmd_prefix $$QMAKE_CXX $$QMAKE_CXXFLAGS -xc++ -E -v - 2>&1 $$cmd_suffix", lines) + add_includes = false + for (line, output) { + line ~= s/^ *// # remove leading spaces + contains(line, "LIBRARY_PATH=.*") { + line ~= s/^LIBRARY_PATH=// # remove leading LIBRARY_PATH= + paths = $$split(line, $$QMAKE_DIRLIST_SEP) + for (path, paths): \ + QMAKE_DEFAULT_LIBDIRS += $$clean_path($$path) + } else: contains(line, "$${LITERAL_HASH}include <.*") { # #include <...> search starts here: + add_includes = true + } else: contains(line, "End of search list.*") { + add_includes = false + } else { + $$add_includes: QMAKE_DEFAULT_INCDIRS += $$clean_path($$line) + } + } + QMAKE_DEFAULT_LIBDIRS = $$unique(QMAKE_DEFAULT_LIBDIRS) + } + + unix { + isEmpty(QMAKE_DEFAULT_INCDIRS): QMAKE_DEFAULT_INCDIRS = /usr/include /usr/local/include + isEmpty(QMAKE_DEFAULT_LIBDIRS): QMAKE_DEFAULT_LIBDIRS = /lib /usr/lib + } + + !isEmpty(QMAKE_DEFAULT_INCDIRS): cache(QMAKE_DEFAULT_INCDIRS, set stash) + !isEmpty(QMAKE_DEFAULT_LIBDIRS): cache(QMAKE_DEFAULT_LIBDIRS, set stash) +} diff --git a/tools/configure/configureapp.cpp b/tools/configure/configureapp.cpp index e3eb5220be..d490f73496 100644 --- a/tools/configure/configureapp.cpp +++ b/tools/configure/configureapp.cpp @@ -3496,11 +3496,6 @@ void Configure::generateQConfigPri() configStream << " QT_TARGET_ARCH = " << dictionary["QT_ARCH"] << endl; configStream << "} else {" << endl; configStream << " QT_ARCH = " << dictionary["QT_ARCH"] << endl; - if (dictionary.contains("XQMAKESPEC")) { - // FIXME: add detection - configStream << " QMAKE_DEFAULT_LIBDIRS = /lib /usr/lib" << endl; - configStream << " QMAKE_DEFAULT_INCDIRS = /usr/include /usr/local/include" << endl; - } configStream << "}" << endl; configStream << "QT_CONFIG += " << qtConfig.join(' ') << endl; -- cgit v1.2.3 From b084739b89fbd32047d454075daf147073926f18 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Sat, 14 May 2016 11:17:48 -0700 Subject: Revert "QMutexPool: avoid QVarLengthArray of QAtomicPointers" This reverts commit 4579d966af2e5d4ba229f13312eeb2f921406038. This causes a miscompilation with ICC 16 on Windows (MSVC 2015 ABI): the vector created by new[] with () in: mutexes(new QAtomicPointer[size]()), // (): zero-initialize does not actually zero-initialize (see disassembly in the bug report). This is definitely a compiler bug. Since we plan on removing QMutexPool in Qt 5.8 anyway, let's just revert the patch. Task-number: QTBUG-53360 Change-Id: I06bae9392f534e45b3f1ffff144e823b747e7962 Reviewed-by: Kai Koehne --- src/corelib/thread/qmutexpool.cpp | 11 ++++++----- src/corelib/thread/qmutexpool_p.h | 5 ++--- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/corelib/thread/qmutexpool.cpp b/src/corelib/thread/qmutexpool.cpp index 522fd5eac2..90b6989467 100644 --- a/src/corelib/thread/qmutexpool.cpp +++ b/src/corelib/thread/qmutexpool.cpp @@ -92,10 +92,11 @@ Q_GLOBAL_STATIC_WITH_ARGS(QMutexPool, globalMutexPool, (QMutex::Recursive)) QMutexPool is destructed. */ QMutexPool::QMutexPool(QMutex::RecursionMode recursionMode, int size) - : count(size), - mutexes(new QAtomicPointer[size]()), // (): zero-initialize - recursionMode(recursionMode) + : mutexes(size), recursionMode(recursionMode) { + for (int index = 0; index < mutexes.count(); ++index) { + mutexes[index].store(0); + } } /*! @@ -104,8 +105,8 @@ QMutexPool::QMutexPool(QMutex::RecursionMode recursionMode, int size) */ QMutexPool::~QMutexPool() { - qDeleteAll(mutexes, mutexes + count); - delete[] mutexes; + for (int index = 0; index < mutexes.count(); ++index) + delete mutexes[index].load(); } /*! diff --git a/src/corelib/thread/qmutexpool_p.h b/src/corelib/thread/qmutexpool_p.h index 33e9a52cb7..796e65d960 100644 --- a/src/corelib/thread/qmutexpool_p.h +++ b/src/corelib/thread/qmutexpool_p.h @@ -66,7 +66,7 @@ public: ~QMutexPool(); inline QMutex *get(const void *address) { - int index = uint(quintptr(address)) % count; + int index = uint(quintptr(address)) % mutexes.count(); QMutex *m = mutexes[index].load(); if (m) return m; @@ -78,8 +78,7 @@ public: private: QMutex *createMutex(int index); - int count; - QAtomicPointer *mutexes; + QVarLengthArray, 131> mutexes; QMutex::RecursionMode recursionMode; }; -- cgit v1.2.3 From ad09530e3409c313df09c8c17af2c4bea4359ca1 Mon Sep 17 00:00:00 2001 From: BogDan Vatra Date: Wed, 25 May 2016 08:13:18 +0300 Subject: Update Ministro's repo Change-Id: I090e1c856f7a93a2a7d8c715c779fc07ce351361 Reviewed-by: Christian Stromme --- src/android/templates/res/values/libs.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/android/templates/res/values/libs.xml b/src/android/templates/res/values/libs.xml index ee3f5e940e..43296f2e7a 100644 --- a/src/android/templates/res/values/libs.xml +++ b/src/android/templates/res/values/libs.xml @@ -1,7 +1,7 @@ - https://download.qt.io/ministro/android/qt5/qt-5.6 + https://download.qt.io/ministro/android/qt5/qt-5.7