From c77efa6d3881554b9e593658fff80acbb8b1388d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Micha=C3=ABl=20Celerier?= Date: Thu, 19 Dec 2019 21:33:10 +0100 Subject: Disable support for RasterOpModes in GL paint engine This leads to crashes for instance when displaying a text cursor in a graphics scene. Change-Id: I1b5c884ddb8325a7f5bdbc6027f0fae13f139a1c Reviewed-by: Eirik Aavitsland --- src/gui/opengl/qopenglpaintengine.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/gui/opengl/qopenglpaintengine.cpp b/src/gui/opengl/qopenglpaintengine.cpp index 47394999c6..6c796776c0 100644 --- a/src/gui/opengl/qopenglpaintengine.cpp +++ b/src/gui/opengl/qopenglpaintengine.cpp @@ -1330,6 +1330,7 @@ void QOpenGL2PaintEngineExPrivate::drawVertexArrays(const float *data, int *stop QOpenGL2PaintEngineEx::QOpenGL2PaintEngineEx() : QPaintEngineEx(*(new QOpenGL2PaintEngineExPrivate(this))) { + gccaps &= ~QPaintEngine::RasterOpModes; } QOpenGL2PaintEngineEx::~QOpenGL2PaintEngineEx() -- cgit v1.2.3 From 22942058aa9c83acb809d0d4c6b78d29a3c33e12 Mon Sep 17 00:00:00 2001 From: Nico Vertriest Date: Mon, 2 Dec 2019 15:41:51 +0100 Subject: Doc: Correct qdoc compilation errors qtbase MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Task-number: QTBUG-79824 Change-Id: I4be365d92b1adfde09efd04d088f75c506666a95 Reviewed-by: Topi Reiniö --- .../widgets/desktop/systray/doc/src/systray.qdoc | 4 +-- examples/widgets/doc/src/addressbook-tutorial.qdoc | 2 +- .../widgets/doc/src/customsortfiltermodel.qdoc | 4 +-- examples/widgets/doc/src/transformations.qdoc | 4 +-- src/testlib/doc/src/qttest-best-practices.qdoc | 2 +- src/widgets/widgets/qdatetimeedit.cpp | 33 +++++++++++----------- src/widgets/widgets/qtextbrowser.cpp | 2 +- 7 files changed, 26 insertions(+), 25 deletions(-) diff --git a/examples/widgets/desktop/systray/doc/src/systray.qdoc b/examples/widgets/desktop/systray/doc/src/systray.qdoc index fe397f83df..ae7e925bd8 100644 --- a/examples/widgets/desktop/systray/doc/src/systray.qdoc +++ b/examples/widgets/desktop/systray/doc/src/systray.qdoc @@ -182,6 +182,6 @@ In addition to the functions and slots discussed above, we have also implemented several convenience functions to simplify the constructor: \c createIconGroupBox(), \c createMessageGroupBox(), - \c createActions() and \c createTrayIcon(). See the \l - {desktop/systray/window.cpp}{window.cpp} file for details. + \c createActions() and \c createTrayIcon(). See the \c + {desktop/systray/window.cpp} file for details. */ diff --git a/examples/widgets/doc/src/addressbook-tutorial.qdoc b/examples/widgets/doc/src/addressbook-tutorial.qdoc index 1f6966e8ae..563b6a2be9 100644 --- a/examples/widgets/doc/src/addressbook-tutorial.qdoc +++ b/examples/widgets/doc/src/addressbook-tutorial.qdoc @@ -136,7 +136,7 @@ \section1 Defining the AddressBook Class - The \l{tutorials/addressbook/part1/addressbook.h}{\c addressbook.h} file is + The \c{tutorials/addressbook/part1/addressbook.h} file is used to define the \c AddressBook class. We start by defining \c AddressBook as a QWidget subclass and declaring diff --git a/examples/widgets/doc/src/customsortfiltermodel.qdoc b/examples/widgets/doc/src/customsortfiltermodel.qdoc index 9f0d13dd83..97725ead04 100644 --- a/examples/widgets/doc/src/customsortfiltermodel.qdoc +++ b/examples/widgets/doc/src/customsortfiltermodel.qdoc @@ -284,6 +284,6 @@ instance of the QStandardItemModel class, i.e., a generic model for storing custom data typically used as a repository for standard Qt data types. Each mail description is added to the - model using \c addMail(), another convenience function. See \l - {itemviews/customsortfiltermodel/main.cpp}{main.cpp} for details. + model using \c addMail(), another convenience function. See \c + {itemviews/customsortfiltermodel/main.cpp} for details. */ diff --git a/examples/widgets/doc/src/transformations.qdoc b/examples/widgets/doc/src/transformations.qdoc index d67e315848..17b540b6cc 100644 --- a/examples/widgets/doc/src/transformations.qdoc +++ b/examples/widgets/doc/src/transformations.qdoc @@ -320,8 +320,8 @@ The \c setupShapes() function is called from the constructor and create the QPainterPath objects representing the shapes that are - used in the application. For construction details, see the \l - {painting/transformations/window.cpp}{window.cpp} example + used in the application. For construction details, see the \c + {painting/transformations/window.cpp} example file. The shapes are stored in a QList. The QList::append() function inserts the given shape at the end of the list. diff --git a/src/testlib/doc/src/qttest-best-practices.qdoc b/src/testlib/doc/src/qttest-best-practices.qdoc index 952fd3259d..7143e644fd 100644 --- a/src/testlib/doc/src/qttest-best-practices.qdoc +++ b/src/testlib/doc/src/qttest-best-practices.qdoc @@ -270,7 +270,7 @@ When side-effects are unavoidable, ensure that the prior state is restored at the end of the test function, even if the test fails. This commonly requires use of an RAII (resource acquisition is initialization) class - that restores state when the function returns, or a \l cleanup() method. + that restores state when the function returns, or a \c cleanup() method. Do not simply put the restoration code at the end of the test. If part of the test fails, such code will be skipped and the prior state will not be restored. diff --git a/src/widgets/widgets/qdatetimeedit.cpp b/src/widgets/widgets/qdatetimeedit.cpp index da4aaadc97..64795d7ccb 100644 --- a/src/widgets/widgets/qdatetimeedit.cpp +++ b/src/widgets/widgets/qdatetimeedit.cpp @@ -216,7 +216,7 @@ QDateTimeEdit::~QDateTimeEdit() /*! \property QDateTimeEdit::dateTime - \brief the QDateTime that is set in the QDateTimeEdit + \brief The QDateTime that is set in the QDateTimeEdit. When setting this property the timespec of the QDateTimeEdit remains the same and the timespec of the new QDateTime is ignored. @@ -253,7 +253,7 @@ void QDateTimeEdit::setDateTime(const QDateTime &datetime) /*! \property QDateTimeEdit::date - \brief the QDate that is set in the widget + \brief The QDate that is set in the widget. By default, this property contains a date that refers to January 1, 2000. @@ -290,7 +290,7 @@ void QDateTimeEdit::setDate(const QDate &date) /*! \property QDateTimeEdit::time - \brief the QTime that is set in the widget + \brief The QTime that is set in the widget. By default, this property contains a time of 00:00:00 and 0 milliseconds. @@ -335,7 +335,8 @@ void QDateTimeEdit::setCalendar(QCalendar calendar) /*! \since 4.4 \property QDateTimeEdit::minimumDateTime - \brief the minimum datetime of the date time edit + + \brief The minimum datetime of the date time edit. Changing this property implicitly updates the \l minimumDate and \l minimumTime properties to the date and time parts of this property, @@ -376,7 +377,7 @@ void QDateTimeEdit::setMinimumDateTime(const QDateTime &dt) \since 4.4 \property QDateTimeEdit::maximumDateTime - \brief the maximum datetime of the date time edit + \brief The maximum datetime of the date time edit. Changing this property implicitly updates the \l maximumDate and \l maximumTime properties to the date and time parts of this property, @@ -444,7 +445,7 @@ void QDateTimeEdit::setDateTimeRange(const QDateTime &min, const QDateTime &max) /*! \property QDateTimeEdit::minimumDate - \brief the minimum date of the date time edit + \brief The minimum date of the date time edit. Changing this property updates the date of the \l minimumDateTime property while preserving the \l minimumTime property. When setting this property, @@ -484,7 +485,7 @@ void QDateTimeEdit::clearMinimumDate() /*! \property QDateTimeEdit::maximumDate - \brief the maximum date of the date time edit + \brief The maximum date of the date time edit. Changing this property updates the date of the \l maximumDateTime property while preserving the \l maximumTime property. When setting this property, the @@ -523,7 +524,7 @@ void QDateTimeEdit::clearMaximumDate() /*! \property QDateTimeEdit::minimumTime - \brief the minimum time of the date time edit + \brief The minimum time of the date time edit. Changing this property updates the time of the \l minimumDateTime property while preserving the \l minimumDate and \l maximumDate properties. If those @@ -562,7 +563,7 @@ void QDateTimeEdit::clearMinimumTime() /*! \property QDateTimeEdit::maximumTime - \brief the maximum time of the date time edit + \brief The maximum time of the date time edit. Changing this property updates the time of the \l maximumDateTime property while preserving the \l minimumDate and \l maximumDate properties. If those @@ -665,7 +666,7 @@ void QDateTimeEdit::setTimeRange(const QTime &min, const QTime &max) /*! \property QDateTimeEdit::displayedSections - \brief the currently displayed fields of the date time edit + \brief The currently displayed fields of the date time edit. Returns a bit set of the displayed sections for this format. \a setDisplayFormat(), displayFormat() @@ -680,7 +681,7 @@ QDateTimeEdit::Sections QDateTimeEdit::displayedSections() const /*! \property QDateTimeEdit::currentSection - \brief the current section of the spinbox + \brief The current section of the spinbox. \a setCurrentSection() */ @@ -739,7 +740,7 @@ QDateTimeEdit::Section QDateTimeEdit::sectionAt(int index) const \property QDateTimeEdit::sectionCount - \brief the number of sections displayed. + \brief The number of sections displayed. If the format is 'yyyy/yy/yyyy', sectionCount returns 3 */ @@ -755,7 +756,7 @@ int QDateTimeEdit::sectionCount() const \property QDateTimeEdit::currentSectionIndex - \brief the current section index of the spinbox + \brief The current section index of the spinbox. If the format is 'yyyy/MM/dd', the displayText is '2001/05/21', and the cursorPosition is 5, currentSectionIndex returns 1. If the @@ -879,7 +880,7 @@ QString QDateTimeEdit::sectionText(Section section) const /*! \property QDateTimeEdit::displayFormat - \brief the format used to display the time/date of the date time edit + \brief The format used to display the time/date of the date time edit. This format is described in QDateTime::toString() and QDateTime::fromString() @@ -951,7 +952,7 @@ void QDateTimeEdit::setDisplayFormat(const QString &format) /*! \property QDateTimeEdit::calendarPopup - \brief the current calendar pop-up show mode. + \brief The current calendar pop-up show mode. \since 4.2 The calendar pop-up will be shown upon clicking the arrow button. @@ -983,7 +984,7 @@ void QDateTimeEdit::setCalendarPopup(bool enable) /*! \property QDateTimeEdit::timeSpec - \brief the current timespec used by the date time edit. + \brief The current timespec used by the date time edit. \since 4.4 */ diff --git a/src/widgets/widgets/qtextbrowser.cpp b/src/widgets/widgets/qtextbrowser.cpp index 3e49390315..d0ccd435b3 100644 --- a/src/widgets/widgets/qtextbrowser.cpp +++ b/src/widgets/widgets/qtextbrowser.cpp @@ -823,7 +823,7 @@ void QTextBrowser::setSource(const QUrl &url) /*! Attempts to load the document at the given \a url with the specified \a type. - If \a type is \l {QTextDocument::ResourceType::UnknownResource}{UnknownResource} + If \a type is \l {QTextDocument::UnknownResource}{UnknownResource} (the default), the document type will be detected: that is, if the url ends with an extension of \c{.md}, \c{.mkd} or \c{.markdown}, the document will be loaded via \l QTextDocument::setMarkdown(); otherwise it will be loaded via -- cgit v1.2.3 From c61cedcc5475a77fb94ed12788f61039835f8079 Mon Sep 17 00:00:00 2001 From: Giuseppe D'Angelo Date: Fri, 3 Jan 2020 23:06:45 +0100 Subject: GCC: revoke constexpr before 5.0 It's causing build failures on GCC 4.9 due to our code hitting https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57694 (at least since de82d239f814cf2a717bea0defeee3732384e271). Task-number: QTBUG-80997 Change-Id: I80a9d1fcbf26d8c0bf514ddc7bdb86eb7173360f Reviewed-by: Ville Voutilainen --- src/corelib/global/qcompilerdetection.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/corelib/global/qcompilerdetection.h b/src/corelib/global/qcompilerdetection.h index 0091cfcb60..1ea4e7d287 100644 --- a/src/corelib/global/qcompilerdetection.h +++ b/src/corelib/global/qcompilerdetection.h @@ -883,7 +883,6 @@ # define Q_COMPILER_DEFAULT_MEMBERS # define Q_COMPILER_DELETE_MEMBERS /* C++11 features supported in GCC 4.6: */ -# define Q_COMPILER_CONSTEXPR # define Q_COMPILER_NULLPTR # define Q_COMPILER_UNRESTRICTED_UNIONS # define Q_COMPILER_RANGE_FOR @@ -914,7 +913,11 @@ # define Q_COMPILER_REF_QUALIFIERS # endif # endif - /* C++11 features are complete as of GCC 4.8.1 */ +# if Q_CC_GNU >= 500 + /* GCC 4.6 introduces constexpr, but it's bugged (at least) in the whole + * 4.x series, see e.g. https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57694 */ +# define Q_COMPILER_CONSTEXPR +# endif # endif # if __cplusplus > 201103L # if Q_CC_GNU >= 409 -- cgit v1.2.3 From 64359ad710756e7cca5ca553521b2aada18fb0fe Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Tue, 7 Jan 2020 16:25:37 -0800 Subject: ucstrncmp: Fix UBSan report of array overflowing The expression "a + offset + N" will eventually calculate an address past the end of a, since we are comparing to end. That's undefined behavior. Instead, calculate end - a and compare that to offset + N. This commit subtracts "a" from both sides of the inequalities and swaps the two sides to make them obey Qt coding style. Testing with GCC 9 (which is the only one I care about) shows the compiler generates the same code. Fixes: QTBUG-81218 Change-Id: Id84da383373844f3a4b0fffd15e7c1ab904daccd Reviewed-by: Olivier Goffart (Woboq GmbH) --- src/corelib/text/qstring.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/corelib/text/qstring.cpp b/src/corelib/text/qstring.cpp index 4d83f19db7..b929786255 100644 --- a/src/corelib/text/qstring.cpp +++ b/src/corelib/text/qstring.cpp @@ -915,7 +915,7 @@ static int ucstrncmp(const QChar *a, const QChar *b, size_t l) }; // we're going to read a[0..15] and b[0..15] (32 bytes) - for ( ; a + offset + 16 <= end; offset += 16) { + for ( ; end - a >= offset + 16; offset += 16) { #ifdef __AVX2__ __m256i a_data = _mm256_loadu_si256(reinterpret_cast(a + offset)); __m256i b_data = _mm256_loadu_si256(reinterpret_cast(b + offset)); @@ -939,7 +939,7 @@ static int ucstrncmp(const QChar *a, const QChar *b, size_t l) } // we're going to read a[0..7] and b[0..7] (16 bytes) - if (a + offset + 8 <= end) { + if (end - a >= offset + 8) { __m128i a_data = _mm_loadu_si128(reinterpret_cast(a + offset)); __m128i b_data = _mm_loadu_si128(reinterpret_cast(b + offset)); if (isDifferent(a_data, b_data)) @@ -949,7 +949,7 @@ static int ucstrncmp(const QChar *a, const QChar *b, size_t l) } // we're going to read a[0..3] and b[0..3] (8 bytes) - if (a + offset + 4 <= end) { + if (end - a >= offset + 4) { __m128i a_data = _mm_loadl_epi64(reinterpret_cast(a + offset)); __m128i b_data = _mm_loadl_epi64(reinterpret_cast(b + offset)); if (isDifferent(a_data, b_data)) @@ -970,7 +970,7 @@ static int ucstrncmp(const QChar *a, const QChar *b, size_t l) if (l >= 8) { const QChar *end = a + l; const uint16x8_t mask = { 1, 1 << 1, 1 << 2, 1 << 3, 1 << 4, 1 << 5, 1 << 6, 1 << 7 }; - while (a + 7 < end) { + while (end - a > 7) { uint16x8_t da = vld1q_u16(reinterpret_cast(a)); uint16x8_t db = vld1q_u16(reinterpret_cast(b)); -- cgit v1.2.3 From 445c1a873fcdc58a7880394b8d7473b7eff43d99 Mon Sep 17 00:00:00 2001 From: Inho Lee Date: Tue, 7 Jan 2020 15:06:37 +0100 Subject: Resolve a build error for ICC 19 This argument name makes an error with "line 302:Type t = Undefined;" Change-Id: I5488ff02ab7c9f9391c17361da5e2aac2727a6a0 Reviewed-by: Thiago Macieira --- src/corelib/serialization/qcborvalue.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/corelib/serialization/qcborvalue.h b/src/corelib/serialization/qcborvalue.h index 914103b0a5..dcbe7efc26 100644 --- a/src/corelib/serialization/qcborvalue.h +++ b/src/corelib/serialization/qcborvalue.h @@ -320,9 +320,9 @@ private: return Type(quint8(st) | SimpleType); } - Q_DECL_CONSTEXPR static bool isTag_helper(Type t) + Q_DECL_CONSTEXPR static bool isTag_helper(Type tt) { - return t == Tag || t >= 0x10000; + return tt == Tag || tt >= 0x10000; } }; Q_DECLARE_SHARED(QCborValue) -- cgit v1.2.3 From 0c37bc11b5f379d442ed3475483d57449b63963d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Fri, 20 Dec 2019 17:45:58 +0100 Subject: Share updates to QGuiApplicationPrivate::app_pal via helper function Change-Id: I2f582358efaadcd33b39c52317222322c589423f Reviewed-by: Simon Hausmann --- src/gui/kernel/qguiapplication.cpp | 19 ++++++++++++++----- src/gui/kernel/qguiapplication_p.h | 2 ++ src/widgets/kernel/qapplication.cpp | 6 +----- 3 files changed, 17 insertions(+), 10 deletions(-) diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index 888ccd8453..bdcea275c3 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -3293,12 +3293,8 @@ QPalette QGuiApplication::palette() */ void QGuiApplication::setPalette(const QPalette &pal) { - if (QGuiApplicationPrivate::app_pal && pal.isCopyOf(*QGuiApplicationPrivate::app_pal)) + if (!QGuiApplicationPrivate::setPalette(pal)) return; - if (!QGuiApplicationPrivate::app_pal) - QGuiApplicationPrivate::app_pal = new QPalette(pal); - else - *QGuiApplicationPrivate::app_pal = pal; QCoreApplication::setAttribute(Qt::AA_SetPalette); @@ -3306,6 +3302,19 @@ void QGuiApplication::setPalette(const QPalette &pal) qGuiApp->d_func()->sendApplicationPaletteChange(); } +bool QGuiApplicationPrivate::setPalette(const QPalette &palette) +{ + if (app_pal && palette.isCopyOf(*app_pal)) + return false; + + if (!app_pal) + app_pal = new QPalette(palette); + else + *app_pal = palette; + + return true; +} + void QGuiApplicationPrivate::applyWindowGeometrySpecificationTo(QWindow *window) { windowGeometrySpecification.applyTo(window); diff --git a/src/gui/kernel/qguiapplication_p.h b/src/gui/kernel/qguiapplication_p.h index 26f65b2f16..7454bba0e5 100644 --- a/src/gui/kernel/qguiapplication_p.h +++ b/src/gui/kernel/qguiapplication_p.h @@ -323,6 +323,8 @@ public: static void resetCachedDevicePixelRatio(); + static bool setPalette(const QPalette &palette); + protected: virtual void notifyThemeChanged(); virtual void sendApplicationPaletteChange(bool toAllWidgets = false, const char *className = nullptr); diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp index f334cc58f9..d28a425c43 100644 --- a/src/widgets/kernel/qapplication.cpp +++ b/src/widgets/kernel/qapplication.cpp @@ -1374,12 +1374,8 @@ void QApplicationPrivate::setPalette_helper(const QPalette &palette, const char* bool all = false; PaletteHash *hash = app_palettes(); if (!className) { - if (QApplicationPrivate::app_pal && pal.isCopyOf(*QApplicationPrivate::app_pal)) + if (!QGuiApplicationPrivate::setPalette(pal)) return; - if (!QApplicationPrivate::app_pal) - QApplicationPrivate::app_pal = new QPalette(pal); - else - *QApplicationPrivate::app_pal = pal; if (!QApplicationPrivate::sys_pal || !palette.isCopyOf(*QApplicationPrivate::sys_pal)) QCoreApplication::setAttribute(Qt::AA_SetPalette); -- cgit v1.2.3 From 2a02487ff00341fcc07023b37ec527c2694fa4c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Fri, 20 Dec 2019 17:51:01 +0100 Subject: Move tracking of widget specific app palettes to QApplicationPrivate Change-Id: I43cc25207026f174e46534baedf08e0c300728d1 Reviewed-by: Timur Pocheptsov --- src/widgets/kernel/qapplication.cpp | 42 ++++++++++++++++++------------------- src/widgets/kernel/qapplication_p.h | 6 +++--- 2 files changed, 23 insertions(+), 25 deletions(-) diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp index d28a425c43..28575a20f5 100644 --- a/src/widgets/kernel/qapplication.cpp +++ b/src/widgets/kernel/qapplication.cpp @@ -414,11 +414,9 @@ bool Q_WIDGETS_EXPORT qt_tab_all_widgets() } // ######## move to QApplicationPrivate -// Default application palettes and fonts (per widget type) -Q_GLOBAL_STATIC(PaletteHash, app_palettes) +// Default fonts (per widget type) Q_GLOBAL_STATIC(FontHash, app_fonts) -// Exported accessors for use outside of this file -PaletteHash *qt_app_palettes_hash() { return app_palettes(); } +// Exported accessor for use outside of this file FontHash *qt_app_fonts_hash() { return app_fonts(); } QWidgetList *QApplicationPrivate::popupWidgets = 0; // has keyboard input focus @@ -643,7 +641,8 @@ void QApplicationPrivate::initializeWidgetPaletteHash() QPlatformTheme *platformTheme = QGuiApplicationPrivate::platformTheme(); if (!platformTheme) return; - app_palettes()->clear(); + + widgetPalettes.clear(); setPossiblePalette(platformTheme->palette(QPlatformTheme::ToolButtonPalette), "QToolButton"); setPossiblePalette(platformTheme->palette(QPlatformTheme::ButtonPalette), "QAbstractButton"); @@ -802,7 +801,7 @@ QApplication::~QApplication() delete QApplicationPrivate::app_pal; QApplicationPrivate::app_pal = 0; clearSystemPalette(); - app_palettes()->clear(); + QApplicationPrivate::widgetPalettes.clear(); delete QApplicationPrivate::sys_font; QApplicationPrivate::sys_font = 0; @@ -1315,6 +1314,8 @@ void QApplication::setGlobalStrut(const QSize& strut) QApplicationPrivate::app_strut = strut; } +// Widget specific palettes +QApplicationPrivate::PaletteHash QApplicationPrivate::widgetPalettes; /*! \fn QPalette QApplication::palette(const QWidget* widget) @@ -1329,15 +1330,13 @@ void QApplication::setGlobalStrut(const QSize& strut) */ QPalette QApplication::palette(const QWidget* w) { - typedef PaletteHash::const_iterator PaletteHashConstIt; - - PaletteHash *hash = app_palettes(); - if (w && hash && hash->size()) { - PaletteHashConstIt it = hash->constFind(w->metaObject()->className()); - const PaletteHashConstIt cend = hash->constEnd(); + auto &widgetPalettes = QApplicationPrivate::widgetPalettes; + if (w && !widgetPalettes.isEmpty()) { + auto it = widgetPalettes.constFind(w->metaObject()->className()); + const auto cend = widgetPalettes.constEnd(); if (it != cend) return *it; - for (it = hash->constBegin(); it != cend; ++it) { + for (it = widgetPalettes.constBegin(); it != cend; ++it) { if (w->inherits(it.key())) return it.value(); } @@ -1354,10 +1353,10 @@ QPalette QApplication::palette(const QWidget* w) */ QPalette QApplication::palette(const char *className) { - PaletteHash *hash = app_palettes(); - if (className && hash && hash->size()) { - QHash::ConstIterator it = hash->constFind(className); - if (it != hash->constEnd()) + auto &widgetPalettes = QApplicationPrivate::widgetPalettes; + if (className && !widgetPalettes.isEmpty()) { + auto it = widgetPalettes.constFind(className); + if (it != widgetPalettes.constEnd()) return *it; } @@ -1372,7 +1371,6 @@ void QApplicationPrivate::setPalette_helper(const QPalette &palette, const char* QApplicationPrivate::app_style->polish(pal); // NB: non-const reference bool all = false; - PaletteHash *hash = app_palettes(); if (!className) { if (!QGuiApplicationPrivate::setPalette(pal)) return; @@ -1380,13 +1378,13 @@ void QApplicationPrivate::setPalette_helper(const QPalette &palette, const char* if (!QApplicationPrivate::sys_pal || !palette.isCopyOf(*QApplicationPrivate::sys_pal)) QCoreApplication::setAttribute(Qt::AA_SetPalette); - if (hash && hash->size()) { + if (!widgetPalettes.isEmpty()) { all = true; if (clearWidgetPaletteHash) - hash->clear(); + widgetPalettes.clear(); } - } else if (hash) { - hash->insert(className, pal); + } else { + widgetPalettes.insert(className, pal); } if (qApp) diff --git a/src/widgets/kernel/qapplication_p.h b/src/widgets/kernel/qapplication_p.h index 79d06ed98c..8751cc772b 100644 --- a/src/widgets/kernel/qapplication_p.h +++ b/src/widgets/kernel/qapplication_p.h @@ -94,9 +94,6 @@ extern QClipboard *qt_clipboard; typedef QHash FontHash; Q_WIDGETS_EXPORT FontHash *qt_app_fonts_hash(); -typedef QHash PaletteHash; -PaletteHash *qt_app_palettes_hash(); - #define QApplicationPrivateBase QGuiApplicationPrivate class Q_WIDGETS_EXPORT QApplicationPrivate : public QApplicationPrivateBase @@ -193,6 +190,9 @@ public: static void initializeWidgetFontHash(); static void setSystemFont(const QFont &font); + using PaletteHash = QHash; + static PaletteHash widgetPalettes; + static QApplicationPrivate *instance() { return self; } #ifdef QT_KEYPAD_NAVIGATION -- cgit v1.2.3 From 7b092b3fe3c9960a2e2866a3b03818fe63bbbac4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Fri, 20 Dec 2019 19:09:44 +0100 Subject: Remove clearWidgetPaletteHash argument from setPalette_helper The argument is only used when the application palette is set, (as opposed to setting the palette for a specific widget class), and that code path is only triggered from QApplication::setPalette, which passes 'true' for this argument. Change-Id: I67a1cc3741f6f62653b0f95ff88d28228f9977d4 Reviewed-by: Timur Pocheptsov --- src/widgets/kernel/qapplication.cpp | 9 ++++----- src/widgets/kernel/qapplication_p.h | 2 +- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp index 28575a20f5..ef76265f8b 100644 --- a/src/widgets/kernel/qapplication.cpp +++ b/src/widgets/kernel/qapplication.cpp @@ -633,7 +633,7 @@ static void setPossiblePalette(const QPalette *palette, const char *className) { if (palette == 0) return; - QApplicationPrivate::setPalette_helper(*palette, className, false); + QApplicationPrivate::setPalette_helper(*palette, className); } void QApplicationPrivate::initializeWidgetPaletteHash() @@ -1363,7 +1363,7 @@ QPalette QApplication::palette(const char *className) return QGuiApplication::palette(); } -void QApplicationPrivate::setPalette_helper(const QPalette &palette, const char* className, bool clearWidgetPaletteHash) +void QApplicationPrivate::setPalette_helper(const QPalette &palette, const char* className) { QPalette pal = palette; @@ -1380,8 +1380,7 @@ void QApplicationPrivate::setPalette_helper(const QPalette &palette, const char* if (!widgetPalettes.isEmpty()) { all = true; - if (clearWidgetPaletteHash) - widgetPalettes.clear(); + widgetPalettes.clear(); } } else { widgetPalettes.insert(className, pal); @@ -1416,7 +1415,7 @@ void QApplicationPrivate::setPalette_helper(const QPalette &palette, const char* void QApplication::setPalette(const QPalette &palette, const char* className) { - QApplicationPrivate::setPalette_helper(palette, className, /*clearWidgetPaletteHash=*/ true); + QApplicationPrivate::setPalette_helper(palette, className); } diff --git a/src/widgets/kernel/qapplication_p.h b/src/widgets/kernel/qapplication_p.h index 8751cc772b..71f695cc18 100644 --- a/src/widgets/kernel/qapplication_p.h +++ b/src/widgets/kernel/qapplication_p.h @@ -185,7 +185,7 @@ public: static bool widgetCount; // Coupled with -widgetcount switch static void setSystemPalette(const QPalette &pal); - static void setPalette_helper(const QPalette &palette, const char* className, bool clearWidgetPaletteHash); + static void setPalette_helper(const QPalette &palette, const char* className); static void initializeWidgetPaletteHash(); static void initializeWidgetFontHash(); static void setSystemFont(const QFont &font); -- cgit v1.2.3 From 1edf8bc46542ad302085b9e957c8c3c31c7db9da Mon Sep 17 00:00:00 2001 From: Andre Hartmann Date: Sat, 4 Jan 2020 16:03:35 +0100 Subject: QObject: Replace more 0 and NULL with nullptr ... in docs, comments, and warnings. Also adopt some occurrences around there and in the snippets. Change-Id: Icc0aa0868cadd8ec2270dda794bf83cd7ab84160 Reviewed-by: Christian Ehrlicher --- .../snippets/code/src_corelib_kernel_qobject.cpp | 16 ++--- src/corelib/kernel/qobject.cpp | 76 +++++++++++----------- tests/auto/corelib/kernel/qobject/tst_qobject.cpp | 8 +-- 3 files changed, 50 insertions(+), 50 deletions(-) diff --git a/src/corelib/doc/snippets/code/src_corelib_kernel_qobject.cpp b/src/corelib/doc/snippets/code/src_corelib_kernel_qobject.cpp index 1966f8195a..43bcc22720 100644 --- a/src/corelib/doc/snippets/code/src_corelib_kernel_qobject.cpp +++ b/src/corelib/doc/snippets/code/src_corelib_kernel_qobject.cpp @@ -71,7 +71,7 @@ QTimer *timer = qobject_cast(obj); // timer == (QObject *)obj QAbstractButton *button = qobject_cast(obj); -// button == 0 +// button == nullptr //! [3] @@ -144,7 +144,7 @@ class MyObject : public QObject Q_OBJECT public: - MyObject(QObject *parent = 0); + MyObject(QObject *parent = nullptr); protected: void timerEvent(QTimerEvent *event) override; @@ -322,7 +322,7 @@ QObject::connect: Cannot queue arguments of type 'MyType' //! [26] -disconnect(myObject, 0, 0, 0); +disconnect(myObject, nullptr, nullptr, nullptr); //! [26] @@ -332,7 +332,7 @@ myObject->disconnect(); //! [28] -disconnect(myObject, SIGNAL(mySignal()), 0, 0); +disconnect(myObject, SIGNAL(mySignal()), nullptr, nullptr); //! [28] @@ -342,7 +342,7 @@ myObject->disconnect(SIGNAL(mySignal())); //! [30] -disconnect(myObject, 0, myReceiver, 0); +disconnect(myObject, nullptr, myReceiver, nullptr); //! [30] @@ -391,7 +391,7 @@ class MyClass : public QObject Q_OBJECT public: - MyClass(QObject *parent = 0); + MyClass(QObject *parent = nullptr); ~MyClass(); enum Priority { High, Low, VeryHigh, VeryLow }; @@ -467,7 +467,7 @@ QObject::connect(socket, &QTcpSocket::connected, [=] () { //! [46] //! [47] -disconnect(myObject, &MyObject::mySignal(), 0, 0); +disconnect(myObject, &MyObject::mySignal(), nullptr, nullptr); //! [47] //! [48] @@ -505,7 +505,7 @@ class MyClass : public QWidget Q_OBJECT public: - MyClass(QWidget *parent = 0); + MyClass(QWidget *parent = nullptr); ~MyClass(); bool event(QEvent* ev) override diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp index cc50d9ccc7..e2e133ac28 100644 --- a/src/corelib/kernel/qobject.cpp +++ b/src/corelib/kernel/qobject.cpp @@ -1185,8 +1185,8 @@ QObjectPrivate::Connection::~Connection() \relates QObject Returns the given \a object cast to type T if the object is of type - T (or of a subclass); otherwise returns 0. If \a object is 0 then - it will also return 0. + T (or of a subclass); otherwise returns \nullptr. If \a object is + \nullptr then it will also return \nullptr. The class T must inherit (directly or indirectly) QObject and be declared with the \l Q_OBJECT macro. @@ -1538,7 +1538,7 @@ QThread *QObject::thread() const the thread affinity is changed. You can handle this event to perform any special processing. Note that any new events that are posted to this object will be handled in the \a targetThread, - provided it is non-null: when it is \nullptr, no event processing + provided it is not \nullptr: when it is \nullptr, no event processing for this object or its children can happen, as they are no longer associated with any thread. @@ -2335,7 +2335,7 @@ void QObject::deleteLater() If the same \a sourceText is used in different roles within the same context, an additional identifying string may be passed in - \a disambiguation (0 by default). In Qt 4.4 and earlier, this was + \a disambiguation (\nullptr by default). In Qt 4.4 and earlier, this was the preferred way to pass comments to translators. Example: @@ -2521,7 +2521,7 @@ QObject *QObject::sender() const For signals with default parameters, this function will always return the index with all parameters, regardless of which was used with - connect(). For example, the signal \c {destroyed(QObject *obj = 0)} + connect(). For example, the signal \c {destroyed(QObject *obj = \nullptr)} will have two different indexes (with and without the parameter), but this function will always return the index with a parameter. This does not apply when overloading signals with different parameters. @@ -2662,7 +2662,7 @@ bool QObject::isSignalConnected(const QMetaMethod &signal) const member in the specified class. \list - \li If member.mobj is 0 then both signalIndex and methodIndex are set to -1. + \li If member.mobj is \nullptr then both signalIndex and methodIndex are set to -1. \li If specified member is not a member of obj instance class (or one of its parent classes) then both signalIndex and methodIndex are set to -1. @@ -2799,12 +2799,12 @@ QMetaObject::Connection QObject::connect(const QObject *sender, const char *sign const QObject *receiver, const char *method, Qt::ConnectionType type) { - if (sender == 0 || receiver == 0 || signal == 0 || method == 0) { + if (sender == nullptr || receiver == nullptr || signal == nullptr || method == nullptr) { qWarning("QObject::connect: Cannot connect %s::%s to %s::%s", - sender ? sender->metaObject()->className() : "(null)", - (signal && *signal) ? signal+1 : "(null)", - receiver ? receiver->metaObject()->className() : "(null)", - (method && *method) ? method+1 : "(null)"); + sender ? sender->metaObject()->className() : "(nullptr)", + (signal && *signal) ? signal+1 : "(nullptr)", + receiver ? receiver->metaObject()->className() : "(nullptr)", + (method && *method) ? method+1 : "(nullptr)"); return QMetaObject::Connection(0); } QByteArray tmp_signal_name; @@ -2937,14 +2937,14 @@ QMetaObject::Connection QObject::connect(const QObject *sender, const QMetaMetho const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type) { - if (sender == 0 - || receiver == 0 + if (sender == nullptr + || receiver == nullptr || signal.methodType() != QMetaMethod::Signal || method.methodType() == QMetaMethod::Constructor) { qWarning("QObject::connect: Cannot connect %s::%s to %s::%s", - sender ? sender->metaObject()->className() : "(null)", + sender ? sender->metaObject()->className() : "(nullptr)", signal.methodSignature().constData(), - receiver ? receiver->metaObject()->className() : "(null)", + receiver ? receiver->metaObject()->className() : "(nullptr)", method.methodSignature().constData() ); return QMetaObject::Connection(0); } @@ -3046,20 +3046,20 @@ QMetaObject::Connection QObject::connect(const QObject *sender, const QMetaMetho \endlist - 0 may be used as a wildcard, meaning "any signal", "any receiving + \nullptr may be used as a wildcard, meaning "any signal", "any receiving object", or "any slot in the receiving object", respectively. The \a sender may never be \nullptr. (You cannot disconnect signals from more than one object in a single call.) - If \a signal is 0, it disconnects \a receiver and \a method from + If \a signal is \nullptr, it disconnects \a receiver and \a method from any signal. If not, only the specified signal is disconnected. - If \a receiver is 0, it disconnects anything connected to \a + If \a receiver is \nullptr, it disconnects anything connected to \a signal. If not, slots in objects other than \a receiver are not disconnected. - If \a method is 0, it disconnects anything that is connected to \a + If \a method is \nullptr, it disconnects anything that is connected to \a receiver. If not, only slots named \a method will be disconnected, and all other slots are left alone. The \a method must be \nullptr if \a receiver is left out, so you cannot disconnect a @@ -3070,8 +3070,8 @@ QMetaObject::Connection QObject::connect(const QObject *sender, const QMetaMetho bool QObject::disconnect(const QObject *sender, const char *signal, const QObject *receiver, const char *method) { - if (sender == 0 || (receiver == 0 && method != 0)) { - qWarning("QObject::disconnect: Unexpected null parameter"); + if (sender == nullptr || (receiver == nullptr && method != nullptr)) { + qWarning("QObject::disconnect: Unexpected nullptr parameter"); return false; } @@ -3197,16 +3197,16 @@ bool QObject::disconnect(const QObject *sender, const char *signal, \endlist QMetaMethod() may be used as wildcard in the meaning "any signal" or "any slot in receiving object". - In the same way 0 can be used for \a receiver in the meaning "any receiving object". In this case - method should also be QMetaMethod(). \a sender parameter should be never 0. + In the same way \nullptr can be used for \a receiver in the meaning "any receiving object". + In this case method should also be QMetaMethod(). \a sender parameter should be never \nullptr. \sa disconnect(const QObject *sender, const char *signal, const QObject *receiver, const char *method) */ bool QObject::disconnect(const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method) { - if (sender == 0 || (receiver == 0 && method.mobj != 0)) { - qWarning("QObject::disconnect: Unexpected null parameter"); + if (sender == nullptr || (receiver == nullptr && method.mobj != nullptr)) { + qWarning("QObject::disconnect: Unexpected nullptr parameter"); return false; } if (signal.mobj) { @@ -3240,7 +3240,7 @@ bool QObject::disconnect(const QObject *sender, const QMetaMethod &signal, QMetaObjectPrivate::memberIndexes(sender, signal, &signal_index, &dummy); QMetaObjectPrivate::memberIndexes(receiver, method, &dummy, &method_index); } - // If we are here sender is not null. If signal is not null while signal_index + // If we are here sender is not nullptr. If signal is not nullptr while signal_index // is -1 then this signal is not a member of sender. if (signal.mobj && signal_index == -1) { qWarning("QObject::disconect: signal %s not found on class %s", @@ -3329,7 +3329,7 @@ void QObject::connectNotify(const QMetaMethod &signal) \a signal with a specific signal. If all signals were disconnected from this object (e.g., the - signal argument to disconnect() was 0), disconnectNotify() + signal argument to disconnect() was \nullptr), disconnectNotify() is only called once, and the \a signal will be an invalid QMetaMethod (QMetaMethod::isValid() returns \c false). @@ -4929,7 +4929,7 @@ void qDeleteInEventHandler(QObject *o) \a sender is the sender object \a signal is a pointer to a pointer to a member signal of the sender - \a receiver is the receiver object, may not be null, will be equal to sender when + \a receiver is the receiver object, may not be \nullptr, will be equal to sender when connecting to a static function or a functor \a slot a pointer only used when using Qt::UniqueConnection \a type the Qt::ConnctionType passed as argument to connect @@ -4937,7 +4937,7 @@ void qDeleteInEventHandler(QObject *o) to be used with queued connection must stay valid at least for the whole time of the connection, this function do not take ownership. typically static data. - If null, then the types will be computed when the signal is emit in a queued + If \nullptr, then the types will be computed when the signal is emit in a queued connection from the types from the signature. \a senderMetaObject is the metaobject used to lookup the signal, the signal must be in this metaobject @@ -4948,7 +4948,7 @@ QMetaObject::Connection QObject::connectImpl(const QObject *sender, void **signa const int *types, const QMetaObject *senderMetaObject) { if (!signal) { - qWarning("QObject::connect: invalid null parameter"); + qWarning("QObject::connect: invalid nullptr parameter"); if (slotObj) slotObj->destroyIfLastRef(); return QMetaObject::Connection(); @@ -4988,7 +4988,7 @@ QMetaObject::Connection QObjectPrivate::connectImpl(const QObject *sender, int s : "Unknown"; const char *receiverString = receiver ? receiver->metaObject()->className() : "Unknown"; - qWarning("QObject::connect(%s, %s): invalid null parameter", senderString, receiverString); + qWarning("QObject::connect(%s, %s): invalid nullptr parameter", senderString, receiverString); if (slotObj) slotObj->destroyIfLastRef(); return QMetaObject::Connection(); @@ -5121,20 +5121,20 @@ bool QObject::disconnect(const QMetaObject::Connection &connection) \endlist - 0 may be used as a wildcard, meaning "any signal", "any receiving + \nullptr may be used as a wildcard, meaning "any signal", "any receiving object", or "any slot in the receiving object", respectively. The \a sender may never be \nullptr. (You cannot disconnect signals from more than one object in a single call.) - If \a signal is 0, it disconnects \a receiver and \a method from + If \a signal is \nullptr, it disconnects \a receiver and \a method from any signal. If not, only the specified signal is disconnected. - If \a receiver is 0, it disconnects anything connected to \a + If \a receiver is \nullptr, it disconnects anything connected to \a signal. If not, slots in objects other than \a receiver are not disconnected. - If \a method is 0, it disconnects anything that is connected to \a + If \a method is \nullptr, it disconnects anything that is connected to \a receiver. If not, only slots named \a method will be disconnected, and all other slots are left alone. The \a method must be \nullptr if \a receiver is left out, so you cannot disconnect a @@ -5150,8 +5150,8 @@ bool QObject::disconnect(const QMetaObject::Connection &connection) bool QObject::disconnectImpl(const QObject *sender, void **signal, const QObject *receiver, void **slot, const QMetaObject *senderMetaObject) { - if (sender == 0 || (receiver == 0 && slot != 0)) { - qWarning("QObject::disconnect: Unexpected null parameter"); + if (sender == nullptr || (receiver == nullptr && slot != nullptr)) { + qWarning("QObject::disconnect: Unexpected nullptr parameter"); return false; } @@ -5182,7 +5182,7 @@ bool QObject::disconnectImpl(const QObject *sender, void **signal, const QObject QMetaObject::Connection QObjectPrivate::connect(const QObject *sender, int signal_index, QtPrivate::QSlotObjectBase *slotObj, Qt::ConnectionType type) { if (!sender) { - qWarning("QObject::connect: invalid null parameter"); + qWarning("QObject::connect: invalid nullptr parameter"); if (slotObj) slotObj->destroyIfLastRef(); return QMetaObject::Connection(); diff --git a/tests/auto/corelib/kernel/qobject/tst_qobject.cpp b/tests/auto/corelib/kernel/qobject/tst_qobject.cpp index a805bfb747..21615d6ec4 100644 --- a/tests/auto/corelib/kernel/qobject/tst_qobject.cpp +++ b/tests/auto/corelib/kernel/qobject/tst_qobject.cpp @@ -6719,16 +6719,16 @@ void tst_QObject::connectWarnings() ReceiverObject r1; r1.reset(); - QTest::ignoreMessage(QtWarningMsg, "QObject::connect(SenderObject, ReceiverObject): invalid null parameter"); + QTest::ignoreMessage(QtWarningMsg, "QObject::connect(SenderObject, ReceiverObject): invalid nullptr parameter"); connect(static_cast(nullptr), &SubSender::signal1, &r1, &ReceiverObject::slot1); - QTest::ignoreMessage(QtWarningMsg, "QObject::connect(SubSender, Unknown): invalid null parameter"); + QTest::ignoreMessage(QtWarningMsg, "QObject::connect(SubSender, Unknown): invalid nullptr parameter"); connect(&sub, &SubSender::signal1, static_cast(nullptr), &ReceiverObject::slot1); - QTest::ignoreMessage(QtWarningMsg, "QObject::connect(SenderObject, ReceiverObject): invalid null parameter"); + QTest::ignoreMessage(QtWarningMsg, "QObject::connect(SenderObject, ReceiverObject): invalid nullptr parameter"); connect(static_cast(nullptr), &SenderObject::signal1, &r1, &ReceiverObject::slot1); - QTest::ignoreMessage(QtWarningMsg, "QObject::connect(SenderObject, Unknown): invalid null parameter"); + QTest::ignoreMessage(QtWarningMsg, "QObject::connect(SenderObject, Unknown): invalid nullptr parameter"); connect(&obj, &SenderObject::signal1, static_cast(nullptr), &ReceiverObject::slot1); } -- cgit v1.2.3 From ce04fa345dbe52a022b592dde3ff49514c66b4c2 Mon Sep 17 00:00:00 2001 From: BogDan Vatra Date: Fri, 6 Dec 2019 14:26:17 +0200 Subject: Android: make sure we don't add _$${QT_ARCH} twice Fixes: QTBUG-80582 Change-Id: I2b3790bb18754e146db611d61c48a3b7a532575c Reviewed-by: Andy Shaw --- mkspecs/features/android/android.prf | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mkspecs/features/android/android.prf b/mkspecs/features/android/android.prf index af004bbb25..8290286ec6 100644 --- a/mkspecs/features/android/android.prf +++ b/mkspecs/features/android/android.prf @@ -36,7 +36,8 @@ build_pass { } } } else: contains(TEMPLATE, "lib"):!static:!QTDIR_build:android_install { - !contains(TARGET, "_$${QT_ARCH}"): TARGET = $${TARGET}_$${QT_ARCH} + tmpvar = $$str_member(TARGET, -$$str_size(QT_ARCH), -1) + !equals(tmpvar, $${QT_ARCH}): TARGET = $${TARGET}_$${QT_ARCH} target.path = /libs/$$ANDROID_TARGET_ARCH/ INSTALLS *= target } -- cgit v1.2.3 From 3b54009b13e9629b75827a59f8537451d25613a4 Mon Sep 17 00:00:00 2001 From: BogDan Vatra Date: Tue, 3 Dec 2019 10:35:44 +0200 Subject: AAB files can be signed only with jarsigner tool Fixes: QTBUG-80406 Change-Id: I04b99477c744e7dd729a791c81194b90c4ec658a Reviewed-by: Andy Shaw --- src/tools/androiddeployqt/main.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/tools/androiddeployqt/main.cpp b/src/tools/androiddeployqt/main.cpp index 6fd32c2d29..d993518665 100644 --- a/src/tools/androiddeployqt/main.cpp +++ b/src/tools/androiddeployqt/main.cpp @@ -416,6 +416,7 @@ Options parseOptions() } else if (argument.compare(QLatin1String("--aab"), Qt::CaseInsensitive) == 0) { options.buildAAB = true; options.build = true; + options.jarSigner = true; } else if (options.buildAAB && argument.compare(QLatin1String("--no-build"), Qt::CaseInsensitive) == 0) { options.build = false; } else if (argument.compare(QLatin1String("--install"), Qt::CaseInsensitive) == 0) { -- cgit v1.2.3 From 34e467b481059b275d919b057d847b7dd1917f57 Mon Sep 17 00:00:00 2001 From: Lars Schmertmann Date: Fri, 6 Dec 2019 07:52:05 +0100 Subject: Remove dead code to fix a lint warning Obsolete SDK_INT Version Check ------------------------------ This check flags version checks that are not necessary, because the minSdkVersion (or surrounding known API level) is already at least as high as the version checked for. The mindSdkVersion in templates/AndroidManifest.xml is 21 for Qt 5.14 and androiddeployqt also ensures that the minSdkVersion is not below 21. Change-Id: I452de5b152f572efc69e6b292a8b15dbbfba639b Reviewed-by: BogDan Vatra (cherry picked from commit b8e404f6d0631e04d30a864dc68b0574bfca90f1) --- .../qt5/android/bindings/QtActivityLoader.java | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/src/android/java/src/org/qtproject/qt5/android/bindings/QtActivityLoader.java b/src/android/java/src/org/qtproject/qt5/android/bindings/QtActivityLoader.java index 6beb5e3161..fad9588425 100644 --- a/src/android/java/src/org/qtproject/qt5/android/bindings/QtActivityLoader.java +++ b/src/android/java/src/org/qtproject/qt5/android/bindings/QtActivityLoader.java @@ -132,23 +132,6 @@ public class QtActivityLoader extends QtLoader { return; } - if (Build.VERSION.SDK_INT < 21) { - // fatal error, show the error and quit - AlertDialog errorDialog = new AlertDialog.Builder(m_activity).create(); - if (m_contextInfo.metaData.containsKey("android.app.unsupported_android_version")) - errorDialog.setMessage(m_contextInfo.metaData.getString("android.app.unsupported_android_version")); - else - errorDialog.setMessage("Unsupported Android version."); - errorDialog.setButton(m_activity.getResources().getString(android.R.string.ok), new DialogInterface.OnClickListener() { - @Override - public void onClick(DialogInterface dialog, int which) { - finish(); - } - }); - errorDialog.show(); - return; - } - try { m_activity.setTheme(Class.forName("android.R$style").getDeclaredField(QT_ANDROID_DEFAULT_THEME).getInt(null)); } catch (Exception e) { -- cgit v1.2.3 From 2385ab73be79e5eb69b4feb3d4c787060a56da5f Mon Sep 17 00:00:00 2001 From: Samuli Piippo Date: Tue, 7 Jan 2020 13:52:11 +0200 Subject: QInputDeviceManager: initialize device counts The device counts were used before they were initialized, causing problems e.g. with mouse cursor. Fixes: QTBUG-81207 Change-Id: Ic9dadcaebeb4c4a64bb506e4236d5a9260e0fdbc Reviewed-by: Paul Wicking --- src/gui/kernel/qinputdevicemanager_p_p.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/kernel/qinputdevicemanager_p_p.h b/src/gui/kernel/qinputdevicemanager_p_p.h index 871f9315c3..82a86446a0 100644 --- a/src/gui/kernel/qinputdevicemanager_p_p.h +++ b/src/gui/kernel/qinputdevicemanager_p_p.h @@ -69,7 +69,7 @@ public: int deviceCount(QInputDeviceManager::DeviceType type) const; void setDeviceCount(QInputDeviceManager::DeviceType type, int count); - std::array m_deviceCount; + std::array m_deviceCount = {}; Qt::KeyboardModifiers keyboardModifiers; }; -- cgit v1.2.3 From 6f1ae59ee6b82123f073fc8fd0ed6d010818041e Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Mon, 6 Jan 2020 13:25:30 +0100 Subject: Change getMacLocaleName() to return a QString MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Returning a QByteArray required doing a toUtf8() to a QString on one of its paths, which was promptly undone by its caller using fromUTf8(), since a QString was needed anyway. Drive-by - remove spurious default for parameter in method definition. Change-Id: I45f553d74cd0ba9dab25c439ba8291c00b7ceb5b Reviewed-by: Tor Arne Vestbø Reviewed-by: Thiago Macieira --- src/corelib/text/qlocale_mac.mm | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/corelib/text/qlocale_mac.mm b/src/corelib/text/qlocale_mac.mm index 9719278426..31ede1352b 100644 --- a/src/corelib/text/qlocale_mac.mm +++ b/src/corelib/text/qlocale_mac.mm @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2020 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the QtCore module of the Qt Toolkit. @@ -67,16 +67,16 @@ static QByteArray envVarLocale() return lang; } -static QByteArray getMacLocaleName() +static QString getMacLocaleName() { - QByteArray result = envVarLocale(); + QString result = QString::fromLocal8Bit(envVarLocale()); QString lang, script, cntry; if (result.isEmpty() - || (result != "C" && !qt_splitLocaleName(QString::fromLocal8Bit(result), lang, script, cntry))) { + || (result != QLatin1String("C") && !qt_splitLocaleName(result, lang, script, cntry))) { QCFType l = CFLocaleCopyCurrent(); CFStringRef locale = CFLocaleGetIdentifier(l); - result = QString::fromCFString(locale).toUtf8(); + result = QString::fromCFString(locale); } return result; } @@ -402,10 +402,10 @@ static QVariant macQuoteString(QSystemLocale::QueryType type, const QStringRef & QLocale QSystemLocale::fallbackUiLocale() const { - return QLocale(QString::fromUtf8(getMacLocaleName().constData())); + return QLocale(getMacLocaleName()); } -QVariant QSystemLocale::query(QueryType type, QVariant in = QVariant()) const +QVariant QSystemLocale::query(QueryType type, QVariant in) const { QMacAutoReleasePool pool; switch(type) { -- cgit v1.2.3 From bcc8cf5e3b7c139c762d957b02ddfcf75707bde0 Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Wed, 8 Jan 2020 11:30:35 +0100 Subject: Fix encoding inconsistency between tst_QNoDebug and QTestLog Fix tst_QNoDebug::streaming() to use toLocal8Bit(), to match QTestLog::ignoreMessage(), which uses fromLocal8Bit(). Change-Id: I65f7b995a582aeab7b7ba61781a229fecd1ed3c3 Reviewed-by: Thiago Macieira Reviewed-by: David Faure --- tests/auto/corelib/io/qnodebug/tst_qnodebug.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/auto/corelib/io/qnodebug/tst_qnodebug.cpp b/tests/auto/corelib/io/qnodebug/tst_qnodebug.cpp index b05c89a8bb..cf2079a407 100644 --- a/tests/auto/corelib/io/qnodebug/tst_qnodebug.cpp +++ b/tests/auto/corelib/io/qnodebug/tst_qnodebug.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2020 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the test suite of the Qt Toolkit. @@ -65,7 +65,7 @@ void tst_QNoDebug::noDebugOutput() const void tst_QNoDebug::streaming() const { QDateTime dt(QDate(1,2,3),QTime(4,5,6)); - const QByteArray debugString = dt.toString(u"yyyy-MM-dd HH:mm:ss.zzz t").toLatin1(); + const QByteArray debugString = dt.toString(u"yyyy-MM-dd HH:mm:ss.zzz t").toLocal8Bit(); const QByteArray message = "QDateTime(" + debugString + " Qt::LocalTime)"; QTest::ignoreMessage(QtWarningMsg, message.constData()); qWarning() << dt; -- cgit v1.2.3 From 70d484b5df6211546e17f336782f83a3f856965d Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Wed, 8 Jan 2020 17:05:15 +0100 Subject: Fix encoding expected by tst_qmessagehandler::qMessagePattern() The actual logging code, qt_message_print(), uses toLocal8Bit(), so testing by comaring with toUtf8() isn't robust. Change-Id: I7d6614e4af8c679674dbbf4ff47a88b2b75fc2dc Reviewed-by: Thiago Macieira --- tests/auto/corelib/global/qlogging/tst_qlogging.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/auto/corelib/global/qlogging/tst_qlogging.cpp b/tests/auto/corelib/global/qlogging/tst_qlogging.cpp index 17d0f86728..3af637d13a 100644 --- a/tests/auto/corelib/global/qlogging/tst_qlogging.cpp +++ b/tests/auto/corelib/global/qlogging/tst_qlogging.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2020 The Qt Company Ltd. ** Copyright (C) 2014 Olivier Goffart ** Contact: https://www.qt.io/licensing/ ** @@ -767,18 +767,18 @@ void tst_qmessagehandler::qMessagePattern_data() QTest::qWait(10000); QTest::newRow("time") << "/%{time yyyy - MM - d}/%{message}" << true << (QList() - << ('/' + QDateTime::currentDateTime().toString("yyyy - MM - d").toUtf8() + "/qDebug")); + << ('/' + QDateTime::currentDateTime().toString("yyyy - MM - d").toLocal8Bit() + "/qDebug")); QTest::newRow("time-time") << "/%{time yyyy - MM - d}/%{time dd-MM-yy}/%{message}" << true << (QList() - << ('/' + QDateTime::currentDateTime().toString("yyyy - MM - d").toUtf8() - + '/' + QDateTime::currentDateTime().toString("dd-MM-yy").toUtf8() + << ('/' + QDateTime::currentDateTime().toString("yyyy - MM - d").toLocal8Bit() + + '/' + QDateTime::currentDateTime().toString("dd-MM-yy").toLocal8Bit() + "/qDebug")); QTest::newRow("skipped-time-shown-time") << "/%{if-warning}%{time yyyy - MM - d}%{endif}%{if-debug}%{time dd-MM-yy}%{endif}/%{message}" << true << (QList() - << ('/' + QDateTime::currentDateTime().toString("dd-MM-yy").toUtf8() + "/qDebug")); + << ('/' + QDateTime::currentDateTime().toString("dd-MM-yy").toLocal8Bit() + "/qDebug")); // %{time} should have a padding of 6 so if it takes less than 10 seconds to show // the first message, there should be 5 spaces -- cgit v1.2.3 From 6224130cc821b0ef0dbdda80837e872c7996b916 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pasi=20Pet=C3=A4j=C3=A4j=C3=A4rvi?= Date: Thu, 19 Dec 2019 13:01:21 +0200 Subject: Add touch input device mapping support via QT_QPA_EGLFS_KMS_CONFIG To be feature parity with evdev touch which already supports this Change-Id: Ie7f9c868ea888725b24c3855106e1c0c0ba943a9 Reviewed-by: Laszlo Agocs --- .../input/libinput/qlibinputtouch.cpp | 40 +++++++++++++++++++--- .../input/libinput/qlibinputtouch_p.h | 7 +++- 2 files changed, 41 insertions(+), 6 deletions(-) diff --git a/src/platformsupport/input/libinput/qlibinputtouch.cpp b/src/platformsupport/input/libinput/qlibinputtouch.cpp index ad85360b0e..e1abd44eb5 100644 --- a/src/platformsupport/input/libinput/qlibinputtouch.cpp +++ b/src/platformsupport/input/libinput/qlibinputtouch.cpp @@ -38,6 +38,7 @@ ****************************************************************************/ #include "qlibinputtouch_p.h" +#include "qtouchoutputmapping_p.h" #include #include #include @@ -45,6 +46,8 @@ QT_BEGIN_NAMESPACE +Q_DECLARE_LOGGING_CATEGORY(qLcLibInput) + QWindowSystemInterface::TouchPoint *QLibInputTouch::DeviceState::point(int32_t slot) { const int id = qMax(0, slot); @@ -62,12 +65,23 @@ QLibInputTouch::DeviceState *QLibInputTouch::deviceState(libinput_event_touch *e return &m_devState[dev]; } -static inline QPointF getPos(libinput_event_touch *e) +QPointF QLibInputTouch::getPos(libinput_event_touch *e) { - // TODO Map to correct screen using QTouchOutputMapping. - // Perhaps investigate libinput_device_get_output_name as well. - // For now just use the primary screen. + DeviceState *state = deviceState(e); QScreen *screen = QGuiApplication::primaryScreen(); + if (!state->m_screenName.isEmpty()) { + if (!m_screen) { + const QList screens = QGuiApplication::screens(); + for (QScreen *s : screens) { + if (s->name() == state->m_screenName) { + m_screen = s; + break; + } + } + } + if (m_screen) + screen = m_screen; + } const QRect geom = QHighDpi::toNativePixels(screen->geometry(), screen); const double x = libinput_event_touch_get_x_transformed(e, geom.width()); const double y = libinput_event_touch_get_y_transformed(e, geom.height()); @@ -76,9 +90,25 @@ static inline QPointF getPos(libinput_event_touch *e) void QLibInputTouch::registerDevice(libinput_device *dev) { + struct udev_device *udev_device; + udev_device = libinput_device_get_udev_device(dev); + QString devNode = QString::fromUtf8(udev_device_get_devnode(udev_device)); + QString devName = QString::fromUtf8(libinput_device_get_name(dev)); + + qCDebug(qLcLibInput, "libinput: registerDevice %s - %s", + qPrintable(devNode), qPrintable(devName)); + + QTouchOutputMapping mapping; + if (mapping.load()) { + m_devState[dev].m_screenName = mapping.screenNameForDeviceNode(devNode); + if (!m_devState[dev].m_screenName.isEmpty()) + qCDebug(qLcLibInput, "libinput: Mapping device %s to screen %s", + qPrintable(devNode), qPrintable(m_devState[dev].m_screenName)); + } + QTouchDevice *&td = m_devState[dev].m_touchDevice; td = new QTouchDevice; - td->setName(QString::fromUtf8(libinput_device_get_name(dev))); + td->setName(devName); td->setType(QTouchDevice::TouchScreen); td->setCapabilities(QTouchDevice::Position | QTouchDevice::Area); QWindowSystemInterface::registerTouchDevice(td); diff --git a/src/platformsupport/input/libinput/qlibinputtouch_p.h b/src/platformsupport/input/libinput/qlibinputtouch_p.h index 51304e6a21..2682b83b26 100644 --- a/src/platformsupport/input/libinput/qlibinputtouch_p.h +++ b/src/platformsupport/input/libinput/qlibinputtouch_p.h @@ -42,6 +42,7 @@ #include #include +#include #include // @@ -60,6 +61,7 @@ struct libinput_device; QT_BEGIN_NAMESPACE +class QScreen; class QLibInputTouch { public: @@ -73,15 +75,18 @@ public: private: struct DeviceState { - DeviceState() : m_touchDevice(nullptr) { } + DeviceState() : m_touchDevice(nullptr), m_screenName() { } QWindowSystemInterface::TouchPoint *point(int32_t slot); QList m_points; QTouchDevice *m_touchDevice; + QString m_screenName; }; DeviceState *deviceState(libinput_event_touch *e); + QPointF getPos(libinput_event_touch *e); QHash m_devState; + mutable QPointer m_screen; }; QT_END_NAMESPACE -- cgit v1.2.3 From f91af791cc3be1dfb9645ed4ebba10a7d9f74134 Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Tue, 7 Jan 2020 15:06:54 +0100 Subject: Add advance warning of change of return types coming in Qt6 The QLocale methods that report the fragments used in making up numbers all return QChar. A note dating from before Qt5 times warned that we need to change these to return QString (since we might need a surrogate pair to represent the relevant characters). Give advance warning in the documentation that this shall happen at Qt 6. [ChangeLog][QtCore][QLocale] decimalPoint(), groupSeparator(), percent(), zeroDigit(), negativeSign(), positiveSign() and exponential() still return QChar but shall be changed to return QString in Qt 6. Callers are encouraged to switch to QString early, exploiting the QString(QChar) constructor. Task-number: QTBUG-81053 Change-Id: Ia802c7665676ecf13669c6a6f173f2e70eac578e Reviewed-by: Paul Wicking --- src/corelib/text/qlocale.cpp | 30 +++++++++++++++++++++++++++++- src/corelib/text/qlocale.h | 6 +++--- 2 files changed, 32 insertions(+), 4 deletions(-) diff --git a/src/corelib/text/qlocale.cpp b/src/corelib/text/qlocale.cpp index 425cb87d31..dd3263e5aa 100644 --- a/src/corelib/text/qlocale.cpp +++ b/src/corelib/text/qlocale.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2019 The Qt Company Ltd. +** Copyright (C) 2020 The Qt Company Ltd. ** Copyright (C) 2019 Intel Corporation. ** Contact: https://www.qt.io/licensing/ ** @@ -2525,6 +2525,10 @@ QDateTime QLocale::toDateTime(const QString &string, const QString &format, QCal \since 4.1 Returns the decimal point character of this locale. + + \note This function shall change to return a QString instead of QChar in + Qt6. Callers are encouraged to exploit the QString(QChar) constructor to + convert early in preparation for this. */ QChar QLocale::decimalPoint() const { @@ -2535,6 +2539,10 @@ QChar QLocale::decimalPoint() const \since 4.1 Returns the group separator character of this locale. + + \note This function shall change to return a QString instead of QChar in + Qt6. Callers are encouraged to exploit the QString(QChar) constructor to + convert early in preparation for this. */ QChar QLocale::groupSeparator() const { @@ -2545,6 +2553,10 @@ QChar QLocale::groupSeparator() const \since 4.1 Returns the percent character of this locale. + + \note This function shall change to return a QString instead of QChar in + Qt6. Callers are encouraged to exploit the QString(QChar) constructor to + convert early in preparation for this. */ QChar QLocale::percent() const { @@ -2555,6 +2567,10 @@ QChar QLocale::percent() const \since 4.1 Returns the zero digit character of this locale. + + \note This function shall change to return a QString instead of QChar in + Qt6. Callers are encouraged to exploit the QString(QChar) constructor to + convert early in preparation for this. */ QChar QLocale::zeroDigit() const { @@ -2565,6 +2581,10 @@ QChar QLocale::zeroDigit() const \since 4.1 Returns the negative sign character of this locale. + + \note This function shall change to return a QString instead of QChar in + Qt6. Callers are encouraged to exploit the QString(QChar) constructor to + convert early in preparation for this. */ QChar QLocale::negativeSign() const { @@ -2575,6 +2595,10 @@ QChar QLocale::negativeSign() const \since 4.5 Returns the positive sign character of this locale. + + \note This function shall change to return a QString instead of QChar in + Qt6. Callers are encouraged to exploit the QString(QChar) constructor to + convert early in preparation for this. */ QChar QLocale::positiveSign() const { @@ -2585,6 +2609,10 @@ QChar QLocale::positiveSign() const \since 4.1 Returns the exponential character of this locale. + + \note This function shall change to return a QString instead of QChar in + Qt6. Callers are encouraged to exploit the QString(QChar) constructor to + convert early in preparation for this. */ QChar QLocale::exponential() const { diff --git a/src/corelib/text/qlocale.h b/src/corelib/text/qlocale.h index 8b73eb5493..513e0f097b 100644 --- a/src/corelib/text/qlocale.h +++ b/src/corelib/text/qlocale.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2019 The Qt Company Ltd. +** Copyright (C) 2020 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the QtCore module of the Qt Toolkit. @@ -1044,8 +1044,8 @@ public: QDateTime toDateTime(const QString &string, const QString &format, QCalendar cal) const; #endif - // ### Qt 5: We need to return QString from these function since - // unicode data contains several characters for these fields. + // ### Qt 6: We need to return QString from these function since + // UTF-16 may need surrogate pairs to represent these fields. QChar decimalPoint() const; QChar groupSeparator() const; QChar percent() const; -- cgit v1.2.3 From 0f80452b924230013d713c2bc6681efc0e654a1b Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Wed, 8 Jan 2020 12:00:09 +0100 Subject: Improve QLocale method documentation Add missing \sa lines, clarify what the exponential character is and mention that C is an exception to the "no number options set". Change-Id: I13ca483a07738908640408e0ca512de31586cec9 Reviewed-by: Paul Wicking Reviewed-by: Thiago Macieira --- src/corelib/text/qlocale.cpp | 30 +++++++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-) diff --git a/src/corelib/text/qlocale.cpp b/src/corelib/text/qlocale.cpp index dd3263e5aa..e3e0ebdcbd 100644 --- a/src/corelib/text/qlocale.cpp +++ b/src/corelib/text/qlocale.cpp @@ -1048,6 +1048,8 @@ uint qHash(const QLocale &key, uint seed) noexcept Sets the \a options related to number conversions for this QLocale instance. + + \sa numberOptions() */ void QLocale::setNumberOptions(NumberOptions options) { @@ -1060,7 +1062,10 @@ void QLocale::setNumberOptions(NumberOptions options) Returns the options related to number conversions for this QLocale instance. - By default, no options are set for the standard locales. + By default, no options are set for the standard locales, except + for the "C" locale, which has OmitGroupSeparator set by default. + + \sa setNumberOptions(), toString(), groupSeparator() */ QLocale::NumberOptions QLocale::numberOptions() const { @@ -1962,7 +1967,7 @@ double QLocale::toDouble(QStringView s, bool *ok) const /*! Returns a localized string representation of \a i. - \sa toLongLong() + \sa toLongLong(), numberOptions(), zeroDigit(), positiveSign() */ QString QLocale::toString(qlonglong i) const @@ -1978,7 +1983,7 @@ QString QLocale::toString(qlonglong i) const /*! \overload - \sa toULongLong() + \sa toULongLong(), numberOptions(), zeroDigit(), positiveSign() */ QString QLocale::toString(qulonglong i) const @@ -2529,6 +2534,8 @@ QDateTime QLocale::toDateTime(const QString &string, const QString &format, QCal \note This function shall change to return a QString instead of QChar in Qt6. Callers are encouraged to exploit the QString(QChar) constructor to convert early in preparation for this. + + \sa groupSeparator(), toString() */ QChar QLocale::decimalPoint() const { @@ -2543,6 +2550,8 @@ QChar QLocale::decimalPoint() const \note This function shall change to return a QString instead of QChar in Qt6. Callers are encouraged to exploit the QString(QChar) constructor to convert early in preparation for this. + + \sa decimalPoint(), toString() */ QChar QLocale::groupSeparator() const { @@ -2557,6 +2566,8 @@ QChar QLocale::groupSeparator() const \note This function shall change to return a QString instead of QChar in Qt6. Callers are encouraged to exploit the QString(QChar) constructor to convert early in preparation for this. + + \sa toString() */ QChar QLocale::percent() const { @@ -2571,6 +2582,8 @@ QChar QLocale::percent() const \note This function shall change to return a QString instead of QChar in Qt6. Callers are encouraged to exploit the QString(QChar) constructor to convert early in preparation for this. + + \sa toString() */ QChar QLocale::zeroDigit() const { @@ -2585,6 +2598,8 @@ QChar QLocale::zeroDigit() const \note This function shall change to return a QString instead of QChar in Qt6. Callers are encouraged to exploit the QString(QChar) constructor to convert early in preparation for this. + + \sa positiveSign(), toString() */ QChar QLocale::negativeSign() const { @@ -2599,6 +2614,8 @@ QChar QLocale::negativeSign() const \note This function shall change to return a QString instead of QChar in Qt6. Callers are encouraged to exploit the QString(QChar) constructor to convert early in preparation for this. + + \sa negativeSign(), toString() */ QChar QLocale::positiveSign() const { @@ -2608,11 +2625,14 @@ QChar QLocale::positiveSign() const /*! \since 4.1 - Returns the exponential character of this locale. + Returns the exponential character of this locale, used to separate exponent + from mantissa in some floating-point numeric representations. \note This function shall change to return a QString instead of QChar in Qt6. Callers are encouraged to exploit the QString(QChar) constructor to convert early in preparation for this. + + \sa toString(double, char, int) */ QChar QLocale::exponential() const { @@ -2637,7 +2657,7 @@ static char qToLower(char c) \a f and \a prec have the same meaning as in QString::number(double, char, int). - \sa toDouble() + \sa toDouble(), numberOptions(), exponential(), decimalPoint(), zeroDigit(), positiveSign(), percent() */ QString QLocale::toString(double i, char f, int prec) const -- cgit v1.2.3 From 11c5c078c7743050a115a4dcc31f52caaa378e35 Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Mon, 6 Jan 2020 12:11:28 +0100 Subject: Eliminate QLocale's default_number_options global static It had create()'s default number options when passed to create, so wasn't useful then; and otherwise shadowed the value held by the cached private for the default locale. Noticed in the course of adding an analogous global for the system locale. Drive-by - eliminated a redundant language != C check. Change-Id: I5601dc09188804c11dede5be460bfdd12b8152ce Reviewed-by: Thiago Macieira --- src/corelib/text/qlocale.cpp | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/corelib/text/qlocale.cpp b/src/corelib/text/qlocale.cpp index e3e0ebdcbd..e3530eeee1 100644 --- a/src/corelib/text/qlocale.cpp +++ b/src/corelib/text/qlocale.cpp @@ -651,7 +651,6 @@ int qt_repeatCount(QStringView s) } static const QLocaleData *default_data = nullptr; -static QLocale::NumberOptions default_number_options = QLocale::DefaultNumberOptions; static const QLocaleData *const c_data = locale_data; static QLocalePrivate *c_private() @@ -834,7 +833,7 @@ QDataStream &operator>>(QDataStream &ds, QLocale &l) static const int locale_data_size = sizeof(locale_data)/sizeof(QLocaleData) - 1; Q_GLOBAL_STATIC_WITH_ARGS(QSharedDataPointer, defaultLocalePrivate, - (QLocalePrivate::create(defaultData(), default_number_options))) + (QLocalePrivate::create(defaultData()))) Q_GLOBAL_STATIC_WITH_ARGS(QExplicitlySharedDataPointer, systemLocalePrivate, (QLocalePrivate::create(systemData()))) @@ -862,8 +861,9 @@ static QLocalePrivate *findLocalePrivate(QLocale::Language language, QLocale::Sc QLocale::NumberOptions numberOptions = QLocale::DefaultNumberOptions; // If not found, should default to system - if (data->m_language_id == QLocale::C && language != QLocale::C) { - numberOptions = default_number_options; + if (data->m_language_id == QLocale::C) { + if (defaultLocalePrivate.exists()) + numberOptions = defaultLocalePrivate->data()->m_numberOptions; data = defaultData(); } return QLocalePrivate::create(data, offset, numberOptions); @@ -1175,12 +1175,9 @@ QString QLocale::createSeparatedList(const QStringList &list) const void QLocale::setDefault(const QLocale &locale) { default_data = locale.d->m_data; - default_number_options = locale.numberOptions(); - if (defaultLocalePrivate.exists()) { - // update the cached private + if (defaultLocalePrivate.exists()) // update the cached private *defaultLocalePrivate = locale.d; - } } /*! -- cgit v1.2.3 From 8bfdb25c1f83fb595e3efd07ae5d6632a4638187 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Wed, 8 Jan 2020 13:47:01 +0100 Subject: Doc: Extend the documentation about qmake scopes Fixes: QTBUG-18025 Change-Id: I2b587266cde2002d965dc824a869be255cf3522e Reviewed-by: Paul Wicking --- qmake/doc/snippets/qmake/scopes.pro | 18 ++++++++++++++++++ qmake/doc/src/qmake-manual.qdoc | 14 ++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/qmake/doc/snippets/qmake/scopes.pro b/qmake/doc/snippets/qmake/scopes.pro index 63b9b3aa55..6721937755 100644 --- a/qmake/doc/snippets/qmake/scopes.pro +++ b/qmake/doc/snippets/qmake/scopes.pro @@ -40,3 +40,21 @@ win32|macx { HEADERS += debugging.h } #! [4] + +#! [5] +if(win32|macos):CONFIG(debug, debug|release) { + # Do something on Windows and macOS, + # but only for the debug configuration. +} +win32|if(macos:CONFIG(debug, debug|release)) { + # Do something on Windows (regardless of debug or release) + # and on macOS (only for debug). +} +#! [5] + +#! [6] +win32-* { + # Matches every mkspec starting with "win32-" + SOURCES += win32_specific.cpp +} +#! [6] diff --git a/qmake/doc/src/qmake-manual.qdoc b/qmake/doc/src/qmake-manual.qdoc index b002521a8e..64c5f0a14e 100644 --- a/qmake/doc/src/qmake-manual.qdoc +++ b/qmake/doc/src/qmake-manual.qdoc @@ -4418,6 +4418,20 @@ \snippet qmake/scopes.pro 4 + If you need to mix both operators, you can use the \c if function to specify + operator precedence. + + \snippet qmake/scopes.pro 5 + + The condition accepts the wildcard character to match a family of \c{CONFIG} + values or mkspec names. + + \snippet qmake/scopes.pro 6 + + \note Historically, checking the mkspec name with wildcards like above was + qmake's way to check for the platform. Nowadays, we recommend to use values + that are defined by the mkspec in the \c QMAKE_PLATFORM variable. + You can also provide alternative declarations to those within a scope by using an \c else scope. Each \c else scope is processed if the conditions for the preceding scopes are false. -- cgit v1.2.3 From 1e42c97cf055ac20352d20150e2786c14565ea2b Mon Sep 17 00:00:00 2001 From: Jani Heikkinen Date: Wed, 8 Jan 2020 15:11:21 +0200 Subject: Bump copyright year MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I9468ef21a2cf03cf07c38f012a2aa9bae6d02a03 Reviewed-by: Johanna Äijälä Reviewed-by: Friedemann Kleint --- doc/global/config.qdocconf | 2 +- doc/global/html-footer-online.qdocconf | 2 +- doc/global/html-footer.qdocconf | 2 +- doc/global/qt-module-defaults-online.qdocconf | 2 +- mkspecs/features/qt_targets.prf | 2 +- src/tools/qdbuscpp2xml/qdbuscpp2xml.cpp | 4 ++-- src/tools/qdbusxml2cpp/qdbusxml2cpp.cpp | 4 ++-- src/widgets/dialogs/qmessagebox.cpp | 4 ++-- 8 files changed, 11 insertions(+), 11 deletions(-) diff --git a/doc/global/config.qdocconf b/doc/global/config.qdocconf index 16d4e5c63a..8df9b4f30d 100644 --- a/doc/global/config.qdocconf +++ b/doc/global/config.qdocconf @@ -3,7 +3,7 @@ dita.metadata.default.author = Qt Project dita.metadata.default.permissions = all dita.metadata.default.publisher = Qt Project -dita.metadata.default.copyryear = 2019 +dita.metadata.default.copyryear = 2020 dita.metadata.default.copyrholder = The Qt Company Ltd dita.metadata.default.audience = programmer diff --git a/doc/global/html-footer-online.qdocconf b/doc/global/html-footer-online.qdocconf index c4465fce66..f255726c1d 100644 --- a/doc/global/html-footer-online.qdocconf +++ b/doc/global/html-footer-online.qdocconf @@ -78,7 +78,7 @@ HTML.footer += \ " \n" \ "\n" \ "\n" \ diff --git a/doc/global/html-footer.qdocconf b/doc/global/html-footer.qdocconf index 04f7fa0d79..5c29851e90 100644 --- a/doc/global/html-footer.qdocconf +++ b/doc/global/html-footer.qdocconf @@ -8,7 +8,7 @@ HTML.footer = \ "\n" \ "
\n" \ "

\n" \ - " © 2019 The Qt Company Ltd.\n" \ + " © 2020 The Qt Company Ltd.\n" \ " Documentation contributions included herein are the copyrights of\n" \ " their respective owners.
" \ " The documentation provided herein is licensed under the terms of the" \ diff --git a/doc/global/qt-module-defaults-online.qdocconf b/doc/global/qt-module-defaults-online.qdocconf index f2e897db65..41fb8acc66 100644 --- a/doc/global/qt-module-defaults-online.qdocconf +++ b/doc/global/qt-module-defaults-online.qdocconf @@ -5,7 +5,7 @@ HTML.footer = \ "

\n" \ "

\n" \ - " © 2019 The Qt Company Ltd.\n" \ + " © 2020 The Qt Company Ltd.\n" \ " Documentation contributions included herein are the copyrights of\n" \ " their respective owners. " \ " The documentation provided herein is licensed under the terms of the" \ diff --git a/mkspecs/features/qt_targets.prf b/mkspecs/features/qt_targets.prf index b3c289a90b..3810d1e0ad 100644 --- a/mkspecs/features/qt_targets.prf +++ b/mkspecs/features/qt_targets.prf @@ -1,4 +1,4 @@ QMAKE_TARGET_COMPANY = The Qt Company Ltd. isEmpty(QMAKE_TARGET_PRODUCT): QMAKE_TARGET_PRODUCT = Qt5 isEmpty(QMAKE_TARGET_DESCRIPTION): QMAKE_TARGET_DESCRIPTION = C++ Application Development Framework -QMAKE_TARGET_COPYRIGHT = Copyright (C) 2019 The Qt Company Ltd. +QMAKE_TARGET_COPYRIGHT = Copyright (C) 2020 The Qt Company Ltd. diff --git a/src/tools/qdbuscpp2xml/qdbuscpp2xml.cpp b/src/tools/qdbuscpp2xml/qdbuscpp2xml.cpp index 522c55593f..81ebafad79 100644 --- a/src/tools/qdbuscpp2xml/qdbuscpp2xml.cpp +++ b/src/tools/qdbuscpp2xml/qdbuscpp2xml.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2020 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the tools applications of the Qt Toolkit. @@ -61,7 +61,7 @@ static const char docTypeHeader[] = #define PROGRAMNAME "qdbuscpp2xml" #define PROGRAMVERSION "0.2" -#define PROGRAMCOPYRIGHT "Copyright (C) 2019 The Qt Company Ltd." +#define PROGRAMCOPYRIGHT "Copyright (C) 2020 The Qt Company Ltd." static QString outputFile; static int flags; diff --git a/src/tools/qdbusxml2cpp/qdbusxml2cpp.cpp b/src/tools/qdbusxml2cpp/qdbusxml2cpp.cpp index ce4232f3e8..9cf753a3f1 100644 --- a/src/tools/qdbusxml2cpp/qdbusxml2cpp.cpp +++ b/src/tools/qdbusxml2cpp/qdbusxml2cpp.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2020 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the tools applications of the Qt Toolkit. @@ -46,7 +46,7 @@ #define PROGRAMNAME "qdbusxml2cpp" #define PROGRAMVERSION "0.8" -#define PROGRAMCOPYRIGHT "Copyright (C) 2019 The Qt Company Ltd." +#define PROGRAMCOPYRIGHT "Copyright (C) 2020 The Qt Company Ltd." #define ANNOTATION_NO_WAIT "org.freedesktop.DBus.Method.NoReply" diff --git a/src/widgets/dialogs/qmessagebox.cpp b/src/widgets/dialogs/qmessagebox.cpp index 8dad212692..e20657a0f6 100644 --- a/src/widgets/dialogs/qmessagebox.cpp +++ b/src/widgets/dialogs/qmessagebox.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2018 The Qt Company Ltd. +** Copyright (C) 2020 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the QtWidgets module of the Qt Toolkit. @@ -1890,7 +1890,7 @@ void QMessageBox::aboutQt(QWidget *parent, const QString &title) "

Qt and the Qt logo are trademarks of The Qt Company Ltd.

" "

Qt is The Qt Company Ltd product developed as an open source " "project. See %3 for more information.

" - ).arg(QStringLiteral("2019"), + ).arg(QStringLiteral("2020"), QStringLiteral("qt.io/licensing"), QStringLiteral("qt.io")); QMessageBox *msgBox = new QMessageBox(parent); -- cgit v1.2.3 From 1c75f59588694557caba69c2fc173dd8f1d7f514 Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Wed, 8 Jan 2020 14:48:12 +0100 Subject: iOS: Handle positionFromPosition out of bounds MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Based on the documentation for positionFromPosition, if the resulting position is less than 0 or longer than the text, then we should return nil. This fixes problems with placement of the cursor and selection rectangle when auto-completion is used. Fixes: QTBUG-79445 Change-Id: I44a18881527a8a22012fe5fcbbc3216e60c48bc9 Reviewed-by: Tor Arne Vestbø --- src/plugins/platforms/ios/qiostextresponder.mm | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/ios/qiostextresponder.mm b/src/plugins/platforms/ios/qiostextresponder.mm index 1bc9744528..a3350bda87 100644 --- a/src/plugins/platforms/ios/qiostextresponder.mm +++ b/src/plugins/platforms/ios/qiostextresponder.mm @@ -745,7 +745,11 @@ - (UITextPosition *)positionFromPosition:(UITextPosition *)position offset:(NSInteger)offset { int p = static_cast(position).index; - return [QUITextPosition positionWithIndex:p + offset]; + const int posWithIndex = p + offset; + const int textLength = [self currentImeState:Qt::ImSurroundingText].toString().length(); + if (posWithIndex < 0 || posWithIndex > textLength) + return nil; + return [QUITextPosition positionWithIndex:posWithIndex]; } - (UITextPosition *)positionFromPosition:(UITextPosition *)position inDirection:(UITextLayoutDirection)direction offset:(NSInteger)offset -- cgit v1.2.3