From 8828993c4405a8aa98f11318151a74b352eb5521 Mon Sep 17 00:00:00 2001 From: Topi Reinio Date: Thu, 1 Nov 2018 12:46:24 +0100 Subject: Doc: Qt GUI: Fix documentation warnings These are minor typos or documentation warnings that snuck in with new features. Task-number: QTBUG-71502 Change-Id: I03669cfecc3c3d80168ff7b1ca8bca7571e06d25 Reviewed-by: Martin Smith --- src/gui/itemmodels/qstandarditemmodel.cpp | 3 +++ src/gui/kernel/qplatformgraphicsbufferhelper.cpp | 6 ++++++ src/gui/opengl/qopenglfunctions.cpp | 1 + src/gui/painting/qcolor.cpp | 2 +- src/gui/text/qfont.cpp | 2 +- src/gui/text/qtextdocument.cpp | 2 +- src/gui/text/qtextformat.cpp | 3 ++- 7 files changed, 15 insertions(+), 4 deletions(-) diff --git a/src/gui/itemmodels/qstandarditemmodel.cpp b/src/gui/itemmodels/qstandarditemmodel.cpp index 8ec88ebc60..430ba152a9 100644 --- a/src/gui/itemmodels/qstandarditemmodel.cpp +++ b/src/gui/itemmodels/qstandarditemmodel.cpp @@ -3013,6 +3013,9 @@ bool QStandardItemModel::setData(const QModelIndex &index, const QVariant &value /*! \since 5.12 Removes the data stored in all the roles for the given \a index. + Returns \c true if \a index is valid and data was cleared, \c false + otherwise. + \sa setData(), data() */ bool QStandardItemModel::clearItemData(const QModelIndex &index) diff --git a/src/gui/kernel/qplatformgraphicsbufferhelper.cpp b/src/gui/kernel/qplatformgraphicsbufferhelper.cpp index 924266997d..c98aead5c2 100644 --- a/src/gui/kernel/qplatformgraphicsbufferhelper.cpp +++ b/src/gui/kernel/qplatformgraphicsbufferhelper.cpp @@ -56,6 +56,12 @@ QT_BEGIN_NAMESPACE +/*! + \namespace QPlatformGraphicsBufferHelper + \inmodule QtGui + \internal +*/ + /*! Convenience function to both lock and bind the \a graphicsBuffer to a texture. This function will first try to lock with texture read and texture write diff --git a/src/gui/opengl/qopenglfunctions.cpp b/src/gui/opengl/qopenglfunctions.cpp index b4ff21f3fd..92770cb55f 100644 --- a/src/gui/opengl/qopenglfunctions.cpp +++ b/src/gui/opengl/qopenglfunctions.cpp @@ -142,6 +142,7 @@ void CLASS::init(QOpenGLContext *context) \ \value BlendColor glBlendColor() is available. \value BlendEquation glBlendEquation() is available. \value BlendEquationSeparate glBlendEquationSeparate() is available. + \value BlendEquationAdvanced Advanced blend equations are available. \value BlendFuncSeparate glBlendFuncSeparate() is available. \value BlendSubtract Blend subtract mode is available. \value CompressedTextures Compressed texture functions are available. diff --git a/src/gui/painting/qcolor.cpp b/src/gui/painting/qcolor.cpp index 1d7375d1df..ed6a44079d 100644 --- a/src/gui/painting/qcolor.cpp +++ b/src/gui/painting/qcolor.cpp @@ -1366,7 +1366,7 @@ QRgba64 QColor::rgba64() const Q_DECL_NOTHROW Sets the RGB64 value to \a rgba, including its alpha. - \sa \setRgba(), rgba64() + \sa setRgba(), rgba64() */ void QColor::setRgba64(QRgba64 rgba) Q_DECL_NOTHROW { diff --git a/src/gui/text/qfont.cpp b/src/gui/text/qfont.cpp index 580a09427c..69255fd59d 100644 --- a/src/gui/text/qfont.cpp +++ b/src/gui/text/qfont.cpp @@ -1254,7 +1254,7 @@ QFont::StyleStrategy QFont::styleStrategy() const /*! Returns the StyleHint. - The style hint affects the \l{#fontmatching}{font matching algorithm}. + The style hint affects the \l{QFont#fontmatching}{font matching algorithm}. See \l QFont::StyleHint for the list of available hints. \sa setStyleHint(), QFont::StyleStrategy, QFontInfo::styleHint() diff --git a/src/gui/text/qtextdocument.cpp b/src/gui/text/qtextdocument.cpp index 5d88530e65..f823b90785 100644 --- a/src/gui/text/qtextdocument.cpp +++ b/src/gui/text/qtextdocument.cpp @@ -153,7 +153,7 @@ bool Qt::mightBeRichText(const QString& text) This function is defined in the \c header file. - \sa escape(), mightBeRichText() + \sa QString::toHtmlEscaped(), mightBeRichText() */ QString Qt::convertFromPlainText(const QString &plain, Qt::WhiteSpaceMode mode) { diff --git a/src/gui/text/qtextformat.cpp b/src/gui/text/qtextformat.cpp index 4957da1908..919cdf3ff1 100644 --- a/src/gui/text/qtextformat.cpp +++ b/src/gui/text/qtextformat.cpp @@ -645,6 +645,7 @@ Q_GUI_EXPORT QDataStream &operator>>(QDataStream &stream, QTextFormat &fmt) \value ImageName \value ImageWidth \value ImageHeight + \value ImageQuality Selection properties @@ -2251,7 +2252,7 @@ QList QTextBlockFormat::tabPositions() const \fn void QTextBlockFormat::setHeadingLevel(int level) \since 5.12 - Sets the paragraph's heading level, where 1 is the highest-level heading + Sets the paragraph's heading \a level, where 1 is the highest-level heading type (usually with the largest possible heading font size), and increasing values are progressively deeper into the document (and usually with smaller font sizes). For example when reading an HTML H1 tag, the heading level is -- cgit v1.2.3 From ec1548ae122af2febfc61c0242025ee52c8cbc30 Mon Sep 17 00:00:00 2001 From: Topi Reinio Date: Wed, 31 Oct 2018 13:49:14 +0100 Subject: Doc: Fix various documentation warnings These include typos, marking functions as \internal, documenting trivial things, and fixing the function signatures passed to the \fn command. Task-number: QTBUG-71502 Change-Id: I24a9e1f7e1cdb39e5c31b99202bdd593c6b789ff Reviewed-by: Martin Smith Reviewed-by: Paul Wicking Reviewed-by: Edward Welbourne --- src/corelib/global/qglobal.cpp | 2 +- src/corelib/global/qglobalstatic.qdoc | 10 ++++++---- src/corelib/io/qdir.cpp | 11 ++++++----- src/corelib/io/qprocess.cpp | 8 ++++---- src/corelib/kernel/qdeadlinetimer.cpp | 5 +++++ src/corelib/kernel/qeventdispatcher_cf.mm | 2 +- src/corelib/kernel/qtimer.cpp | 18 +++++++++--------- src/corelib/tools/qbytearray.cpp | 4 ++-- src/corelib/tools/qmap.cpp | 2 +- src/corelib/tools/qregularexpression.cpp | 4 ++-- src/corelib/tools/qshareddata.cpp | 7 +++++++ src/corelib/tools/qstring.cpp | 2 +- src/corelib/tools/qtimezone.cpp | 2 +- 13 files changed, 46 insertions(+), 31 deletions(-) diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp index 5c1665fa00..88d4877be5 100644 --- a/src/corelib/global/qglobal.cpp +++ b/src/corelib/global/qglobal.cpp @@ -3796,7 +3796,7 @@ bool qunsetenv(const char *varName) dependent delayed translation in the given \a context with the given \a comment. The \a context is typically a class and also needs to be specified - as a string literal. The string literal \a disambiguation should be + as a string literal. The string literal \a comment should be a short semantic tag to tell apart otherwise identical strings. The macro tells lupdate to collect the string, and expands to an diff --git a/src/corelib/global/qglobalstatic.qdoc b/src/corelib/global/qglobalstatic.qdoc index dbea04ecab..e7935d5a9b 100644 --- a/src/corelib/global/qglobalstatic.qdoc +++ b/src/corelib/global/qglobalstatic.qdoc @@ -435,6 +435,7 @@ */ /*! + \keyword qglobalstatic-operator-type-ptr \fn template QGlobalStatic::operator Type*() This function returns the address of the contents of this global static. If @@ -476,10 +477,11 @@ by this function. If the contents have already been destroyed, this function will return a null pointer. - This function is equivalent to \l {operator Type *()}. It is provided for - compatibility with the private Q_GLOBAL_STATIC implementation that existed - in Qt 4.x and 5.0. New code should avoid using it and should instead treat - the object as a smart pointer. + This function is equivalent to \l {qglobalstatic-operator-type-ptr} + {operator Type *()}. It is provided for compatibility with the private + Q_GLOBAL_STATIC implementation that existed in Qt 4.x and 5.0. New code + should avoid using it and should instead treat the object as a smart + pointer. */ /*! diff --git a/src/corelib/io/qdir.cpp b/src/corelib/io/qdir.cpp index 75fd0f8e0a..7df461ddce 100644 --- a/src/corelib/io/qdir.cpp +++ b/src/corelib/io/qdir.cpp @@ -1040,7 +1040,8 @@ QStringList QDir::nameFilters() const list of filters specified by \a nameFilters. Each name filter is a wildcard (globbing) filter that understands - \c{*} and \c{?} wildcards. (See \l{QRegularExpression wildcard matching}.) + \c{*} and \c{?} wildcards. See \l{QRegularExpression#Wildcard matching} + {QRegularExpression Wildcard Matching}. For example, the following code sets three name filters on a QDir to ensure that only files with extensions typically used for C++ @@ -2120,8 +2121,8 @@ QString QDir::rootPath() patterns in the list of \a filters; otherwise returns \c false. The matching is case insensitive. - \sa {QRegularExpression Wildcard matching}, QRegularExpression::wildcardToRegularExpression(), - entryList(), entryInfoList() + \sa {QRegularExpression#Wildcard matching}{QRegularExpression Wildcard Matching}, + entryList(), entryInfoList() */ bool QDir::match(const QStringList &filters, const QString &fileName) { @@ -2143,8 +2144,8 @@ bool QDir::match(const QStringList &filters, const QString &fileName) contain multiple patterns separated by spaces or semicolons. The matching is case insensitive. - \sa {QRegularExpression wildcard matching}, QRegularExpression::wildcardToRegularExpression, - entryList(), entryInfoList() + \sa {QRegularExpression#Wildcard matching}{QRegularExpression Wildcard Matching}, + entryList(), entryInfoList() */ bool QDir::match(const QString &filter, const QString &fileName) { diff --git a/src/corelib/io/qprocess.cpp b/src/corelib/io/qprocess.cpp index 890867cd51..e1f4a3a311 100644 --- a/src/corelib/io/qprocess.cpp +++ b/src/corelib/io/qprocess.cpp @@ -112,12 +112,12 @@ QT_BEGIN_NAMESPACE \relates QProcess Disables the - \l {QProcess::start(const QString &, OpenMode)}{QProcess::start()} - overload taking a single string. + \l {QProcess::start(const QString &, QIODevice::OpenMode)} + {QProcess::start}() overload taking a single string. In most cases where it is used, the user intends for the first argument to be treated atomically as per the other overload. - \sa QProcess::start(const QString &command, OpenMode mode) + \sa QProcess::start(const QString &command, QIODevice::OpenMode mode) */ /*! @@ -2557,7 +2557,7 @@ bool QProcess::startDetached(const QString &program, After the \a command string has been split and unquoted, this function behaves like the overload which takes the arguments as a string list. - \sa start(const QString &command, OpenMode mode) + \sa start(const QString &command, QIODevice::OpenMode mode) */ bool QProcess::startDetached(const QString &command) { diff --git a/src/corelib/kernel/qdeadlinetimer.cpp b/src/corelib/kernel/qdeadlinetimer.cpp index 466056d513..6aa886cfe1 100644 --- a/src/corelib/kernel/qdeadlinetimer.cpp +++ b/src/corelib/kernel/qdeadlinetimer.cpp @@ -720,6 +720,11 @@ QDeadlineTimer QDeadlineTimer::addNSecs(QDeadlineTimer dt, qint64 nsecs) Q_DECL_ Returns the time remaining before the deadline. */ +/*! + \fn QPair QDeadlineTimer::_q_data() const + \internal +*/ + // the rest of the functions are in qelapsedtimer_xxx.cpp QT_END_NAMESPACE diff --git a/src/corelib/kernel/qeventdispatcher_cf.mm b/src/corelib/kernel/qeventdispatcher_cf.mm index 8881305b18..b7b379e2c1 100644 --- a/src/corelib/kernel/qeventdispatcher_cf.mm +++ b/src/corelib/kernel/qeventdispatcher_cf.mm @@ -58,7 +58,7 @@ QT_USE_NAMESPACE -/*! +/* During scroll view panning, and possibly other gestures, UIKit will request a switch to UITrackingRunLoopMode via GSEventPushRunLoopMode, which records the new runloop mode and stops the current runloop. diff --git a/src/corelib/kernel/qtimer.cpp b/src/corelib/kernel/qtimer.cpp index 90f29aa630..13f027074a 100644 --- a/src/corelib/kernel/qtimer.cpp +++ b/src/corelib/kernel/qtimer.cpp @@ -571,43 +571,43 @@ void QTimer::singleShot(int msec, Qt::TimerType timerType, const QObject *receiv */ /*! - \fn template QMetaObject::Connection callOnTimeout(Functor functor, Qt::ConnectionType connectionType = Qt::AutoConnection) + \fn template QMetaObject::Connection QTimer::callOnTimeout(Functor slot, Qt::ConnectionType connectionType = Qt::AutoConnection) \since 5.12 \overload - Creates a connection from the timeout() signal to \a functor, and returns a + Creates a connection from the timeout() signal to \a slot, and returns a handle to the connection. This method is provided for convenience. - It's equivalent to calling \c {QObject::connect(timer, &QTimer::timeout, timer, functor, connectionType)}. + It's equivalent to calling \c {QObject::connect(timer, &QTimer::timeout, timer, slot, connectionType)}. \sa QObject::connect(), timeout() */ /*! - \fn template QMetaObject::Connection callOnTimeout(QObject *context, Functor functor, Qt::ConnectionType connectionType = Qt::AutoConnection) + \fn template QMetaObject::Connection QTimer::callOnTimeout(const QObject *context, Functor slot, Qt::ConnectionType connectionType = Qt::AutoConnection) \since 5.12 \overload callOnTimeout() - Creates a connection from the timeout() signal to \a functor to be placed in a specific + Creates a connection from the timeout() signal to \a slot to be placed in a specific event loop of \a context, and returns a handle to the connection. This method is provided for convenience. It's equivalent to calling - \c {QObject::connect(timer, &QTimer::timeout, context, functor, connectionType)}. + \c {QObject::connect(timer, &QTimer::timeout, context, slot, connectionType)}. \sa QObject::connect(), timeout() */ /*! - \fn template QMetaObject::Connection callOnTimeout(QObject *receiver, PointerToMemberFunction method, Qt::ConnectionType connectionType = Qt::AutoConnection) + \fn template QMetaObject::Connection QTimer::callOnTimeout(const QObject *receiver, PointerToMemberFunction slot, Qt::ConnectionType connectionType = Qt::AutoConnection) \since 5.12 \overload callOnTimeout() - Creates a connection from the timeout() signal to the \a method in the \a receiver object. Returns + Creates a connection from the timeout() signal to the \a slot in the \a receiver object. Returns a handle to the connection. This method is provided for convenience. It's equivalent to calling - \c {QObject::connect(timer, &QTimer::timeout, receiver, method, connectionType)}. + \c {QObject::connect(timer, &QTimer::timeout, receiver, slot, connectionType)}. \sa QObject::connect(), timeout() */ diff --git a/src/corelib/tools/qbytearray.cpp b/src/corelib/tools/qbytearray.cpp index 8f2ad8c012..53ae7b9452 100644 --- a/src/corelib/tools/qbytearray.cpp +++ b/src/corelib/tools/qbytearray.cpp @@ -3076,7 +3076,7 @@ bool QByteArray::endsWith(const char *str) const return qstrncmp(d->data() + d->size - len, str, len) == 0; } -/*! +/* Returns true if \a c is an uppercase Latin1 letter. \note The multiplication sign 0xD7 and the sz ligature 0xDF are not treated as uppercase Latin1. @@ -3112,7 +3112,7 @@ bool QByteArray::isUpper() const return true; } -/*! +/* Returns true if \a c is an lowercase Latin1 letter. \note The division sign 0xF7 is not treated as lowercase Latin1, but the small y dieresis 0xFF is. diff --git a/src/corelib/tools/qmap.cpp b/src/corelib/tools/qmap.cpp index d7844f3128..5f7275c5f8 100644 --- a/src/corelib/tools/qmap.cpp +++ b/src/corelib/tools/qmap.cpp @@ -537,7 +537,7 @@ void QMapDataBase::freeData(QMapDataBase *d) \sa operator=() */ -/*! \fn template QMap::QMap(const std::map & other) +/*! \fn template QMap::QMap(const typename std::map & other) Constructs a copy of \a other. diff --git a/src/corelib/tools/qregularexpression.cpp b/src/corelib/tools/qregularexpression.cpp index fec5f620fc..908e7ff0d6 100644 --- a/src/corelib/tools/qregularexpression.cpp +++ b/src/corelib/tools/qregularexpression.cpp @@ -2000,8 +2000,8 @@ QString QRegularExpression::wildcardToRegularExpression(const QString &pattern) \since 5.12 - Returns the expression wrapped between the \c{\A} and \c{\z} anchors to be - used for exact matching. + Returns the \a expression wrapped between the \c{\A} and \c{\z} anchors to + be used for exact matching. \sa {Porting from QRegExp's Exact Matching} */ diff --git a/src/corelib/tools/qshareddata.cpp b/src/corelib/tools/qshareddata.cpp index bc4291e20f..c334f71fa0 100644 --- a/src/corelib/tools/qshareddata.cpp +++ b/src/corelib/tools/qshareddata.cpp @@ -579,6 +579,13 @@ QT_BEGIN_NAMESPACE the shared data object if the reference count became 0. */ +/*! \fn template T *QExplicitlySharedDataPointer::take() + \since 5.12 + + Returns a pointer to the shared object, and resets \e this to be null. + That is, this function sets the \e{d pointer} of \e this to \c nullptr. + */ + /*! \fn template QExplicitlySharedDataPointer::operator bool () const Returns \c true if the \e{d pointer} of \e this is \e not null. */ diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp index c89635cfdb..fb7fb64223 100644 --- a/src/corelib/tools/qstring.cpp +++ b/src/corelib/tools/qstring.cpp @@ -254,7 +254,7 @@ inline RetType UnrollTailLoop<0>::exec(Number, RetType returnIfExited, Functor1, /*! * \internal * - * Searches for character \a \c in the string \a str and returns a pointer to + * Searches for character \a c in the string \a str and returns a pointer to * it. Unlike strchr() and wcschr() (but like glibc's strchrnul()), if the * character is not found, this function returns a pointer to the end of the * string -- that is, \c{str.end()}. diff --git a/src/corelib/tools/qtimezone.cpp b/src/corelib/tools/qtimezone.cpp index db6be581ec..cbc6b50c98 100644 --- a/src/corelib/tools/qtimezone.cpp +++ b/src/corelib/tools/qtimezone.cpp @@ -217,7 +217,7 @@ Q_GLOBAL_STATIC(QTimeZoneSingleton, global_tz); This class includes data obtained from the CLDR data files under the terms of the Unicode Data Files and Software License. See - \l{Unicode CLDR (Unicode Common Locale Data Repository)} for the details. + \l{Unicode Common Locale Data Repository (CLDR)} for details. \sa QDateTime */ -- cgit v1.2.3 From 411430f4201d36e9c8b44ad60344a87e271d07b8 Mon Sep 17 00:00:00 2001 From: Topi Reinio Date: Thu, 1 Nov 2018 12:00:32 +0100 Subject: Re-add missing ANGLE license files Commit 0a7aebad inadvertently removed two ANGLE-related files for license information. This caused the licensing documentation to fail to generate for those components. Task-number: QTBUG-71502 Change-Id: I33ee673267c43474304d577e78fc1a0c3bd8691f Reviewed-by: Martin Smith --- src/3rdparty/angle/SYSTEMINFO_LICENSE | 22 ++++++++++++++++++++++ src/3rdparty/angle/TRACEEVENT_LICENSE | 27 +++++++++++++++++++++++++++ 2 files changed, 49 insertions(+) create mode 100644 src/3rdparty/angle/SYSTEMINFO_LICENSE create mode 100644 src/3rdparty/angle/TRACEEVENT_LICENSE diff --git a/src/3rdparty/angle/SYSTEMINFO_LICENSE b/src/3rdparty/angle/SYSTEMINFO_LICENSE new file mode 100644 index 0000000000..c12444e3bc --- /dev/null +++ b/src/3rdparty/angle/SYSTEMINFO_LICENSE @@ -0,0 +1,22 @@ +Copyright (C) 2009 Apple Inc. All Rights Reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: +1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR +CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/src/3rdparty/angle/TRACEEVENT_LICENSE b/src/3rdparty/angle/TRACEEVENT_LICENSE new file mode 100644 index 0000000000..34d6cd9268 --- /dev/null +++ b/src/3rdparty/angle/TRACEEVENT_LICENSE @@ -0,0 +1,27 @@ +Copyright 2013 The Chromium Authors. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- cgit v1.2.3 From a92735ec007b7cafacb70029ce10f039ace66515 Mon Sep 17 00:00:00 2001 From: Topi Reinio Date: Tue, 30 Oct 2018 14:40:54 +0100 Subject: Doc: Document Qt::ScrollMomentum MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit And fix a typo in Qt::ScrollEnd. Task-number: QTBUG-71502 Change-Id: I3efdbd12415814e066edd1b2f102a792812d36d5 Reviewed-by: Tor Arne Vestbø --- src/corelib/global/qnamespace.qdoc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/corelib/global/qnamespace.qdoc b/src/corelib/global/qnamespace.qdoc index 42009e0b5e..652efb10bf 100644 --- a/src/corelib/global/qnamespace.qdoc +++ b/src/corelib/global/qnamespace.qdoc @@ -3187,8 +3187,12 @@ \value ScrollUpdate The scrolling distance has changed (default). - \value ScrollEnd Scrolling has ended, but the scrolling distance + \value ScrollEnd Scrolling has ended, and the scrolling distance did not change anymore. + + \value ScrollMomentum The user no longer touches the input device, + but scrolling continues due to scroll momentum. + This value was introduced in Qt 5.12. */ /*! -- cgit v1.2.3 From 46a595b047a928b1a5d527065c6814ef05e3a97b Mon Sep 17 00:00:00 2001 From: Topi Reinio Date: Tue, 30 Oct 2018 14:13:31 +0100 Subject: Doc: QCbor classes: Fix \variable commands \variable must not include the variable type, QDoc will resolve that. This commit resolves four documentation warnings. Task-number: QTBUG-71502 Change-Id: I5e88cf66d3c3bb8f18495d5477e1271ac2cd9e74 Reviewed-by: Martin Smith --- src/corelib/serialization/qcborstream.cpp | 6 ++++-- src/corelib/serialization/qcborvalue.cpp | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/corelib/serialization/qcborstream.cpp b/src/corelib/serialization/qcborstream.cpp index 22286188b8..7628019943 100644 --- a/src/corelib/serialization/qcborstream.cpp +++ b/src/corelib/serialization/qcborstream.cpp @@ -1422,12 +1422,14 @@ bool QCborStreamWriter::endMap() */ /*! - \variable Container QCborStreamReader::StringResult::data + \variable QCborStreamReader::StringResult::data + Contains the actual data from the string if \l status is \c Ok. */ /*! - \variable QCborStreamReader::StringResultCode QCborStreamReader::StringResult::status + \variable QCborStreamReader::StringResult::status + Contains the status of the attempt of reading the string from the stream. */ diff --git a/src/corelib/serialization/qcborvalue.cpp b/src/corelib/serialization/qcborvalue.cpp index 5d97a6a06a..e53b6a0326 100644 --- a/src/corelib/serialization/qcborvalue.cpp +++ b/src/corelib/serialization/qcborvalue.cpp @@ -221,7 +221,7 @@ QT_BEGIN_NAMESPACE */ /*! - \variable qint64 QCborParserError::offset + \variable QCborParserError::offset This field contains the offset from the beginning of the data where the error was detected. The offset should point to the beginning of the item @@ -232,7 +232,7 @@ QT_BEGIN_NAMESPACE */ /*! - \variable QCborError QCborParserError::error + \variable QCborParserError::error This field contains the error code that indicates what decoding problem was found. -- cgit v1.2.3 From 4615415500bfa816b6010cfd47162899dd72c682 Mon Sep 17 00:00:00 2001 From: Topi Reinio Date: Tue, 30 Oct 2018 14:01:00 +0100 Subject: Doc: Tie the QScopeGuard documentation to a class Previously no documentation was generated for the global qScopeGuard() function. Create a class documentation page and add the the function as a related non-member using \relates. Task-number: QTBUG-71502 Change-Id: Ida5d7044f4de962360dfee9321feb49005d4b299 Reviewed-by: Martin Smith --- src/corelib/tools/qscopeguard.qdoc | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/src/corelib/tools/qscopeguard.qdoc b/src/corelib/tools/qscopeguard.qdoc index 7cbc3e9c7b..70e13ab2fd 100644 --- a/src/corelib/tools/qscopeguard.qdoc +++ b/src/corelib/tools/qscopeguard.qdoc @@ -30,24 +30,36 @@ QT_BEGIN_NAMESPACE /*! - \fn const QScopeGuard qScopeGuard(F f) - \inmodule QtCore - \brief The qScopeGuard function can be used to call a function at the end of the scope. + \class QScopeGuard \since 5.12 + \inmodule QtCore + \brief Provides a scope guard for calling a function at the of + a scope. +*/ + +/*! + \fn template const QScopeGuard qScopeGuard(F f) + \inmodule QtCore + \relates QScopeGuard + \brief The qScopeGuard function can be used to call a function at the end + of the scope. \ingroup misc - QScopeGuard is a class which sole purpose is to run a function F in its destructor. - This is useful for guaranteeing your cleanup code is executed whether the function is exited normally, - exited early by a return statement, or exited by an exception. + QScopeGuard is a class which sole purpose is to run a function \e F in + its destructor. This is useful for guaranteeing your cleanup code is + executed, whether the function is exited normally, exited early by a return + statement, or exited by an exception. - If F is a lambda then you cannot instantiate the template directly, therefore the qScopeGuard() helper - is provided and QScopeGuard is made a private implementation detail. + If \e F is a lambda then you cannot instantiate the template directly, + therefore the qScopeGuard() helper is provided and QScopeGuard is made a + private implementation detail. Example usage is as follows: \snippet code/src_corelib_tools_qscopeguard.cpp 0 - \note Exceptions are not supported. The callable shouldn't throw when executed, copied or moved. + \note Exceptions are not supported. The callable shouldn't throw when + executed, copied or moved. \sa QScopedValueRollback */ -- cgit v1.2.3 From e14e8427faae670c662efede723edc2db4c875cb Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Wed, 24 Oct 2018 18:53:03 +0200 Subject: fix configure instructions in libpng and libjpeg attributions Fixes: QTBUG-71379 Change-Id: Ib1efbe0fc4407ccf6ab814229dc4a08d9d03b6b5 Reviewed-by: Lars Knoll --- src/3rdparty/libjpeg/qt_attribution.json | 2 +- src/3rdparty/libpng/qt_attribution.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/3rdparty/libjpeg/qt_attribution.json b/src/3rdparty/libjpeg/qt_attribution.json index 57c5001f6c..8fbdfdb9b7 100644 --- a/src/3rdparty/libjpeg/qt_attribution.json +++ b/src/3rdparty/libjpeg/qt_attribution.json @@ -2,7 +2,7 @@ "Id": "libjpeg", "Name": "LibJPEG-turbo", "QDocModule": "qtgui", - "QtUsage": "Used in the QJPEG image plugin. Configure with -no-jpeg to avoid.", + "QtUsage": "Used in the qjpeg image plugin. Configure with -system-libjpeg or -no-libjpeg to avoid.", "Description": "The Independent JPEG Group's JPEG software", "Homepage": "http://libjpeg-turbo.virtualgl.org/", diff --git a/src/3rdparty/libpng/qt_attribution.json b/src/3rdparty/libpng/qt_attribution.json index f9039a50f6..2f82b4c1c6 100644 --- a/src/3rdparty/libpng/qt_attribution.json +++ b/src/3rdparty/libpng/qt_attribution.json @@ -2,7 +2,7 @@ "Id": "libpng", "Name": "LibPNG", "QDocModule": "qtgui", - "QtUsage": "Used in the qpng image plugin. Configure with -system-png or -no-png to avoid.", + "QtUsage": "Used in the qpng image plugin. Configure with -system-libpng or -no-libpng to avoid.", "Description": "libpng is the official PNG reference library.", "Homepage": "http://www.libpng.org/pub/png/libpng.html", -- cgit v1.2.3 From 3f61873f497286af1bce97883f30bf9a520e6a75 Mon Sep 17 00:00:00 2001 From: Volker Hilsheimer Date: Fri, 26 Oct 2018 15:32:50 +0000 Subject: Correctly document value of QThread::currentThreadId on Windows The implementation calls GetCurrentThreadId, not GetCurrentThread, so the return value is not the pseudo-handle. Task-number: QTBUG-67686 Change-Id: Ifde0cf603dcea01bc1c454a8bebe1e5c0f22617f Reviewed-by: Paul Wicking Reviewed-by: Thiago Macieira --- src/corelib/thread/qthread.cpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/corelib/thread/qthread.cpp b/src/corelib/thread/qthread.cpp index d2d6435004..d3f60eea4f 100644 --- a/src/corelib/thread/qthread.cpp +++ b/src/corelib/thread/qthread.cpp @@ -298,12 +298,9 @@ QThreadPrivate::~QThreadPrivate() \warning The handle returned by this function is used for internal purposes and should not be used in any application code. - \warning On Windows, the returned value is a pseudo-handle for the - current thread. It can't be used for numerical comparison. i.e., - this function returns the DWORD (Windows-Thread ID) returned by - the Win32 function getCurrentThreadId(), not the HANDLE - (Windows-Thread HANDLE) returned by the Win32 function - getCurrentThread(). + \note On Windows, this function returns the DWORD (Windows-Thread + ID) returned by the Win32 function GetCurrentThreadId(), not the pseudo-HANDLE + (Windows-Thread HANDLE) returned by the Win32 function GetCurrentThread(). */ /*! -- cgit v1.2.3 From d16babf351e11c9bbfce57a7e92ae06194d9dab0 Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Mon, 22 Oct 2018 16:37:09 +0200 Subject: Update sha3's brg_endian.h, document provenance and version The existing copyright notice gave me a name; github found me a file; but it doesn't match what we had before. Made some guesses at which parts of the change relative to upstream to keep, documented the diff as a patch and recorded details in qt_attribution.json Task-number: QTBUG-70008 Change-Id: I423724435eaeeda7237f8b3df8691b436fed8652 Reviewed-by: Lars Knoll --- src/3rdparty/sha3/BRG_ENDIAN_LICENSE | 21 ++++++---------- src/3rdparty/sha3/brg_endian.h | 47 ++++++++++++++++------------------- src/3rdparty/sha3/brg_endian.h.patch | 34 +++++++++++++++++++++++++ src/3rdparty/sha3/qt_attribution.json | 8 +++--- 4 files changed, 68 insertions(+), 42 deletions(-) create mode 100644 src/3rdparty/sha3/brg_endian.h.patch diff --git a/src/3rdparty/sha3/BRG_ENDIAN_LICENSE b/src/3rdparty/sha3/BRG_ENDIAN_LICENSE index 0a4fdcbc3b..175347c263 100644 --- a/src/3rdparty/sha3/BRG_ENDIAN_LICENSE +++ b/src/3rdparty/sha3/BRG_ENDIAN_LICENSE @@ -1,21 +1,14 @@ -Copyright (c) 1998-2008, Brian Gladman, Worcester, UK. All rights reserved. - -LICENSE TERMS +Copyright (c) 1998-2013, Brian Gladman, Worcester, UK. All rights reserved. The redistribution and use of this software (with or without changes) is allowed without the payment of fees or royalties provided that: - 1. source code distributions include the above copyright notice, this - list of conditions and the following disclaimer; - - 2. binary distributions include the above copyright notice, this list - of conditions and the following disclaimer in their documentation; - - 3. the name of the copyright holder is not used to endorse products - built using this software without specific written permission. + source code distributions include the above copyright notice, this + list of conditions and the following disclaimer; -DISCLAIMER + binary distributions include the above copyright notice, this list + of conditions and the following disclaimer in their documentation. This software is provided 'as is' with no explicit or implied warranties -in respect of its properties, including, but not limited to, correctness -and/or fitness for purpose. +in respect of its operation, including, but not limited to, correctness +and fitness for purpose. diff --git a/src/3rdparty/sha3/brg_endian.h b/src/3rdparty/sha3/brg_endian.h index 7226eb3bec..09d2a8b6a9 100644 --- a/src/3rdparty/sha3/brg_endian.h +++ b/src/3rdparty/sha3/brg_endian.h @@ -1,29 +1,22 @@ /* - --------------------------------------------------------------------------- - Copyright (c) 1998-2008, Brian Gladman, Worcester, UK. All rights reserved. +--------------------------------------------------------------------------- +Copyright (c) 1998-2013, Brian Gladman, Worcester, UK. All rights reserved. - LICENSE TERMS +The redistribution and use of this software (with or without changes) +is allowed without the payment of fees or royalties provided that: - The redistribution and use of this software (with or without changes) - is allowed without the payment of fees or royalties provided that: + source code distributions include the above copyright notice, this + list of conditions and the following disclaimer; - 1. source code distributions include the above copyright notice, this - list of conditions and the following disclaimer; + binary distributions include the above copyright notice, this list + of conditions and the following disclaimer in their documentation. - 2. binary distributions include the above copyright notice, this list - of conditions and the following disclaimer in their documentation; - - 3. the name of the copyright holder is not used to endorse products - built using this software without specific written permission. - - DISCLAIMER - - This software is provided 'as is' with no explicit or implied warranties - in respect of its properties, including, but not limited to, correctness - and/or fitness for purpose. - --------------------------------------------------------------------------- - Issue Date: 20/12/2007 - Changes for ARM 9/9/2010 +This software is provided 'as is' with no explicit or implied warranties +in respect of its operation, including, but not limited to, correctness +and fitness for purpose. +--------------------------------------------------------------------------- +Issue Date: 20/12/2007 +Changes for ARM 9/9/2010 [Downstream relative to Gladman's GitHub, upstream to Qt] */ #ifndef _BRG_ENDIAN_H @@ -32,7 +25,12 @@ #define IS_BIG_ENDIAN 4321 /* byte 0 is most significant (mc68k) */ #define IS_LITTLE_ENDIAN 1234 /* byte 0 is least significant (i386) */ -#if 0 +/* This is needed when using clang with MSVC to avoid including */ +/* endian.h and byteswap.h which are not present on Windows */ +#if defined( _MSC_VER ) && defined( __clang__ ) +# undef __GNUC__ +#endif + /* Include files where endian defines and byteswap functions may reside */ #if defined( __sun ) # include @@ -42,14 +40,13 @@ defined( __CYGWIN32__ ) || defined( __DJGPP__ ) || defined( __osf__ ) # include #elif defined( __linux__ ) || defined( __GNUC__ ) || defined( __GNU_LIBRARY__ ) -# if !defined( __MINGW32__ ) && !defined( _AIX ) +# if !defined( __MINGW32__ ) && !defined( _AIX ) && !defined(Q_OS_QNX) # include # if !defined( __BEOS__ ) # include # endif # endif #endif -#endif /* Now attempt to set the define for platform byte order using any */ /* of the four forms SYMBOL, _SYMBOL, __SYMBOL & __SYMBOL__, which */ @@ -134,7 +131,7 @@ #elif 0 /* **** EDIT HERE IF NECESSARY **** */ # define PLATFORM_BYTE_ORDER IS_BIG_ENDIAN #else -# error Please edit lines 132 or 134 in brg_endian.h to set the platform byte order +# error Please edit lines 129 or 131 in brg_endian.h to set the platform byte order #endif #endif diff --git a/src/3rdparty/sha3/brg_endian.h.patch b/src/3rdparty/sha3/brg_endian.h.patch new file mode 100644 index 0000000000..395133ad2a --- /dev/null +++ b/src/3rdparty/sha3/brg_endian.h.patch @@ -0,0 +1,34 @@ +diff -ub /home/eddy/.sys/tmp/sha/brg_endian.h /home/eddy/work/Qt-5.12/qtbase/src/3rdparty/sha3/brg_endian.h +--- upstream/sha/brg_endian.h 2018-10-22 16:27:04.106128670 +0200 ++++ qtbase/src/3rdparty/sha3/brg_endian.h 2018-10-22 16:30:35.098891562 +0200 +@@ -16,6 +16,7 @@ + and fitness for purpose. + --------------------------------------------------------------------------- + Issue Date: 20/12/2007 ++Changes for ARM 9/9/2010 [Downstream relative to Gladman's GitHub, upstream to Qt] + */ + + #ifndef _BRG_ENDIAN_H +@@ -119,12 +120,18 @@ + defined( THINK_C ) || defined( __VMCMS__ ) || defined( _AIX ) + # define PLATFORM_BYTE_ORDER IS_BIG_ENDIAN + +-#elif 0 /* **** EDIT HERE IF NECESSARY **** */ ++#elif defined(__arm__) ++# ifdef __BIG_ENDIAN ++# define PLATFORM_BYTE_ORDER IS_BIG_ENDIAN ++# else ++# define PLATFORM_BYTE_ORDER IS_LITTLE_ENDIAN ++# endif ++#elif 1 /* **** EDIT HERE IF NECESSARY **** */ + # define PLATFORM_BYTE_ORDER IS_LITTLE_ENDIAN + #elif 0 /* **** EDIT HERE IF NECESSARY **** */ + # define PLATFORM_BYTE_ORDER IS_BIG_ENDIAN + #else +-# error Please edit lines 126 or 128 in brg_endian.h to set the platform byte order ++# error Please edit lines 129 or 131 in brg_endian.h to set the platform byte order + #endif + + #endif + +Diff finished. Mon Oct 22 16:31:46 2018 diff --git a/src/3rdparty/sha3/qt_attribution.json b/src/3rdparty/sha3/qt_attribution.json index 4866be32ea..a3122b4e7b 100644 --- a/src/3rdparty/sha3/qt_attribution.json +++ b/src/3rdparty/sha3/qt_attribution.json @@ -4,13 +4,15 @@ "Name": "Secure Hash Algorithm SHA-3 - brg_endian", "QDocModule": "qtcore", "QtUsage": "Used in Qt Core (QCryptographicHash).", + "Files": "apply brg_endian.h.patch to upstream from https://github.com/BrianGladman/sha/", "Files": "brg_endian.h", "Description": "SHA-3, originally known as Keccak, is a cryptographic hash function.", - "License": "BSD 3-clause \"New\" or \"Revised\" License", + "Version": "https://github.com/BrianGladman/sha/ commit 4b9e13ead2c5b5e41ca27c65de4dd69ae0bac228", + "License": "BSD 2-clause \"Simplified\" License", "LicenseFile": "BRG_ENDIAN_LICENSE", - "LicenseId": "BSD-3-Clause", - "Copyright": "Copyright (c) 1998-2008, Brian Gladman, Worcester, UK. All rights reserved." + "LicenseId": "BSD-2-Clause", + "Copyright": "Copyright (c) 1998-2013, Brian Gladman, Worcester, UK. All rights reserved." }, { "Id": "sha3_keccak", -- cgit v1.2.3 From ac4d954cfba98b1a6abb5c8cabed6ee32a43560c Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Mon, 22 Oct 2018 19:42:12 +0200 Subject: Update DejaVuSans.ttf from upstream Document the version in the process; and make the wordings of copyright notices match those in DEJAVU-LICENSE. Task-number: QTBUG-70008 Change-Id: I1c965e5d7afb18dc4dbdffed908512c5771ab717 Reviewed-by: Lars Knoll --- src/3rdparty/wasm/DejaVuSans.ttf | Bin 493564 -> 757076 bytes src/3rdparty/wasm/qt_attribution.json | 5 +++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/3rdparty/wasm/DejaVuSans.ttf b/src/3rdparty/wasm/DejaVuSans.ttf index 7e411a71be..e5f7eecce4 100644 Binary files a/src/3rdparty/wasm/DejaVuSans.ttf and b/src/3rdparty/wasm/DejaVuSans.ttf differ diff --git a/src/3rdparty/wasm/qt_attribution.json b/src/3rdparty/wasm/qt_attribution.json index 5d89e4adfa..d569fdc167 100644 --- a/src/3rdparty/wasm/qt_attribution.json +++ b/src/3rdparty/wasm/qt_attribution.json @@ -24,10 +24,11 @@ "Description": "The DejaVu fonts are a font family based on the Vera Fonts.", "Homepage": "https://dejavu-fonts.github.io/", + "Version": "2.37", "License": "Bitstream Vera Font License", "LicenseFile": "DEJAVU-LICENSE", - "Copyright": "Copyright (C) 2003 Bitstream,Inc + "Copyright": "Copyright (c) 2003 by Bitstream, Inc Copyright (c) 2006 by Tavmjong Bah (c) American Mathematical Society" } -] \ No newline at end of file +] -- cgit v1.2.3 From b3ae87fe765fe6ad005760d6370f2674873fead7 Mon Sep 17 00:00:00 2001 From: Timur Pocheptsov Date: Mon, 29 Oct 2018 14:26:15 +0100 Subject: Add missing protocol enumerators, report TLS 1.3 if negotiated 1. Remove the conditional inclusion of DTLS versions, they made difficult and unnecessary ugly adding new protocols (something like TlsV1_2OrLater + 4). 2. OpenSSL 1.1.1 first introduced TLS 1.3 support. OpenSSL 1.1 back-end is compatible with OpenSSL 1.1.1, but would fail to extract/report protocol versions and set versions like 'TLS 1.3 only' or 'TLS 1.3 or better' on a new context. Given 1.1.1 is deployed/adapted fast by different distros, and 5.12 is LTS, we fix this issue by introducing QSsl::Tls1_3 and QSsl::Tls1_3OrLater. SecureTransport, WinRT and OpenSSL below 1.1.1 will report an error in case the application requests this protocol (SecureTransport in future will probably enable TLS 1.3). Saying all that, TLS 1.3 support is experimental in QSslSocket. Done-by: Albert Astals Cid Done-by: Timur Pocheptsov Change-Id: I4a97cc789b62763763cf41c44157ef0a9fd6cbec Reviewed-by: Lars Knoll --- src/network/ssl/qssl.cpp | 2 + src/network/ssl/qssl.h | 5 +- src/network/ssl/qsslcontext_openssl11.cpp | 87 +++++++++++++++++++--- src/network/ssl/qsslcontext_opensslpre11.cpp | 15 ++++ src/network/ssl/qsslsocket_mac.cpp | 12 +++ src/network/ssl/qsslsocket_openssl.cpp | 6 ++ src/network/ssl/qsslsocket_openssl11_symbols_p.h | 4 + src/network/ssl/qsslsocket_openssl_symbols.cpp | 4 + src/network/ssl/qsslsocket_winrt.cpp | 2 + .../auto/network/ssl/qsslsocket/tst_qsslsocket.cpp | 60 ++++++++++++++- 10 files changed, 182 insertions(+), 15 deletions(-) diff --git a/src/network/ssl/qssl.cpp b/src/network/ssl/qssl.cpp index 3a0983e8b5..19d99bc489 100644 --- a/src/network/ssl/qssl.cpp +++ b/src/network/ssl/qssl.cpp @@ -129,6 +129,8 @@ Q_LOGGING_CATEGORY(lcSsl, "qt.network.ssl"); \value DtlsV1_0OrLater DTLSv1.0 and later versions. \value DtlsV1_2 DTLSv1.2 \value DtlsV1_2OrLater DTLSv1.2 and later versions. + \value TlsV1_3 TLSv1.3. (Since Qt 5.12) + \value TlsV1_3OrLater TLSv1.3 and later versions. (Since Qt 5.12) \value UnknownProtocol The cipher's protocol cannot be determined. \value AnyProtocol The socket understands SSLv2, SSLv3, TLSv1.0 and all supported later versions of TLS. This value is used by QSslSocket only. diff --git a/src/network/ssl/qssl.h b/src/network/ssl/qssl.h index dd268cd86d..60362cb410 100644 --- a/src/network/ssl/qssl.h +++ b/src/network/ssl/qssl.h @@ -91,12 +91,13 @@ namespace QSsl { TlsV1_1OrLater, TlsV1_2OrLater, -#if QT_CONFIG(dtls) || defined(Q_CLANG_QDOC) DtlsV1_0, DtlsV1_0OrLater, DtlsV1_2, DtlsV1_2OrLater, -#endif + + TlsV1_3, + TlsV1_3OrLater, UnknownProtocol = -1 }; diff --git a/src/network/ssl/qsslcontext_openssl11.cpp b/src/network/ssl/qsslcontext_openssl11.cpp index 708cb7bb0e..02ce466c80 100644 --- a/src/network/ssl/qsslcontext_openssl11.cpp +++ b/src/network/ssl/qsslcontext_openssl11.cpp @@ -105,7 +105,24 @@ init_context: isDtls = true; sslContext->ctx = q_SSL_CTX_new(client ? q_DTLS_client_method() : q_DTLS_server_method()); break; +#else // dtls + case QSsl::DtlsV1_0: + case QSsl::DtlsV1_0OrLater: + case QSsl::DtlsV1_2: + case QSsl::DtlsV1_2OrLater: + sslContext->ctx = nullptr; + unsupportedProtocol = true; + qCWarning(lcSsl, "DTLS protocol requested, but feature 'dtls' is disabled"); + break; #endif // dtls + case QSsl::TlsV1_3: + case QSsl::TlsV1_3OrLater: +#if !defined(TLS1_3_VERSION) + qCWarning(lcSsl, "TLS 1.3 is not supported"); + sslContext->ctx = nullptr; + unsupportedProtocol = true; + break; +#endif // TLS1_3_VERSION default: // The ssl options will actually control the supported methods sslContext->ctx = q_SSL_CTX_new(client ? q_TLS_client_method() : q_TLS_server_method()); @@ -155,6 +172,16 @@ init_context: minVersion = TLS1_2_VERSION; maxVersion = TLS1_2_VERSION; break; + case QSsl::TlsV1_3: +#ifdef TLS1_3_VERSION + minVersion = TLS1_3_VERSION; + maxVersion = TLS1_3_VERSION; +#else + // This protocol is not supported by OpenSSL 1.1 and we handle + // it as an error (see the code above). + Q_UNREACHABLE(); +#endif // TLS1_3_VERSION + break; // Ranges: case QSsl::TlsV1SslV3: case QSsl::AnyProtocol: @@ -192,6 +219,17 @@ init_context: maxVersion = DTLS_MAX_VERSION; break; #endif // dtls + case QSsl::TlsV1_3OrLater: +#ifdef TLS1_3_VERSION + minVersion = TLS1_3_VERSION; + maxVersion = 0; + break; +#else + // This protocol is not supported by OpenSSL 1.1 and we handle + // it as an error (see the code above). + Q_UNREACHABLE(); + break; +#endif // TLS1_3_VERSION case QSsl::SslV2: // This protocol is not supported by OpenSSL 1.1 and we handle // it as an error (see the code above). @@ -223,23 +261,52 @@ init_context: // http://www.openssl.org/docs/ssl/SSL_CTX_set_mode.html q_SSL_CTX_set_mode(sslContext->ctx, SSL_MODE_RELEASE_BUFFERS); + auto filterCiphers = [](const QList &ciphers, bool selectTls13) + { + QByteArray cipherString; + bool first = true; + + for (const QSslCipher &cipher : qAsConst(ciphers)) { + const bool isTls13Cipher = cipher.protocol() == QSsl::TlsV1_3 || cipher.protocol() == QSsl::TlsV1_3OrLater; + if (selectTls13 != isTls13Cipher) + continue; + + if (first) + first = false; + else + cipherString.append(':'); + cipherString.append(cipher.name().toLatin1()); + } + return cipherString; + }; + // Initialize ciphers - QByteArray cipherString; - bool first = true; QList ciphers = sslContext->sslConfiguration.ciphers(); if (ciphers.isEmpty()) ciphers = isDtls ? q_getDefaultDtlsCiphers() : QSslSocketPrivate::defaultCiphers(); - for (const QSslCipher &cipher : qAsConst(ciphers)) { - if (first) - first = false; - else - cipherString.append(':'); - cipherString.append(cipher.name().toLatin1()); + const QByteArray preTls13Ciphers = filterCiphers(ciphers, false); + + if (preTls13Ciphers.size()) { + if (!q_SSL_CTX_set_cipher_list(sslContext->ctx, preTls13Ciphers.data())) { + sslContext->errorStr = QSslSocket::tr("Invalid or empty cipher list (%1)").arg(QSslSocketBackendPrivate::getErrorsFromOpenSsl()); + sslContext->errorCode = QSslError::UnspecifiedError; + return; + } } - if (!q_SSL_CTX_set_cipher_list(sslContext->ctx, cipherString.data())) { - sslContext->errorStr = QSslSocket::tr("Invalid or empty cipher list (%1)").arg(QSslSocketBackendPrivate::getErrorsFromOpenSsl()); + const QByteArray tls13Ciphers = filterCiphers(ciphers, true); +#ifdef TLS1_3_VERSION + if (tls13Ciphers.size()) { + if (!q_SSL_CTX_set_ciphersuites(sslContext->ctx, tls13Ciphers.data())) { + sslContext->errorStr = QSslSocket::tr("Invalid or empty cipher list (%1)").arg(QSslSocketBackendPrivate::getErrorsFromOpenSsl()); + sslContext->errorCode = QSslError::UnspecifiedError; + return; + } + } +#endif // TLS1_3_VERSION + if (!preTls13Ciphers.size() && !tls13Ciphers.size()) { + sslContext->errorStr = QSslSocket::tr("Invalid or empty cipher list (%1)").arg(QStringLiteral("")); sslContext->errorCode = QSslError::UnspecifiedError; return; } diff --git a/src/network/ssl/qsslcontext_opensslpre11.cpp b/src/network/ssl/qsslcontext_opensslpre11.cpp index c8be2ecb31..34537d1da4 100644 --- a/src/network/ssl/qsslcontext_opensslpre11.cpp +++ b/src/network/ssl/qsslcontext_opensslpre11.cpp @@ -104,6 +104,15 @@ init_context: isDtls = true; sslContext->ctx = q_SSL_CTX_new(client ? q_DTLS_client_method() : q_DTLS_server_method()); break; +#else // dtls + case QSsl::DtlsV1_0: + case QSsl::DtlsV1_0OrLater: + case QSsl::DtlsV1_2: + case QSsl::DtlsV1_2OrLater: + sslContext->ctx = nullptr; + unsupportedProtocol = true; + qCWarning(lcSsl, "DTLS protocol requested, but feature 'dtls' is disabled"); + break; #endif // dtls case QSsl::SslV2: #ifndef OPENSSL_NO_SSL2 @@ -168,6 +177,12 @@ init_context: unsupportedProtocol = true; #endif break; + case QSsl::TlsV1_3: + case QSsl::TlsV1_3OrLater: + // TLS 1.3 is not supported by the system, but chosen deliberately -> error + sslContext->ctx = nullptr; + unsupportedProtocol = true; + break; } if (!client && isDtls && configuration.peerVerifyMode() != QSslSocket::VerifyNone) { diff --git a/src/network/ssl/qsslsocket_mac.cpp b/src/network/ssl/qsslsocket_mac.cpp index 9166e0ac29..65d98758ac 100644 --- a/src/network/ssl/qsslsocket_mac.cpp +++ b/src/network/ssl/qsslsocket_mac.cpp @@ -1110,6 +1110,18 @@ bool QSslSocketBackendPrivate::setSessionProtocol() return false; } + // SecureTransport has kTLSProtocol13 constant and also, kTLSProtocolMaxSupported. + // Calling SSLSetProtocolVersionMax/Min with any of these two constants results + // in errInvalidParam and a failure to set the protocol version. This means + // no TLS 1.3 on macOS and iOS. + switch (configuration.protocol) { + case QSsl::TlsV1_3: + case QSsl::TlsV1_3OrLater: + qCWarning(lcSsl) << plainSocket << "SecureTransport does not support TLS 1.3"; + return false; + default:; + } + OSStatus err = errSecSuccess; if (configuration.protocol == QSsl::SslV3) { diff --git a/src/network/ssl/qsslsocket_openssl.cpp b/src/network/ssl/qsslsocket_openssl.cpp index 64501a75e8..e7d2478092 100644 --- a/src/network/ssl/qsslsocket_openssl.cpp +++ b/src/network/ssl/qsslsocket_openssl.cpp @@ -180,6 +180,8 @@ QSslCipher QSslSocketBackendPrivate::QSslCipher_from_SSL_CIPHER(const SSL_CIPHER ciph.d->protocol = QSsl::TlsV1_1; else if (protoString == QLatin1String("TLSv1.2")) ciph.d->protocol = QSsl::TlsV1_2; + else if (protoString == QLatin1String("TLSv1.3")) + ciph.d->protocol = QSsl::TlsV1_3; if (descriptionList.at(2).startsWith(QLatin1String("Kx="))) ciph.d->keyExchangeMethod = descriptionList.at(2).mid(3).toString(); @@ -291,6 +293,8 @@ long QSslSocketBackendPrivate::setupOpenSslOptions(QSsl::SslProtocol protocol, Q options = SSL_OP_ALL|SSL_OP_NO_SSLv2|SSL_OP_NO_SSLv3|SSL_OP_NO_TLSv1; else if (protocol == QSsl::TlsV1_2OrLater) options = SSL_OP_ALL|SSL_OP_NO_SSLv2|SSL_OP_NO_SSLv3|SSL_OP_NO_TLSv1|SSL_OP_NO_TLSv1_1; + else if (protocol == QSsl::TlsV1_3OrLater) + options = SSL_OP_ALL|SSL_OP_NO_SSLv2|SSL_OP_NO_SSLv3|SSL_OP_NO_TLSv1|SSL_OP_NO_TLSv1_1|SSL_OP_NO_TLSv1_2; #endif else options = SSL_OP_ALL; @@ -1294,6 +1298,8 @@ QSsl::SslProtocol QSslSocketBackendPrivate::sessionProtocol() const return QSsl::TlsV1_1; case 0x303: return QSsl::TlsV1_2; + case 0x304: + return QSsl::TlsV1_3; } return QSsl::UnknownProtocol; diff --git a/src/network/ssl/qsslsocket_openssl11_symbols_p.h b/src/network/ssl/qsslsocket_openssl11_symbols_p.h index 844c3437be..fae007e12d 100644 --- a/src/network/ssl/qsslsocket_openssl11_symbols_p.h +++ b/src/network/ssl/qsslsocket_openssl11_symbols_p.h @@ -130,6 +130,10 @@ const char *q_OpenSSL_version(int type); unsigned long q_SSL_SESSION_get_ticket_lifetime_hint(const SSL_SESSION *session); unsigned long q_SSL_set_options(SSL *s, unsigned long op); +#ifdef TLS1_3_VERSION +int q_SSL_CTX_set_ciphersuites(SSL_CTX *ctx, const char *str); +#endif + #if QT_CONFIG(dtls) // Functions and types required for DTLS support: extern "C" diff --git a/src/network/ssl/qsslsocket_openssl_symbols.cpp b/src/network/ssl/qsslsocket_openssl_symbols.cpp index 5482440b98..781b3d6640 100644 --- a/src/network/ssl/qsslsocket_openssl_symbols.cpp +++ b/src/network/ssl/qsslsocket_openssl_symbols.cpp @@ -161,6 +161,7 @@ DEFINEFUNC(void, OPENSSL_sk_free, OPENSSL_STACK *a, a, return, DUMMYARG) DEFINEFUNC2(void *, OPENSSL_sk_value, OPENSSL_STACK *a, a, int b, b, return nullptr, return) DEFINEFUNC(int, SSL_session_reused, SSL *a, a, return 0, return) DEFINEFUNC2(unsigned long, SSL_CTX_set_options, SSL_CTX *ctx, ctx, unsigned long op, op, return 0, return) +DEFINEFUNC2(int, SSL_CTX_set_ciphersuites, SSL_CTX *ctx, ctx, const char *str, str, return 0, return) DEFINEFUNC3(size_t, SSL_get_client_random, SSL *a, a, unsigned char *out, out, size_t outlen, outlen, return 0, return) DEFINEFUNC3(size_t, SSL_SESSION_get_master_key, const SSL_SESSION *ses, ses, unsigned char *out, out, size_t outlen, outlen, return 0, return) DEFINEFUNC6(int, CRYPTO_get_ex_new_index, int class_index, class_index, long argl, argl, void *argp, argp, CRYPTO_EX_new *new_func, new_func, CRYPTO_EX_dup *dup_func, dup_func, CRYPTO_EX_free *free_func, free_func, return -1, return) @@ -966,6 +967,9 @@ bool q_resolveOpenSslSymbols() RESOLVEFUNC(OPENSSL_sk_value) RESOLVEFUNC(DH_get0_pqg) RESOLVEFUNC(SSL_CTX_set_options) +#ifdef TLS1_3_VERSION + RESOLVEFUNC(SSL_CTX_set_ciphersuites) +#endif // TLS 1.3 or OpenSSL > 1.1.1 RESOLVEFUNC(SSL_get_client_random) RESOLVEFUNC(SSL_SESSION_get_master_key) RESOLVEFUNC(SSL_session_reused) diff --git a/src/network/ssl/qsslsocket_winrt.cpp b/src/network/ssl/qsslsocket_winrt.cpp index e72edcbc52..cc69b9ac96 100644 --- a/src/network/ssl/qsslsocket_winrt.cpp +++ b/src/network/ssl/qsslsocket_winrt.cpp @@ -251,6 +251,8 @@ void QSslSocketBackendPrivate::startClientEncryption() case QSsl::TlsV1_0OrLater: case QSsl::TlsV1_1OrLater: case QSsl::TlsV1_2OrLater: + case QSsl::TlsV1_3: + case QSsl::TlsV1_3OrLater: // TlsV1_0OrLater, TlsV1_1OrLater and TlsV1_2OrLater are disabled on WinRT // because there is no good way to map them to the native API. setErrorAndEmit(QAbstractSocket::SslInvalidUserDataError, diff --git a/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp b/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp index b759aed074..6158347f62 100644 --- a/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp +++ b/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp @@ -1025,6 +1025,26 @@ void tst_QSslSocket::protocol() socket->abort(); } #endif +#ifdef TLS1_3_VERSION + { + // qt-test-server probably doesn't allow TLSV1.3 + socket->setProtocol(QSsl::TlsV1_3); + QCOMPARE(socket->protocol(), QSsl::TlsV1_3); + socket->connectToHostEncrypted(QtNetworkSettings::serverName(), 443); + if (setProxy && !socket->waitForEncrypted()) + QSKIP("TLS 1.3 is not supported by the test server or the test is flaky - see QTBUG-29941"); + QCOMPARE(socket->protocol(), QSsl::TlsV1_3); + socket->abort(); + QCOMPARE(socket->protocol(), QSsl::TlsV1_3); + socket->connectToHost(QtNetworkSettings::serverName(), 443); + QVERIFY2(socket->waitForConnected(), qPrintable(socket->errorString())); + socket->startClientEncryption(); + if (setProxy && !socket->waitForEncrypted()) + QSKIP("TLS 1.3 is not supported by the test server or the test is flaky - see QTBUG-29941"); + QCOMPARE(socket->sessionProtocol(), QSsl::TlsV1_3); + socket->abort(); + } +#endif // TLS1_3_VERSION #if !defined(OPENSSL_NO_SSL2) && !defined(QT_SECURETRANSPORT) { // qt-test-server allows SSLV2. @@ -1279,7 +1299,9 @@ void tst_QSslSocket::protocolServerSide_data() QTest::newRow("tls1.0orlater-tls1.0") << QSsl::TlsV1_0OrLater << QSsl::TlsV1_0 << true; QTest::newRow("tls1.0orlater-tls1.1") << QSsl::TlsV1_0OrLater << QSsl::TlsV1_1 << true; QTest::newRow("tls1.0orlater-tls1.2") << QSsl::TlsV1_0OrLater << QSsl::TlsV1_2 << true; - +#ifdef TLS1_3_VERSION + QTest::newRow("tls1.0orlater-tls1.3") << QSsl::TlsV1_0OrLater << QSsl::TlsV1_3 << true; +#endif #if !defined(OPENSSL_NO_SSL2) && !defined(QT_SECURETRANSPORT) QTest::newRow("tls1.1orlater-ssl2") << QSsl::TlsV1_1OrLater << QSsl::SslV2 << false; #endif @@ -1290,7 +1312,9 @@ void tst_QSslSocket::protocolServerSide_data() QTest::newRow("tls1.1orlater-tls1.0") << QSsl::TlsV1_1OrLater << QSsl::TlsV1_0 << false; QTest::newRow("tls1.1orlater-tls1.1") << QSsl::TlsV1_1OrLater << QSsl::TlsV1_1 << true; QTest::newRow("tls1.1orlater-tls1.2") << QSsl::TlsV1_1OrLater << QSsl::TlsV1_2 << true; - +#ifdef TLS1_3_VERSION + QTest::newRow("tls1.1orlater-tls1.3") << QSsl::TlsV1_1OrLater << QSsl::TlsV1_3 << true; +#endif #if !defined(OPENSSL_NO_SSL2) && !defined(QT_SECURETRANSPORT) QTest::newRow("tls1.2orlater-ssl2") << QSsl::TlsV1_2OrLater << QSsl::SslV2 << false; #endif @@ -1300,6 +1324,21 @@ void tst_QSslSocket::protocolServerSide_data() QTest::newRow("tls1.2orlater-tls1.0") << QSsl::TlsV1_2OrLater << QSsl::TlsV1_0 << false; QTest::newRow("tls1.2orlater-tls1.1") << QSsl::TlsV1_2OrLater << QSsl::TlsV1_1 << false; QTest::newRow("tls1.2orlater-tls1.2") << QSsl::TlsV1_2OrLater << QSsl::TlsV1_2 << true; +#ifdef TLS1_3_VERSION + QTest::newRow("tls1.2orlater-tls1.3") << QSsl::TlsV1_2OrLater << QSsl::TlsV1_3 << true; +#endif +#ifdef TLS1_3_VERSION +#if !defined(OPENSSL_NO_SSL2) && !defined(QT_SECURETRANSPORT) + QTest::newRow("tls1.3orlater-ssl2") << QSsl::TlsV1_3OrLater << QSsl::SslV2 << false; +#endif +#if !defined(OPENSSL_NO_SSL3) + QTest::newRow("tls1.3orlater-ssl3") << QSsl::TlsV1_3OrLater << QSsl::SslV3 << false; +#endif + QTest::newRow("tls1.3orlater-tls1.0") << QSsl::TlsV1_3OrLater << QSsl::TlsV1_0 << false; + QTest::newRow("tls1.3orlater-tls1.1") << QSsl::TlsV1_3OrLater << QSsl::TlsV1_1 << false; + QTest::newRow("tls1.3orlater-tls1.2") << QSsl::TlsV1_3OrLater << QSsl::TlsV1_2 << false; + QTest::newRow("tls1.3orlater-tls1.3") << QSsl::TlsV1_3OrLater << QSsl::TlsV1_3 << true; +#endif // TLS1_3_VERSION QTest::newRow("any-tls1.0") << QSsl::AnyProtocol << QSsl::TlsV1_0 << true; QTest::newRow("any-tls1ssl3") << QSsl::AnyProtocol << QSsl::TlsV1SslV3 << true; @@ -3505,7 +3544,12 @@ protected: socket = new QSslSocket(this); socket->setSslConfiguration(config); socket->setPeerVerifyMode(peerVerifyMode); - socket->setProtocol(protocol); + if (QSslSocket::sslLibraryVersionNumber() > 0x10101000L) { + // FIXME. With OpenSSL 1.1.1 and TLS 1.3 PSK auto-test is broken. + socket->setProtocol(QSsl::TlsV1_2); + } else { + socket->setProtocol(protocol); + } if (ignoreSslErrors) connect(socket, SIGNAL(sslErrors(QList)), this, SLOT(ignoreErrorSlot())); @@ -3885,6 +3929,11 @@ void tst_QSslSocket::pskServer() return; QSslSocket socket; +#ifdef TLS1_3_VERSION + // FIXME: with OpenSSL 1.1.1 (thus TLS 1.3) test is known to fail + // due to the different PSK mechanism (?) - to be investigated ASAP. + socket.setProtocol(QSsl::TlsV1_2); +#endif this->socket = &socket; QSignalSpy connectedSpy(&socket, SIGNAL(connected())); @@ -3970,6 +4019,11 @@ void tst_QSslSocket::signatureAlgorithm_data() if (QSslSocket::sslLibraryVersionNumber() < 0x10002000L) QSKIP("Signature algorithms cannot be tested with OpenSSL < 1.0.2"); + if (QSslSocket::sslLibraryVersionNumber() >= 0x10101000L) { + // FIXME: investigate if this test makes any sense with TLS 1.3. + QSKIP("Test is not valid for TLS 1.3/OpenSSL 1.1.1"); + } + QTest::addColumn("serverSigAlgPairs"); QTest::addColumn("serverProtocol"); QTest::addColumn("clientSigAlgPairs"); -- cgit v1.2.3 From efc7e02911f2244c693fe8336f7b4b1c0ea3bc09 Mon Sep 17 00:00:00 2001 From: Janne Koskinen Date: Wed, 24 Oct 2018 14:57:44 +0200 Subject: INTEGRITY: Fix missing uint/int 128 support for 64-bit ARM Add 64bit specializations for mul_overflow. Change-Id: I8bba69233dd71b94346983a100cf4d69bfc686f7 Reviewed-by: Thiago Macieira --- src/corelib/global/qnumeric_p.h | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/src/corelib/global/qnumeric_p.h b/src/corelib/global/qnumeric_p.h index 9c8514f5a3..e318c3759b 100644 --- a/src/corelib/global/qnumeric_p.h +++ b/src/corelib/global/qnumeric_p.h @@ -64,6 +64,10 @@ #include #endif +# if defined(Q_OS_INTEGRITY) && defined(Q_PROCESSOR_ARM_64) +#include +#endif + #if !defined(Q_CC_MSVC) && (defined(Q_OS_QNX) || defined(Q_CC_INTEL)) # include # ifdef isnan @@ -323,6 +327,38 @@ mul_overflow(T v1, T v2, T *r) return lr > std::numeric_limits::max() || lr < std::numeric_limits::min(); } +# if defined(Q_OS_INTEGRITY) && defined(Q_PROCESSOR_ARM_64) +template <> inline bool mul_overflow(quint64 v1, quint64 v2, quint64 *r) +{ + *r = v1 * v2; + return __MULUH64(v1, v2); +} +template <> inline bool mul_overflow(qint64 v1, qint64 v2, qint64 *r) +{ + qint64 high = __MULSH64(v1, v2); + if (high == 0) { + *r = v1 * v2; + return *r < 0; + } + if (high == -1) { + *r = v1 * v2; + return *r >= 0; + } + return true; +} + +template <> inline bool mul_overflow(uint64_t v1, uint64_t v2, uint64_t *r) +{ + return mul_overflow(v1,v2,reinterpret_cast(r)); +} + +template <> inline bool mul_overflow(int64_t v1, int64_t v2, int64_t *r) +{ + return mul_overflow(v1,v2,reinterpret_cast(r)); +} + +#endif + # if defined(Q_CC_MSVC) && defined(Q_PROCESSOR_X86) // We can use intrinsics for the unsigned operations with MSVC template <> inline bool add_overflow(unsigned v1, unsigned v2, unsigned *r) -- cgit v1.2.3 From 1dd6433b19b51f4c43a7f3c34314cc50edaeda34 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Tue, 11 Sep 2018 10:38:43 +0200 Subject: qmake: fix .prl file generation for bundles MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit amends 2b27646146a. Fixes: QTBUG-70444 Change-Id: I8bd310f5624ea0ac9260c7d9ea0d29b0c9caa077 Reviewed-by: Tor Arne Vestbø --- qmake/generators/makefile.cpp | 2 -- qmake/generators/unix/unixmake2.cpp | 2 ++ 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/qmake/generators/makefile.cpp b/qmake/generators/makefile.cpp index e41e391cad..b7e591d2ab 100644 --- a/qmake/generators/makefile.cpp +++ b/qmake/generators/makefile.cpp @@ -1101,8 +1101,6 @@ QString MakefileGenerator::prlFileName(bool fixify) { QString ret = project->first("PRL_TARGET") + Option::prl_ext; - if(!project->isEmpty("QMAKE_BUNDLE")) - ret.prepend(project->first("QMAKE_BUNDLE") + Option::dir_sep); if(fixify) { if(!project->isEmpty("DESTDIR")) ret.prepend(project->first("DESTDIR").toQString()); diff --git a/qmake/generators/unix/unixmake2.cpp b/qmake/generators/unix/unixmake2.cpp index 976751b02c..d3abedb50b 100644 --- a/qmake/generators/unix/unixmake2.cpp +++ b/qmake/generators/unix/unixmake2.cpp @@ -1225,6 +1225,8 @@ void UnixMakefileGenerator::init2() else ar_cmd.append("$(AR) $(TARGETA) $(OBJECTS)"); if (!project->isEmpty("QMAKE_BUNDLE")) { + project->values("PRL_TARGET").prepend( + project->first("QMAKE_BUNDLE") + Option::dir_sep + project->first("TARGET")); ProString bundle_loc = project->first("QMAKE_BUNDLE_LOCATION"); if(!bundle_loc.isEmpty() && !bundle_loc.startsWith("/")) bundle_loc.prepend("/"); -- cgit v1.2.3 From 35069301f048eed21a27f89b6495d56c44f2b55d Mon Sep 17 00:00:00 2001 From: Andre de la Rocha Date: Tue, 30 Oct 2018 17:58:17 +0100 Subject: Windows QPA: Fix incorrect button state reporting for touchpad The current state of (emulated) mouse buttons was being incorrectly reported for touchpad events under some conditions. In the handling of pointer messages, GetAsyncKeyState() was being used to retrieve the mouse button state. However, it does not seem to work always with all touchpads. Furthermore, its use is not necessary, since the button state information comes as a set of flags with the pointer message itself. This change makes the handler use these flags instead. Fixes: QTBUG-71470 Change-Id: Ie2e35bd80778ef74db672604a0f2af659785efbf Reviewed-by: Friedemann Kleint --- .../platforms/windows/qwindowspointerhandler.cpp | 53 ++++++++++++++-------- .../platforms/windows/qwindowspointerhandler.h | 1 - 2 files changed, 34 insertions(+), 20 deletions(-) diff --git a/src/plugins/platforms/windows/qwindowspointerhandler.cpp b/src/plugins/platforms/windows/qwindowspointerhandler.cpp index 2b6c696979..4d3e2f71ec 100644 --- a/src/plugins/platforms/windows/qwindowspointerhandler.cpp +++ b/src/plugins/platforms/windows/qwindowspointerhandler.cpp @@ -336,6 +336,38 @@ static void getMouseEventInfo(UINT message, POINTER_BUTTON_CHANGE_TYPE changeTyp *mouseButton = buttonMapping.value(changeType, Qt::NoButton); } +static Qt::MouseButtons mouseButtonsFromPointerFlags(POINTER_FLAGS pointerFlags) +{ + Qt::MouseButtons result = Qt::NoButton; + if (pointerFlags & POINTER_FLAG_FIRSTBUTTON) + result |= Qt::LeftButton; + if (pointerFlags & POINTER_FLAG_SECONDBUTTON) + result |= Qt::RightButton; + if (pointerFlags & POINTER_FLAG_THIRDBUTTON) + result |= Qt::MiddleButton; + if (pointerFlags & POINTER_FLAG_FOURTHBUTTON) + result |= Qt::XButton1; + if (pointerFlags & POINTER_FLAG_FIFTHBUTTON) + result |= Qt::XButton2; + return result; +} + +static Qt::MouseButtons mouseButtonsFromKeyState(WPARAM keyState) +{ + Qt::MouseButtons result = Qt::NoButton; + if (keyState & MK_LBUTTON) + result |= Qt::LeftButton; + if (keyState & MK_RBUTTON) + result |= Qt::RightButton; + if (keyState & MK_MBUTTON) + result |= Qt::MiddleButton; + if (keyState & MK_XBUTTON1) + result |= Qt::XButton1; + if (keyState & MK_XBUTTON2) + result |= Qt::XButton2; + return result; +} + static QWindow *getWindowUnderPointer(QWindow *window, QPoint globalPos) { QWindow *currentWindowUnderPointer = QWindowsScreen::windowAt(globalPos, CWP_SKIPINVISIBLE | CWP_SKIPTRANSPARENT); @@ -405,23 +437,6 @@ QTouchDevice *QWindowsPointerHandler::ensureTouchDevice() return m_touchDevice; } -Qt::MouseButtons QWindowsPointerHandler::queryMouseButtons() -{ - Qt::MouseButtons result = 0; - const bool mouseSwapped = GetSystemMetrics(SM_SWAPBUTTON); - if (GetAsyncKeyState(VK_LBUTTON) < 0) - result |= mouseSwapped ? Qt::RightButton: Qt::LeftButton; - if (GetAsyncKeyState(VK_RBUTTON) < 0) - result |= mouseSwapped ? Qt::LeftButton : Qt::RightButton; - if (GetAsyncKeyState(VK_MBUTTON) < 0) - result |= Qt::MidButton; - if (GetAsyncKeyState(VK_XBUTTON1) < 0) - result |= Qt::XButton1; - if (GetAsyncKeyState(VK_XBUTTON2) < 0) - result |= Qt::XButton2; - return result; -} - bool QWindowsPointerHandler::translateMouseTouchPadEvent(QWindow *window, HWND hwnd, QtWindows::WindowsEventType et, MSG msg, PVOID vPointerInfo) @@ -430,7 +445,7 @@ bool QWindowsPointerHandler::translateMouseTouchPadEvent(QWindow *window, HWND h const QPoint globalPos = QPoint(pointerInfo->ptPixelLocation.x, pointerInfo->ptPixelLocation.y); const QPoint localPos = QWindowsGeometryHint::mapFromGlobal(hwnd, globalPos); const Qt::KeyboardModifiers keyModifiers = QWindowsKeyMapper::queryKeyboardModifiers(); - const Qt::MouseButtons mouseButtons = queryMouseButtons(); + const Qt::MouseButtons mouseButtons = mouseButtonsFromPointerFlags(pointerInfo->pointerFlags); QWindow *currentWindowUnderPointer = getWindowUnderPointer(window, globalPos); QWindowsWindow *platformWindow = static_cast(window->handle()); @@ -788,7 +803,7 @@ bool QWindowsPointerHandler::translateMouseEvent(QWindow *window, HWND hwnd, QtW m_windowUnderPointer = currentWindowUnderPointer; } - const Qt::MouseButtons mouseButtons = queryMouseButtons(); + const Qt::MouseButtons mouseButtons = mouseButtonsFromKeyState(msg.wParam); if (!discardEvent) QWindowSystemInterface::handleMouseEvent(window, localPos, globalPos, mouseButtons, Qt::NoButton, QEvent::MouseMove, diff --git a/src/plugins/platforms/windows/qwindowspointerhandler.h b/src/plugins/platforms/windows/qwindowspointerhandler.h index c4d0e0ce4a..3861ebf919 100644 --- a/src/plugins/platforms/windows/qwindowspointerhandler.h +++ b/src/plugins/platforms/windows/qwindowspointerhandler.h @@ -61,7 +61,6 @@ public: bool translateMouseEvent(QWindow *window, HWND hwnd, QtWindows::WindowsEventType et, MSG msg, LRESULT *result); QTouchDevice *touchDevice() const { return m_touchDevice; } QTouchDevice *ensureTouchDevice(); - Qt::MouseButtons queryMouseButtons(); QWindow *windowUnderMouse() const { return m_windowUnderPointer.data(); } void clearWindowUnderMouse() { m_windowUnderPointer = nullptr; } -- cgit v1.2.3 From d0e66df1a561cfe3f43879f37a7a3b5a477bd3f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Thu, 8 Nov 2018 15:22:00 +0100 Subject: macOS: Skip tst_QGLThreads::renderInThread MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It crashes in the render thread: thread #7, name = 'SceneRenderingThread' frame #0: libsystem_kernel.dylib`__wait4_nocancel + 10 frame #1: libsystem_c.dylib`system + 452 frame #2: QtTest`stackTrace() + 325 frame #3: QtTest`QTest::FatalSignalHandler::signal(int) + 207 frame #4: libsystem_platform.dylib`_sigtramp + 26 frame #5: libsystem_platform.dylib`_platform_bzero$VARIANT$Base + 23 frame #6: GLRendererFloat`gldSetZero + 63 frame #7: GLRendererFloat`gldClearDrawBuffer + 3792 frame #8: GLRendererFloat`gldClearFramebufferData + 49 frame #9: GLEngine`glClear_Exec + 541 frame #10: tst_qglthreads`SceneRenderingThread::run() + 227 Task-number: QTBUG-68524 Change-Id: I6bc67cb342f77dc1a590a25af535f9bb7f0d325a Reviewed-by: Morten Johan Sørvig --- tests/auto/opengl/qglthreads/tst_qglthreads.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/auto/opengl/qglthreads/tst_qglthreads.cpp b/tests/auto/opengl/qglthreads/tst_qglthreads.cpp index 09bea20d26..b7b5b505a0 100644 --- a/tests/auto/opengl/qglthreads/tst_qglthreads.cpp +++ b/tests/auto/opengl/qglthreads/tst_qglthreads.cpp @@ -355,6 +355,11 @@ void tst_QGLThreads::renderInThread() QFETCH(bool, resize); QFETCH(bool, update); +#if defined(Q_OS_MACOS) + if (resize) + QSKIP("gldSetZero crashes in render thread, QTBUG-68524"); +#endif + ThreadSafeGLWidget widget; widget.resize(200, 200); SceneRenderingThread thread(&widget); -- cgit v1.2.3 From 2697148775703883ae700b15d4efe240050273a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Mon, 22 Oct 2018 13:04:42 +0200 Subject: macOS: Only enable layer-backed views on 10.14 if built against 10.14 SDK MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Instead of explicitly enabling layer-backing for Qt 5.12 on all macOS version, we follow the macOS default to enable it for 10.14 if the application binary was built against the 10.14 SDK. Aligning ourselves with Apple's switch to forced layer-backing means we have an easier story when it comes to supporting different runtime configurations. Fixes: QTBUG-71499 Change-Id: I34ee49b3daeb6ed8df444a3759d3573ebc9ea30f Reviewed-by: Tor Arne Vestbø --- src/plugins/platforms/cocoa/qnsview.mm | 15 +------ src/plugins/platforms/cocoa/qnsview_drawing.mm | 61 +++++++++++++++++++++----- 2 files changed, 53 insertions(+), 23 deletions(-) diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm index 9bd53ed334..540f701d43 100644 --- a/src/plugins/platforms/cocoa/qnsview.mm +++ b/src/plugins/platforms/cocoa/qnsview.mm @@ -71,7 +71,7 @@ @end @interface QT_MANGLE_NAMESPACE(QNSView) (Drawing) -- (BOOL)wantsLayerHelper; +- (void)initDrawing; @end @interface QT_MANGLE_NAMESPACE(QNSViewMouseMoveHelper) : NSObject @@ -152,19 +152,8 @@ self.focusRingType = NSFocusRingTypeNone; self.cursor = nil; - self.wantsLayer = [self wantsLayerHelper]; - - // Enable high-DPI OpenGL for retina displays. Enabling has the side - // effect that Cocoa will start calling glViewport(0, 0, width, height), - // overriding any glViewport calls in application code. This is usually not a - // problem, except if the application wants to have a "custom" viewport. - // (like the hellogl example) - if (m_platformWindow->window()->supportsOpenGL()) { - self.wantsBestResolutionOpenGLSurface = qt_mac_resolveOption(YES, m_platformWindow->window(), - "_q_mac_wantsBestResolutionOpenGLSurface", "QT_MAC_WANTS_BEST_RESOLUTION_OPENGL_SURFACE"); - // See also QCocoaGLContext::makeCurrent for software renderer workarounds. - } + [self initDrawing]; [self registerDragTypes]; [[NSNotificationCenter defaultCenter] addObserver:self diff --git a/src/plugins/platforms/cocoa/qnsview_drawing.mm b/src/plugins/platforms/cocoa/qnsview_drawing.mm index 4f9d17504d..e9af90a45c 100644 --- a/src/plugins/platforms/cocoa/qnsview_drawing.mm +++ b/src/plugins/platforms/cocoa/qnsview_drawing.mm @@ -41,6 +41,24 @@ @implementation QT_MANGLE_NAMESPACE(QNSView) (Drawing) +- (void)initDrawing +{ + self.wantsLayer = [self layerExplicitlyRequested] + || [self shouldUseMetalLayer] + || [self layerEnabledByMacOS]; + + // Enable high-DPI OpenGL for retina displays. Enabling has the side + // effect that Cocoa will start calling glViewport(0, 0, width, height), + // overriding any glViewport calls in application code. This is usually not a + // problem, except if the application wants to have a "custom" viewport. + // (like the hellogl example) + if (m_platformWindow->window()->supportsOpenGL()) { + self.wantsBestResolutionOpenGLSurface = qt_mac_resolveOption(YES, m_platformWindow->window(), + "_q_mac_wantsBestResolutionOpenGLSurface", "QT_MAC_WANTS_BEST_RESOLUTION_OPENGL_SURFACE"); + // See also QCocoaGLContext::makeCurrent for software renderer workarounds. + } +} + - (BOOL)isOpaque { if (!m_platformWindow) @@ -71,23 +89,38 @@ m_platformWindow->handleExposeEvent(exposedRegion); } -- (BOOL)shouldUseMetalLayer +- (BOOL)layerEnabledByMacOS { - // MetalSurface needs a layer, and so does VulkanSurface (via MoltenVK) - QSurface::SurfaceType surfaceType = m_platformWindow->window()->surfaceType(); - return surfaceType == QWindow::MetalSurface || surfaceType == QWindow::VulkanSurface; + // AppKit has its own logic for this, but if we rely on that, our layers are created + // by AppKit at a point where we've already set up other parts of the platform plugin + // based on the presence of layers or not. Once we've rewritten these parts to support + // dynamically picking up layer enablement we can let AppKit do its thing. + return QMacVersion::buildSDK() >= QOperatingSystemVersion::MacOSMojave + && QMacVersion::currentRuntime() >= QOperatingSystemVersion::MacOSMojave; } -- (BOOL)wantsLayerHelper +- (BOOL)layerExplicitlyRequested { - Q_ASSERT(m_platformWindow); + static bool wantsLayer = [&]() { + int wantsLayer = qt_mac_resolveOption(-1, m_platformWindow->window(), + "_q_mac_wantsLayer", "QT_MAC_WANTS_LAYER"); - bool wantsLayer = qt_mac_resolveOption(true, m_platformWindow->window(), - "_q_mac_wantsLayer", "QT_MAC_WANTS_LAYER"); + if (wantsLayer != -1 && [self layerEnabledByMacOS]) { + qCWarning(lcQpaDrawing) << "Layer-backing can not be explicitly controlled on 10.14 when built against the 10.14 SDK"; + return true; + } - bool layerForSurfaceType = [self shouldUseMetalLayer]; + return wantsLayer == 1; + }(); - return wantsLayer || layerForSurfaceType; + return wantsLayer; +} + +- (BOOL)shouldUseMetalLayer +{ + // MetalSurface needs a layer, and so does VulkanSurface (via MoltenVK) + QSurface::SurfaceType surfaceType = m_platformWindow->window()->surfaceType(); + return surfaceType == QWindow::MetalSurface || surfaceType == QWindow::VulkanSurface; } - (CALayer *)makeBackingLayer @@ -115,6 +148,14 @@ return [super makeBackingLayer]; } +- (void)setLayer:(CALayer *)layer +{ + qCDebug(lcQpaDrawing) << "Making" << self << "layer-backed with" << layer + << "due to being" << ([self layerExplicitlyRequested] ? "explicitly requested" + : [self shouldUseMetalLayer] ? "needed by surface type" : "enabled by macOS"); + [super setLayer:layer]; +} + - (NSViewLayerContentsRedrawPolicy)layerContentsRedrawPolicy { // We need to set this explicitly since the super implementation -- cgit v1.2.3 From 1b0080a456871a52ac9b11ed8c9685b93bf20723 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Tue, 30 Oct 2018 13:07:34 +0100 Subject: Fix no-opengl developer builds Change-Id: I0c8fb7d0aa9a0d95a13447315bd8c1104089fed1 Reviewed-by: Friedemann Kleint Reviewed-by: Andy Nichols Reviewed-by: Laszlo Agocs --- src/plugins/platforms/eglfs/api/qeglfsintegration.cpp | 1 + src/plugins/platforms/eglfs/api/qeglfsscreen.cpp | 10 +++++++++- src/plugins/platforms/minimalegl/qminimaleglintegration.cpp | 1 + 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/eglfs/api/qeglfsintegration.cpp b/src/plugins/platforms/eglfs/api/qeglfsintegration.cpp index 43f2e31a49..72420199e3 100644 --- a/src/plugins/platforms/eglfs/api/qeglfsintegration.cpp +++ b/src/plugins/platforms/eglfs/api/qeglfsintegration.cpp @@ -198,6 +198,7 @@ QPlatformBackingStore *QEglFSIntegration::createPlatformBackingStore(QWindow *wi static_cast(window->handle())->setBackingStore(bs); return bs; #else + Q_UNUSED(window); return nullptr; #endif } diff --git a/src/plugins/platforms/eglfs/api/qeglfsscreen.cpp b/src/plugins/platforms/eglfs/api/qeglfsscreen.cpp index d5c22b3d37..285dbd93d3 100644 --- a/src/plugins/platforms/eglfs/api/qeglfsscreen.cpp +++ b/src/plugins/platforms/eglfs/api/qeglfsscreen.cpp @@ -183,6 +183,8 @@ void QEglFSScreen::handleCursorMove(const QPoint &pos) if (enter && leave) QWindowSystemInterface::handleEnterLeaveEvent(enter, leave, enter->mapFromGlobal(pos), pos); +#else + Q_UNUSED(pos); #endif } @@ -231,7 +233,13 @@ QPixmap QEglFSScreen::grabWindow(WId wid, int x, int y, int width, int height) c return QPixmap::fromImage(img).copy(rect); } } -#endif // QT_NO_OPENGL +#else // QT_NO_OPENGL + Q_UNUSED(wid); + Q_UNUSED(x); + Q_UNUSED(y); + Q_UNUSED(width); + Q_UNUSED(height); +#endif return QPixmap(); } diff --git a/src/plugins/platforms/minimalegl/qminimaleglintegration.cpp b/src/plugins/platforms/minimalegl/qminimaleglintegration.cpp index 5d31af53d5..da58441d67 100644 --- a/src/plugins/platforms/minimalegl/qminimaleglintegration.cpp +++ b/src/plugins/platforms/minimalegl/qminimaleglintegration.cpp @@ -132,6 +132,7 @@ QPlatformBackingStore *QMinimalEglIntegration::createPlatformBackingStore(QWindo #ifndef QT_NO_OPENGL return new QMinimalEglBackingStore(window); #else + Q_UNUSED(window); return nullptr; #endif } -- cgit v1.2.3 From 1446cde812fc557de4e29db3d63c42a1030e5c1f Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Wed, 7 Nov 2018 21:14:01 +0100 Subject: Android: Make sure that the path is using / for separators When passing \ to Gradle it will strip these out, so by using / it ensures that it is able to find the Android SDK directory fine. Change-Id: I053f087438ade6c30d015abe00e9958beb90a947 Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/tools/androiddeployqt/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tools/androiddeployqt/main.cpp b/src/tools/androiddeployqt/main.cpp index 3b78d2487f..11213872f3 100644 --- a/src/tools/androiddeployqt/main.cpp +++ b/src/tools/androiddeployqt/main.cpp @@ -707,7 +707,7 @@ bool readInputFile(Options *options) return false; } - options->sdkPath = sdkPath.toString(); + options->sdkPath = QDir::fromNativeSeparators(sdkPath.toString()); if (options->androidPlatform.isEmpty()) { options->androidPlatform = detectLatestAndroidPlatform(options->sdkPath); -- cgit v1.2.3 From ee3c66ca917b77f759acea7c6b27d15066f0b814 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Mon, 12 Nov 2018 15:29:33 +0100 Subject: macOS: Disable threaded GL rendering on SDK 10.14+ AppKit expects rendering to happen on the main thread, or at least any interaction with AppKit UI classes such as NSView. Our OpenGL helpers, such as QOpenGLContext, do not enforce this, and we may end up calling into AppKit UI classes on the render thread, deadlocking the application. Until this can be investigated and new APIs possibly introduced that allow a more fine grained control in our own classes, we disable threaded GL as a capability of the platform, which will inform clients such as QtQuick to use the basic render loop. [ChangeLog][macOS] Threaded OpenGL usage has been disabled when building using Xcode 10/SDK 10.14 and later. Qt Quick defaults to the 'basic' render loop now on macOS. Task-number: QTBUG-71731 Change-Id: I6fc3295e833ecd48ad49382b8275c762fa7978a6 Reviewed-by: Laszlo Agocs Reviewed-by: Allan Sandfeld Jensen Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/plugins/platforms/cocoa/qcocoaintegration.mm | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/cocoa/qcocoaintegration.mm b/src/plugins/platforms/cocoa/qcocoaintegration.mm index 936fecf8de..1bd1029863 100644 --- a/src/plugins/platforms/cocoa/qcocoaintegration.mm +++ b/src/plugins/platforms/cocoa/qcocoaintegration.mm @@ -340,12 +340,17 @@ QCocoaScreen *QCocoaIntegration::screenForNSScreen(NSScreen *nsScreen) bool QCocoaIntegration::hasCapability(QPlatformIntegration::Capability cap) const { switch (cap) { - case ThreadedPixmaps: #ifndef QT_NO_OPENGL - case OpenGL: case ThreadedOpenGL: + // AppKit expects rendering to happen on the main thread, and we can + // easily end up in situations where rendering on secondary threads + // will result in visual artifacts, bugs, or even deadlocks, when + // building with SDK 10.14 or higher which enbles view layer-backing. + return QMacVersion::buildSDK() < QOperatingSystemVersion(QOperatingSystemVersion::MacOSMojave); + case OpenGL: case BufferQueueingOpenGL: #endif + case ThreadedPixmaps: case WindowMasks: case MultipleWindows: case ForeignWindows: -- cgit v1.2.3 From 299734c3ee96055f72557cf8c25221bab5ce1a11 Mon Sep 17 00:00:00 2001 From: Oliver Wolff Date: Mon, 5 Nov 2018 11:16:28 +0100 Subject: Revert "Revert "qmake: Work around MSVC compiler bug."" The assert still happens on MSVC 2015 64 bit when running qmake -tp vc -r. This reverts commit f4169a633b97b7b6e7365172cf3d38d2f16a8914. Fixes: QTBUG-71228 Change-Id: I05bd3e0677414edb970f07e0555cdc95ce32f592 Reviewed-by: Friedemann Kleint (cherry picked from commit 4be8168ff7fe8c871a7f3cd7dce8fa4f70e1a6cf) Reviewed-by: Joerg Bornemann --- qmake/generators/win32/msvc_vcproj.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/qmake/generators/win32/msvc_vcproj.cpp b/qmake/generators/win32/msvc_vcproj.cpp index f7837fc1b4..95c16661e7 100644 --- a/qmake/generators/win32/msvc_vcproj.cpp +++ b/qmake/generators/win32/msvc_vcproj.cpp @@ -208,6 +208,16 @@ struct VcsolutionDepend { QStringList dependencies; }; +/* Disable optimization in getProjectUUID() due to a compiler + * bug in MSVC 2015 that causes ASSERT: "&other != this" in the QString + * copy constructor for non-empty file names at: + * filename.isEmpty()?project->first("QMAKE_MAKEFILE"):filename */ + +#if defined(Q_CC_MSVC) && !defined(Q_CC_CLANG) +# pragma optimize( "g", off ) +# pragma warning ( disable : 4748 ) +#endif + QUuid VcprojGenerator::getProjectUUID(const QString &filename) { bool validUUID = true; @@ -239,6 +249,10 @@ QUuid VcprojGenerator::getProjectUUID(const QString &filename) return uuid; } +#if defined(Q_CC_MSVC) && !defined(Q_CC_CLANG) +# pragma optimize( "g", on ) +#endif + QUuid VcprojGenerator::increaseUUID(const QUuid &id) { QUuid result(id); -- cgit v1.2.3 From 98a445fa23e7943f25d2de2f1fb36c104d5d7fda Mon Sep 17 00:00:00 2001 From: Antti Kokko Date: Wed, 31 Oct 2018 11:13:12 +0200 Subject: Add changes file for Qt 5.12.0 Edited-by: Thiago Macieira Change-Id: I65a59400c802db282fdbd87b1b9b89e9e5e962f6 Reviewed-by: Shawn Rutledge Reviewed-by: Edward Welbourne Reviewed-by: Tuukka Turunen Reviewed-by: Thiago Macieira --- dist/changes-5.12.0 | 470 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 470 insertions(+) create mode 100644 dist/changes-5.12.0 diff --git a/dist/changes-5.12.0 b/dist/changes-5.12.0 new file mode 100644 index 0000000000..fbed338b46 --- /dev/null +++ b/dist/changes-5.12.0 @@ -0,0 +1,470 @@ +Qt 5.12 introduces many new features and improvements as well as bugfixes +over the 5.11.x series. For more details, refer to the online documentation +included in this distribution. The documentation is also available online: + +https://doc.qt.io/qt-5/index.html + +The Qt version 5.12 series is binary compatible with the 5.11.x series. +Applications compiled for 5.11 will continue to run with 5.12. + +Some of the changes listed in this file include issue tracking numbers +corresponding to tasks in the Qt Bug Tracker: + +https://bugreports.qt.io/ + +Each of these identifiers can be entered in the bug tracker to obtain more +information about a particular change. + +**************************************************************************** +* Important Behavior Changes * +**************************************************************************** + + - QtCore: + * [QTBUG-34460] qFatal() no longer uses std::abort() on Windows, as + there are circumstances where global destructors are still run after + that call, leading to possible deadlocks. + - QRegularExpression: + * [QTBUG-66781] Regular expressions are now automatically optimized + (including JIT compiling) on their first usage. The pattern options + OptimizeOnFirstUsageOption and DontAutomaticallyOptimizeOption no + longer have any effect, and will get removed in a future version of + Qt. QRegularExpression::optimize() can be still used to compile and + optimize the regular expression in advance (before any match), if + needed. + - QDataStream: + * [QTBUG-59978][QTBUG-67995] version bumped up to 18 to account for + changes in the serialization of QGradient. + - Dialogs: + * QFileSystemModel now uses QRegularExpression internally for wildcard + matching. Note that QRegularExpression might not give the exact same + result as QRegExp as its implementation follows strictly the glob + patterns definition for wildcard expressions. + +**************************************************************************** +* Third-Party Code * +**************************************************************************** + + - Sources of xcb-xinput 1.13 were bundled and are available via -qt-xcb. + - The minimal required version of libxcb is now 1.9. Bundled xcb sources + were updated to libxcb 1.9.1 built with xcb-proto 1.8. + - [QTBUG-67654] Updated CLDR to version 33.1 + - [QTBUG-66561][QTBUG-70008] double-conversion got updated to upstream + version 3.1.1. + - libjpeg-turbo was updated to version 2.0.0 + - libpng was updated to version 1.6.35 + - Sqlite was updated to version 3.25.2 + - [QTBUG-71109] updated bundled libxkbcommon 0.4.1 -> 0.8.2 (up to + 31f1f355700870c6615399fbfa7934934b3a9a57) + - PCRE2 was updated to version 10.32. + - Added documentation for the SLJIT part of pcre2, which is available + under the BSD-2-Clause license. + +**************************************************************************** +* Tools * +**************************************************************************** + + - rcc: + * Added a --list-mapping option which shows a mapping of resource paths + to file system paths. + + - qmake + * New CONFIG options lrelease and embed_translations were added. + CONFIG+=lrelease does run lrelease on translation files listed in + TRANSLATIONS and EXTRA_TRANSLATIONS. CONFIG+=embed_translations does + include the generated .qm files as resources under :/i18n/. + + - uic + * [QTBUG-65251][QTBUG-51602] The -no-stringliteral option is now + deprecated and UIC will not generate QStringLiteral anymore. + +**************************************************************************** +* QtCore * +**************************************************************************** + + - Added support for CBOR: + * Added QCborStreamReader and QCborStreamWriter, classes for low-level + reading and writing of CBOR streams. + * Added QCborValue, QCborArray and QCborMap, classes that permit DOM-like + access to CBOR data. The API is similar to QJsonValue, QJsonArray and + QJsonObject, respectively. + + - QByteArray: + * Added QByteArray::isUpper() and QByteArray::isLower() to check if a + byte array contains only uppercase or only lowercase Latin1 letters. + * Added compare(), which takes Qt::CaseSensitivity as one of the + parameters. This function is more efficient than using toLower() or + toUpper() and then comparing. + * [QTBUG-66187] QByteArray::toInt(), QByteArray::toDouble() and the + other number conversion functions now ignore leading and trailing + whitespaces, as their QString counterparts already did. For + consistency reasons, the same behavior was added to + qEnvironmentVariableIntValue() also. + + - QCommandLineParser: + * [QTBUG-70174] Fixed a bug that caused the help output to show two + options or more in the same line if the options didn't have a + description. + + - QCryptographicHash: + * Add a static method, hashLength, which returns the length of the + output of a hash function in bytes. + + - QDir: + * QDir now uses QRegularExpression internally for wildcard matching. + Note that QRegularExpression might not give the exact same result as + QRegExp as its implementation follows strictly the glob patterns + definition for wildcard expressions. Nevertheless, the tests for QDir + return the same results as before. + * QDir::tempPath() now reports the canonical path of the temporary + directory, with any symlinks resolved. + * On Windows, QDir::drives() no longer returns drives whose media were + ejected. + + - QExplicitlySharedDataPointer: + * [QTBUG-66635][QTBUG-66946] Added operator== for nullptr. + + - QFile: + * [QTBUG-13470] When opening a file, if Truncate is asked for, or + implied by other flags, it shall be attempted, regardless of what + other options are selected. We previously did this on Windows; now we + do so also on Unix (even when appending). + + - QFileSystemWatcher: + * [QTBUG-69320] Fixed a bug that caused addPaths() to crash on Windows + if adding a path to be watched on removable storage, if that + addPaths() was called on a thread not created by QThread and no + QEventLoop has been created yet. + + - QFlags's operator| for enum types in the Qt namespace are now declared + in the Qt namespace itself. + + - QLocale: + * [QTBUG-57802] Added support for World and Europe as (numeric) + "country" codes ("territory" in CLDR terms), thereby enabling support + for Yiddish and Esperanto, among other locales using such codes. + + - Logging: + * [QTBUG-69548] Qt will now accept qtlogging.ini files written by + QSettings. + + - QMetaType can now register constructor for a set of dynamic types. + + - QRegularExpression: + * Implemented support for wildcard patterns through a static method. + * QRegularExpression now provides anchoredPattern() which is a helper + function to build regular expressions used for exact matching. + * Implemented support for wildcard patterns. Warning: QRegularExpression + might not give the exact same result as QRegExp as its implementation + follows strictly the glob patterns definition for the wildcard + expressions. + + - [QTBUG-62894] Introduced QScopeGuard. + + - QSharedDataPointer: + * [QTBUG-66635][QTBUG-66946] Added operator== for nullptr. + + - QSortFilterProxyModel: + * [QTBUG-46810] QSortFilterProxyModel now supports QRegularExpression. + * Setters of both the filterRegExp and filterRegularExpression + properties are now slots and can be used with the old as well as the + new syntax. + + - QString: + * Added the functions QString::isUpper() and QString::isLower() to check + if a string contains only uppercase or only lowercase letters. + + - QTextCodec: + * [QTBUG-56203] QTextCodec automatically deregisters on destruction now. + + - QTimer: + * [QTBUG-69800] Fixed singleShot() methods that lacked proper "const" + qualification to QObject context receivers. + * Added QTimer::connectTo(), a shorthand way of connecting to the + timeout() signal. + + - QTranslator: + * [QTBUG-31031] It is now possible to load qm files without any + translations. This is particularly useful for the language the + untranslated strings are written in; logic to load translations can + now handle the source language like all other languages. + + - QUndoStack: + * [QTBUG-40040] Exposed canUndo, canRedo, undoText, redoText and clean as + Q_PROPERTYs. + + - QUrl: + * Fixed a bug that caused QUrl::matches to incorrectly compare two URLs + with different hostnames or different usernames as equal, if certain + QUrl::RemoveXxx options were passed. + + - other: + * Added an overload of q{To,From}{Big,Little}Endian that operates on a + memory region. + * Added the QT_TR_N_NOOP(), QT_TRANSLATE_N_NOOP(), and + QT_TRANSLATE_N_NOOP3() macros for numeral dependent delayed + translation. + +**************************************************************************** +* QtGui * +**************************************************************************** + + - QBitmap: + * Added overloaded QBitmap::fromImage that takes QImage rvalue. + + - QDocumentWriter: + * [QTBUG-63581] QDocumentWriter now supports table borders, table + alignment, table width, column widths, line height and image + resolution when exporting QTextDocuments to ODF files. + + - QGradient: + * [QTBUG-59978][QTBUG-67995] Added ObjectMode coordinate mode. + + - QGuiApplication: + * [QTBUG-26413] Fixed queryKeyboardModifiers() on macOS to actually return + the current modifier key state. + + - QImage: + * [QTBUG-45858] QImage now supports 64bit image formats with 16 bits per + color channel, compatible with 16bpc PNG or RGBA16 OpenGL formats. + + - QIntValidator: + * [QTBUG-59650] Input value with over the highest acceptable value, but + with no more digits than the maximum value, is now considered + intermediate. + + - QOpenGLShader: + * [QTBUG-66074] QOpenGLShader has been fixed to expose geometry and + tessellation evaluation/control shaders with OpenGL ES 3.2. + + - QPagedPaintDevice: + * The default constructor has been deprecated since that class is + not meant to be used standalone. The two public but internal + devicePageLayout() methods are now deprecated. + + - QPainter: + * [QTBUG-67248] Fixed drawTiledPixmap() and texture-brush painting with + high-DPR images. + * QPainter::drawTiledPixmap() now tiles in the device independent + coordinate system. + + - QPicture: + * [QTBUG-71208] Fixed a crash reading malformed picture file. + + - QStandardItemModel: + * itemData does not return role 255 any more. + + - QTextImageFormat: + * Added two new functions to the class: setQuality(int=100) and + quality(). They are currently used by QTextODFWriter to determine the + image type and quality when exporting images to ODT files. + + - Text: + * [QTBUG-57479] Non-breaking spaces are now displayed as a degree symbol + when QTextOption::ShowTabsAndSpaces is used. + * [QTBUG-69085] Fixed position of text cursor set by clicking outside + the bounds of a text line that ends with a surrogate pair or ligature. + * [QTBUG-70293] Fixed a crash that can happen when calling a setter on a + QTextCursor after its QTextDocument has been deleted. + +**************************************************************************** +* QtNetwork * +**************************************************************************** + + - Added DTLS over UDP support. + + - QPasswordDigestor: + * [QTBUG-30550] Added QPasswordDigestor + + - QSslKey: + * [QTBUG-17718] The OpenSSL backend can now load encrypted PKCS#8 + DER-encoded keys. + * [QTBUG-59068] Added support for PKCS#8-encoded keys in the generic SSL + back-end (used for SecureTransport on macOS and for WinRT). Note that + it does not support keys encrypted with a PKCS#12 algorithm. + + - QSslSocket: + * Enabled ALPN (and thus HTTP/2 negotiation) in SecureTransport backend + (macOS). + * [QTBUG-69420] Implemented renegotiation for SecureTransport backend. + + - SSL: + * The OpenSSL 1.1 backend also works with OpenSSL 1.1.1 (and thus can + negotiate TLS 1.3). + * [QTBUG-68156] OpenSSL >= 1.0 is now required to build Qt with OpenSSL + support. + +**************************************************************************** +* QtSql * +**************************************************************************** + + - MySQL: + * Now supports MySQL versions >= 8.0.1. + * [QTBUG-57028] The TIME data type is now treated like a string-based + type in order to respect the full range of the TIME data type. + +**************************************************************************** +* QtTest * +**************************************************************************** + + - QCOMPARE: + * Now outputs contents of std::tuple on failure. + * [QTBUG-65845] QtTest now prints values of QFlags that failed to compare. + +**************************************************************************** +* QtWidgets * +**************************************************************************** + + - Itemviews: + * [QTBUG-12129][QTBUG-14949][QTBUG-57891] Fixed eliding of multi-line + items. + + - QAbstractSpinBox: + * [QTBUG-67380] The Qt::ControlModifier now increases the number of steps a + QAbstractSpinBox takes for the following interactions: scrolling, up/down + keyboard keys and the spin box buttons. Previously, Qt::ControlModifier + only affected scrolling. + + - QApplication: + * [QTBUG-67736] QApplication no longer sends a mouse move event to the + entered widget if it sends synthetic enter and leave events. + + - QHeaderView: + * [QTBUG-23203] Padding/margin is now taken into account when the text gets + elided. + * [QTBUG-59501] The qss padding attribute is now honored in all cases. + * [QTBUG-62091] The size of the decoration is now taken into account in + paintSection(). + * [QTBUG-65017] The drag'n'drop indicator is now using the correct font. + * [QTBUG-69431] setDefaultSectionSize() now checks if the given value is + inside min/max section size. + * [QTBUG-70084] The section indicator is now high-DPI-aware. + + - QItemDelegate: + * [QTBUG-16134] Fixed text height calculation when the item has a + decoration or checkbox. + + - QLineEdit: + * [QTBUG-44046] The textEdited() signal is now emitted even if the + QValidator has changed the user input. + * [QTBUG-57448] Added inputRejected() signal for when a key press is not + accepted by the QLineEdit. For instance, when an invalid key is + pressed for a validator set. + + - QListView: + * [QTBUG-27110] The pseudo states :first/:middle/:last are now respected. + * [QTBUG-56606] Added itemAlignment property. + * [QTBUG-67440] Fixed a bug that caused items on internal move to be + deleted. + + - QMenu: + * [QTBUG-69199] Removed icon highlight when a stylesheet was applied by + the application. + + - QMessageBox: + * [QTBUG-35545] On Android and iOS it's now possible to show a + QMessageBox with custom buttons as a native dialog. + + - QSpinBox/QDoubleSpinBox: + * Added an option for adaptive decimal step size. + + - QSplashScreen: + * [QTBUG-43081] The alignment when the message is passed as HTML is now + correctly honored. + + - QStyle: + * QStyle::SH_SpinBox_StepModifier allows the developer to pick which + keyboard modifier increases the number of steps a QAbstractSpinBox + takes for the following interactions: scrolling, up/down keyboard keys + and the spin box buttons. The Qt::ShiftModifier can now be used, or + the feature can be disabled using Qt::NoModifier. Previously, only + Qt::ControlModifier could be used as the modifier. + + - QTabBar: + * [QTBUG-18146] Fixed mixed up CSS pseudo class for left and right. + + - QTableView: + * [QTBUG-48244][QTBUG-49548] Fixed calculating geometries for editors. + * [QTBUG-70215] Fixed PageUp not getting to top when first row is hidden. + + - QTableWidget: + * Fixed handling of Qt::EditRole and Qt::DisplayRole in setItemData(). + + - QTreeView: + * [QTBUG-39486] Sped up expanding items when pressing asterisk. + + - QWidget: + * [QTBUG-68393][QTBUG-69619][QTBUG-10907] Fixed several bugs that + incorrectly reordered tabs for compound widgets under some special + circumstances. + * [QTBUG-65199] enterEvent() and leaveEvent() now occur when a hovering + drawing tablet stylus enters or leaves a widget. + * Added the Qt::WA_StyleSheetTarget attribute to indicate that a widget + was affected by a style sheet. + +**************************************************************************** +* Android * +**************************************************************************** + + - Added Android edit context menu. + - Removed old debugging bridge. To be able to debug Qt on Android apps the + user must use QtCreator 4.6.1+. + - [QTBUG-63735] The system no longer restarts the application when the user + replaces SIM card or changes the logical density of the screen. + - [QTBUG-70280] ARM64 builds now default to android-21 instead of failing. + - [QTBUG-35545] QMessageBox now supports buttons with custom labels. + +**************************************************************************** +* Linux * +**************************************************************************** + + - QFileDialog will use the native dialogs provided by the platform theme + instead of trying to use Flatpak portal to select directories. + +**************************************************************************** +* macOS * +**************************************************************************** + + - Layer-backed mode is now the default for QWindow. + + - QtGui: + * [QTBUG-63800] Fixed display of condensed fonts when NoFontMerging is + in use. + + - Text: + * [QTBUG-69955] Fixed font weights on macOS 10.14. + +**************************************************************************** +* Windows * +**************************************************************************** + + - [QTBUG-55762] The dimensions of invisible margins inside the frames of + Windows 10 windows will now be disregarded in the positioning of Qt + windows to avoid a misplaced look (offset by a few pixels from the + expected position). + - [QTBUG-44964][QTBUG-60437] The application attributes + AA_CompressTabletEvents and AA_CompressHighFrequencyEvents are now + supported on Windows 8 and above for touch/pen input, with the same + defaults as on X11 (compress touch events, don't compress tablet events) + + - QTimeZone: + * [QTBUG-42021] Changed MS-Win to use ICU for time-zone data, when + available, in preference to MS's TZ APIs. The choice is made when + building Qt. This will give reliable results when non-DST transitions + arise, or when a zone's DST is not simple (e.g. interrupted by + Ramadan). + +**************************************************************************** +* winrt * +**************************************************************************** + + - Added support to Windows UI Automation to the WinRT QPA, allowing + Qt-based UWP applications to operate with accessibility and + programmatic UI control tools. + +**************************************************************************** +* X11 * +**************************************************************************** + + - [QTBUG-39624] The xcb plugin was ported to use libxcb-xinput instead of + libXi for XInput2 support. The -xinput2 configure option was replaced by + -xcb-xinput. -- cgit v1.2.3 From d9200fcac58a9347decd417c217c18b7e34471ec Mon Sep 17 00:00:00 2001 From: Andre de la Rocha Date: Tue, 13 Nov 2018 20:22:20 +0100 Subject: Windows QPA: Fix broken focus for native child windows This issue was caused by missing logic in the implementation of the pointer message handler, necessary to support "click to focus" for native child windows. Fixes: QTBUG-71352 Change-Id: I2e261caa8dfab096647799ec1e7d781bec40654e Reviewed-by: Friedemann Kleint --- src/plugins/platforms/windows/qwindowspointerhandler.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/plugins/platforms/windows/qwindowspointerhandler.cpp b/src/plugins/platforms/windows/qwindowspointerhandler.cpp index 4d3e2f71ec..3c7372958f 100644 --- a/src/plugins/platforms/windows/qwindowspointerhandler.cpp +++ b/src/plugins/platforms/windows/qwindowspointerhandler.cpp @@ -467,6 +467,11 @@ bool QWindowsPointerHandler::translateMouseTouchPadEvent(QWindow *window, HWND h keyModifiers, Qt::MouseEventNotSynthesized); return false; // To allow window dragging, etc. } else { + if (eventType == QEvent::MouseButtonPress) { + // Implement "Click to focus" for native child windows (unless it is a native widget window). + if (!window->isTopLevel() && !window->inherits("QWidgetWindow") && QGuiApplication::focusWindow() != window) + window->requestActivate(); + } if (currentWindowUnderPointer != m_windowUnderPointer) { if (m_windowUnderPointer && m_windowUnderPointer == m_currentWindow) { QWindowSystemInterface::handleLeaveEvent(m_windowUnderPointer); -- cgit v1.2.3 From ad2c7f588321f8c671cb9419f90a1e24887ed562 Mon Sep 17 00:00:00 2001 From: Andre de la Rocha Date: Wed, 14 Nov 2018 18:10:25 +0100 Subject: Windows QPA: Fix input context visibility status QWindowsInputContext::isInputPanelVisible() was ignoring the visibility status of the IME, only returning the status of the Win10 virtual keyboard. This issue caused qtwebengine to try to show the IME multiple times, breaking Asian languages input. Task-number: QTBUG-71753 Change-Id: Iaa4cef37b7dc98a9e0a787750a34d2e98a87a777 Reviewed-by: Allan Sandfeld Jensen Reviewed-by: Alexandru Croitor Reviewed-by: Friedemann Kleint --- src/plugins/platforms/windows/qwindowsinputcontext.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/windows/qwindowsinputcontext.cpp b/src/plugins/platforms/windows/qwindowsinputcontext.cpp index 30da0da1de..d1e99c037b 100644 --- a/src/plugins/platforms/windows/qwindowsinputcontext.cpp +++ b/src/plugins/platforms/windows/qwindowsinputcontext.cpp @@ -242,7 +242,18 @@ QRectF QWindowsInputContext::keyboardRect() const bool QWindowsInputContext::isInputPanelVisible() const { HWND hwnd = getVirtualKeyboardWindowHandle(); - return hwnd && ::IsWindowEnabled(hwnd) && ::IsWindowVisible(hwnd); + if (hwnd && ::IsWindowEnabled(hwnd) && ::IsWindowVisible(hwnd)) + return true; + // check if the Input Method Editor is open + if (inputMethodAccepted()) { + if (QWindow *window = QGuiApplication::focusWindow()) { + if (QWindowsWindow *platformWindow = QWindowsWindow::windowsWindowOf(window)) { + if (HIMC himc = ImmGetContext(platformWindow->handle())) + return ImmGetOpenStatus(himc); + } + } + } + return false; } void QWindowsInputContext::showInputPanel() -- cgit v1.2.3 From d804146ced28c61631ea054fdb792c096cffa5e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Wed, 14 Nov 2018 14:38:34 +0100 Subject: macOS: Remove incorrect statement about layer-backing in changelog MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Id31783227690445d06c21fcab40db1042d2fb33f Reviewed-by: Morten Johan Sørvig --- dist/changes-5.12.0 | 2 -- 1 file changed, 2 deletions(-) diff --git a/dist/changes-5.12.0 b/dist/changes-5.12.0 index fbed338b46..b5e664fc5a 100644 --- a/dist/changes-5.12.0 +++ b/dist/changes-5.12.0 @@ -424,8 +424,6 @@ information about a particular change. * macOS * **************************************************************************** - - Layer-backed mode is now the default for QWindow. - - QtGui: * [QTBUG-63800] Fixed display of condensed fonts when NoFontMerging is in use. -- cgit v1.2.3 From 16830c827b075c274f2f208fcc57c9f6174e9fcc Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Wed, 14 Nov 2018 12:09:51 +0100 Subject: Make sure QEventDispatcher::registerTimer() cleans up after itself MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The test needs to also unregister its timers when it fails. Therefore, wrap the registering and unregistering in an RAII class. Task-number: QTBUG-71773 Change-Id: I6ef44e580880deecb32763b5b0cd71e1c26929be Reviewed-by: Mårten Nordheim Reviewed-by: Edward Welbourne --- .../qeventdispatcher/tst_qeventdispatcher.cpp | 178 +++++++++++++++------ 1 file changed, 126 insertions(+), 52 deletions(-) diff --git a/tests/auto/corelib/kernel/qeventdispatcher/tst_qeventdispatcher.cpp b/tests/auto/corelib/kernel/qeventdispatcher/tst_qeventdispatcher.cpp index 5784f0728c..ca183752a5 100644 --- a/tests/auto/corelib/kernel/qeventdispatcher/tst_qeventdispatcher.cpp +++ b/tests/auto/corelib/kernel/qeventdispatcher/tst_qeventdispatcher.cpp @@ -92,77 +92,151 @@ void tst_QEventDispatcher::initTestCase() } } +class TimerManager { + Q_DISABLE_COPY(TimerManager) + +public: + TimerManager(QAbstractEventDispatcher *eventDispatcher, QObject *parent) + : m_eventDispatcher(eventDispatcher), m_parent(parent) + { + } + + ~TimerManager() + { + if (!registeredTimers().isEmpty()) + m_eventDispatcher->unregisterTimers(m_parent); + } + + TimerManager(TimerManager &&) = delete; + TimerManager &operator=(TimerManager &&) = delete; + + int preciseTimerId() const { return m_preciseTimerId; } + int coarseTimerId() const { return m_coarseTimerId; } + int veryCoarseTimerId() const { return m_veryCoarseTimerId; } + + bool foundPrecise() const { return m_preciseTimerId > 0; } + bool foundCoarse() const { return m_coarseTimerId > 0; } + bool foundVeryCoarse() const { return m_veryCoarseTimerId > 0; } + + QList registeredTimers() const + { + return m_eventDispatcher->registeredTimers(m_parent); + } + + void registerAll() + { + // start 3 timers, each with the different timer types and different intervals + m_preciseTimerId = m_eventDispatcher->registerTimer( + PreciseTimerInterval, Qt::PreciseTimer, m_parent); + m_coarseTimerId = m_eventDispatcher->registerTimer( + CoarseTimerInterval, Qt::CoarseTimer, m_parent); + m_veryCoarseTimerId = m_eventDispatcher->registerTimer( + VeryCoarseTimerInterval, Qt::VeryCoarseTimer, m_parent); + QVERIFY(m_preciseTimerId > 0); + QVERIFY(m_coarseTimerId > 0); + QVERIFY(m_veryCoarseTimerId > 0); + findTimers(); + } + + void unregister(int timerId) + { + m_eventDispatcher->unregisterTimer(timerId); + findTimers(); + } + + void unregisterAll() + { + m_eventDispatcher->unregisterTimers(m_parent); + findTimers(); + } + +private: + void findTimers() + { + bool foundPrecise = false; + bool foundCoarse = false; + bool foundVeryCoarse = false; + const QList timers = registeredTimers(); + for (int i = 0; i < timers.count(); ++i) { + const QAbstractEventDispatcher::TimerInfo &timerInfo = timers.at(i); + if (timerInfo.timerId == m_preciseTimerId) { + QCOMPARE(timerInfo.interval, int(PreciseTimerInterval)); + QCOMPARE(timerInfo.timerType, Qt::PreciseTimer); + foundPrecise = true; + } else if (timerInfo.timerId == m_coarseTimerId) { + QCOMPARE(timerInfo.interval, int(CoarseTimerInterval)); + QCOMPARE(timerInfo.timerType, Qt::CoarseTimer); + foundCoarse = true; + } else if (timerInfo.timerId == m_veryCoarseTimerId) { + QCOMPARE(timerInfo.interval, int(VeryCoarseTimerInterval)); + QCOMPARE(timerInfo.timerType, Qt::VeryCoarseTimer); + foundVeryCoarse = true; + } + } + if (!foundPrecise) + m_preciseTimerId = -1; + if (!foundCoarse) + m_coarseTimerId = -1; + if (!foundVeryCoarse) + m_veryCoarseTimerId = -1; + } + + QAbstractEventDispatcher *m_eventDispatcher = nullptr; + + int m_preciseTimerId = -1; + int m_coarseTimerId = -1; + int m_veryCoarseTimerId = -1; + + QObject *m_parent = nullptr; +}; + // test that the eventDispatcher's timer implementation is complete and working void tst_QEventDispatcher::registerTimer() { -#define FIND_TIMERS() \ - do { \ - foundPrecise = false; \ - foundCoarse = false; \ - foundVeryCoarse = false; \ - for (int i = 0; i < registeredTimers.count(); ++i) { \ - const QAbstractEventDispatcher::TimerInfo &timerInfo = registeredTimers.at(i); \ - if (timerInfo.timerId == preciseTimerId) { \ - QCOMPARE(timerInfo.interval, int(PreciseTimerInterval)); \ - QCOMPARE(timerInfo.timerType, Qt::PreciseTimer); \ - foundPrecise = true; \ - } else if (timerInfo.timerId == coarseTimerId) { \ - QCOMPARE(timerInfo.interval, int(CoarseTimerInterval)); \ - QCOMPARE(timerInfo.timerType, Qt::CoarseTimer); \ - foundCoarse = true; \ - } else if (timerInfo.timerId == veryCoarseTimerId) { \ - QCOMPARE(timerInfo.interval, int(VeryCoarseTimerInterval)); \ - QCOMPARE(timerInfo.timerType, Qt::VeryCoarseTimer); \ - foundVeryCoarse = true; \ - } \ - } \ - } while (0) - - // start 3 timers, each with the different timer types and different intervals - int preciseTimerId = eventDispatcher->registerTimer(PreciseTimerInterval, Qt::PreciseTimer, this); - int coarseTimerId = eventDispatcher->registerTimer(CoarseTimerInterval, Qt::CoarseTimer, this); - int veryCoarseTimerId = eventDispatcher->registerTimer(VeryCoarseTimerInterval, Qt::VeryCoarseTimer, this); - QVERIFY(preciseTimerId > 0); - QVERIFY(coarseTimerId > 0); - QVERIFY(veryCoarseTimerId > 0); + TimerManager timers(eventDispatcher, this); + timers.registerAll(); + if (QTest::currentTestFailed()) + return; // check that all 3 are present in the eventDispatcher's registeredTimer() list - QList registeredTimers = eventDispatcher->registeredTimers(this); - QCOMPARE(registeredTimers.count(), 3); - bool foundPrecise, foundCoarse, foundVeryCoarse; - FIND_TIMERS(); - QVERIFY(foundPrecise && foundCoarse && foundVeryCoarse); + QCOMPARE(timers.registeredTimers().count(), 3); + QVERIFY(timers.foundPrecise()); + QVERIFY(timers.foundCoarse()); + QVERIFY(timers.foundVeryCoarse()); // process events, waiting for the next event... this should only fire the precise timer receivedEventType = -1; timerIdFromEvent = -1; QTRY_COMPARE_WITH_TIMEOUT(receivedEventType, int(QEvent::Timer), PreciseTimerInterval * 2); - QCOMPARE(timerIdFromEvent, preciseTimerId); + QCOMPARE(timerIdFromEvent, timers.preciseTimerId()); // now unregister it and make sure it's gone - eventDispatcher->unregisterTimer(preciseTimerId); - registeredTimers = eventDispatcher->registeredTimers(this); - QCOMPARE(registeredTimers.count(), 2); - FIND_TIMERS(); - QVERIFY(!foundPrecise && foundCoarse && foundVeryCoarse); + timers.unregister(timers.preciseTimerId()); + if (QTest::currentTestFailed()) + return; + QCOMPARE(timers.registeredTimers().count(), 2); + QVERIFY(!timers.foundPrecise()); + QVERIFY(timers.foundCoarse()); + QVERIFY(timers.foundVeryCoarse()); // do the same again for the coarse timer receivedEventType = -1; timerIdFromEvent = -1; QTRY_COMPARE_WITH_TIMEOUT(receivedEventType, int(QEvent::Timer), CoarseTimerInterval * 2); - QCOMPARE(timerIdFromEvent, coarseTimerId); + QCOMPARE(timerIdFromEvent, timers.coarseTimerId()); // now unregister it and make sure it's gone - eventDispatcher->unregisterTimer(coarseTimerId); - registeredTimers = eventDispatcher->registeredTimers(this); - QCOMPARE(registeredTimers.count(), 1); - FIND_TIMERS(); - QVERIFY(!foundPrecise && !foundCoarse && foundVeryCoarse); + timers.unregister(timers.coarseTimerId()); + if (QTest::currentTestFailed()) + return; + QCOMPARE(timers.registeredTimers().count(), 1); + QVERIFY(!timers.foundPrecise()); + QVERIFY(!timers.foundCoarse()); + QVERIFY(timers.foundVeryCoarse()); // not going to wait for the VeryCoarseTimer, would take too long, just unregister it - eventDispatcher->unregisterTimers(this); - registeredTimers = eventDispatcher->registeredTimers(this); - QVERIFY(registeredTimers.isEmpty()); - -#undef FIND_TIMERS + timers.unregisterAll(); + if (QTest::currentTestFailed()) + return; + QVERIFY(timers.registeredTimers().isEmpty()); } void tst_QEventDispatcher::sendPostedEvents_data() -- cgit v1.2.3 From 900b57ea90ebe60414a5188337bc85ee4faac220 Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Tue, 13 Nov 2018 18:35:50 +0100 Subject: Re-blacklist tst_QEventDispatcher::registerTimer() on macOS MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The test has been failing over and over since it was removed from the blacklist. Obviously it is not stable. This is a partial revert of commit b10ee45546e152e08b2494bd45eb22426e9d2dc9. Task-number: QTBUG-71773 Change-Id: Ie2588538ee704652c2f09ce6ad947da3011e7dad Reviewed-by: Mårten Nordheim Reviewed-by: Edward Welbourne --- tests/auto/corelib/kernel/qeventdispatcher/BLACKLIST | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/auto/corelib/kernel/qeventdispatcher/BLACKLIST b/tests/auto/corelib/kernel/qeventdispatcher/BLACKLIST index b1590a5ccf..06588188d4 100644 --- a/tests/auto/corelib/kernel/qeventdispatcher/BLACKLIST +++ b/tests/auto/corelib/kernel/qeventdispatcher/BLACKLIST @@ -3,3 +3,4 @@ windows [registerTimer] windows winrt +osx -- cgit v1.2.3