From a1f4321bbba2f3bff24d753ce766be738dbfa61a Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Tue, 3 Dec 2019 15:12:51 +0100 Subject: QTextDocument: Give fontFamily() precedence over fontFamilies() If the singular fontFamily() is given, then this is obviously the one to be preferred over any plural fontFamilies(). Make sure it always ends up first in the list of emitted font families. Change-Id: I1e3b1ba29721c8298b1a0d4a1e1da49ba5b4e7ac Fixes: QTBUG-80475 Reviewed-by: Lars Knoll --- src/gui/text/qtextdocument.cpp | 39 ++++++++++++++------------------------- src/gui/text/qtextdocument_p.h | 1 - 2 files changed, 14 insertions(+), 26 deletions(-) (limited to 'src') diff --git a/src/gui/text/qtextdocument.cpp b/src/gui/text/qtextdocument.cpp index 4b35509ace..25c153910d 100644 --- a/src/gui/text/qtextdocument.cpp +++ b/src/gui/text/qtextdocument.cpp @@ -2297,6 +2297,17 @@ QTextHtmlExporter::QTextHtmlExporter(const QTextDocument *_doc) defaultCharFormat.clearProperty(QTextFormat::TextUnderlineStyle); } +static QStringList resolvedFontFamilies(const QTextCharFormat &format) +{ + QStringList fontFamilies = format.fontFamilies().toStringList(); + const QString mainFontFamily = format.fontFamily(); + if (!mainFontFamily.isEmpty() && !fontFamilies.startsWith(mainFontFamily)) { + fontFamilies.removeAll(mainFontFamily); + fontFamilies.prepend(mainFontFamily); + } + return fontFamilies; +} + /*! Returns the document in HTML format. The conversion may not be perfect, especially for complex documents, due to the limitations @@ -2325,11 +2336,7 @@ QString QTextHtmlExporter::toHtml(const QByteArray &encoding, ExportMode mode) if (mode == ExportEntireDocument) { html += QLatin1String(" style=\""); - QStringList fontFamilies = defaultCharFormat.fontFamilies().toStringList(); - if (!fontFamilies.isEmpty()) - emitFontFamily(fontFamilies); - else - emitFontFamily(defaultCharFormat.fontFamily()); + emitFontFamily(resolvedFontFamilies(defaultCharFormat)); if (defaultCharFormat.hasProperty(QTextFormat::FontPointSize)) { html += QLatin1String(" font-size:"); @@ -2391,14 +2398,10 @@ bool QTextHtmlExporter::emitCharFormatStyle(const QTextCharFormat &format) bool attributesEmitted = false; { - const QStringList families = format.fontFamilies().toStringList(); - const QString family = format.fontFamily(); - if (!families.isEmpty() && families != defaultCharFormat.fontFamilies().toStringList()) { + const QStringList families = resolvedFontFamilies(format); + if (!families.isEmpty() && families != resolvedFontFamilies(defaultCharFormat)) { emitFontFamily(families); attributesEmitted = true; - } else if (!family.isEmpty() && family != defaultCharFormat.fontFamily()) { - emitFontFamily(family); - attributesEmitted = true; } } @@ -2661,20 +2664,6 @@ void QTextHtmlExporter::emitPageBreakPolicy(QTextFormat::PageBreakFlags policy) html += QLatin1String(" page-break-after:always;"); } -void QTextHtmlExporter::emitFontFamily(const QString &family) -{ - html += QLatin1String(" font-family:"); - - QLatin1String quote("\'"); - if (family.contains(QLatin1Char('\''))) - quote = QLatin1String("""); - - html += quote; - html += family.toHtmlEscaped(); - html += quote; - html += QLatin1Char(';'); -} - void QTextHtmlExporter::emitFontFamily(const QStringList &families) { html += QLatin1String(" font-family:"); diff --git a/src/gui/text/qtextdocument_p.h b/src/gui/text/qtextdocument_p.h index f4e7a25f22..40252c93eb 100644 --- a/src/gui/text/qtextdocument_p.h +++ b/src/gui/text/qtextdocument_p.h @@ -396,7 +396,6 @@ private: void emitBorderStyle(QTextFrameFormat::BorderStyle style); void emitPageBreakPolicy(QTextFormat::PageBreakFlags policy); - void emitFontFamily(const QString &family); void emitFontFamily(const QStringList &families); void emitBackgroundAttribute(const QTextFormat &format); -- cgit v1.2.3 From c027d9b61e15ab021a6fb5503e3206929055da02 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Thu, 2 Jan 2020 12:22:02 +0100 Subject: Remove commented out code added by mistake in 7ac4e55cb979d MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Ibd53518be9d2b29dd880912bdb81c06435543789 Reviewed-by: Tor Arne Vestbø --- src/plugins/platforms/cocoa/qcocoaintegration.mm | 2 -- 1 file changed, 2 deletions(-) (limited to 'src') diff --git a/src/plugins/platforms/cocoa/qcocoaintegration.mm b/src/plugins/platforms/cocoa/qcocoaintegration.mm index d8c931e9a1..b7f15a2bf1 100644 --- a/src/plugins/platforms/cocoa/qcocoaintegration.mm +++ b/src/plugins/platforms/cocoa/qcocoaintegration.mm @@ -396,8 +396,6 @@ QVariant QCocoaIntegration::styleHint(StyleHint hint) const return QCoreTextFontEngine::fontSmoothingGamma(); case ShowShortcutsInContextMenus: return QVariant(false); - // case CursorFlashTime: - // return 50000; default: break; } -- cgit v1.2.3 From a6f56251ca6090cb0ba4c4989d7ccc638b1dbe2b Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Thu, 2 Jan 2020 12:24:15 +0100 Subject: Fix some qdoc warnings src/corelib/tools/qhash.cpp:2596: (qdoc) warning: clang found diagnostics parsing \fn template template QMultiHash::QMultiHash(InputIterator begin, InputIterator end) error: 'QMultiHash' is not a class, namespace, or enumeration src/corelib/kernel/qobject.cpp:4593: (qdoc) warning: Undocumented parameter 'EXPORT_MACRO' in QObject::Q_NAMESPACE_EXPORT src/corelib/global/qfloat16.cpp:129: (qdoc) warning: Cannot tie this documentation to anything src/corelib/text/qlocale.qdoc:1204: (qdoc) warning: Overrides a previous doc src/corelib/text/qlocale.qdoc:1187: (qdoc) warning: (The previous doc is here) src/network/kernel/qhostinfo.cpp:597: (qdoc) warning: clang found diagnostics parsing \fn QHostInfo(QHostInfo &&other) src/printsupport/dialogs/qabstractprintdialog.cpp:346: (qdoc) warning: clang found diagnostics parsing \fn int QAbstractPrintDialog::exec(): error: out-of-line definition of 'exec' does not match any declaration in 'QAbstractPrintDialog' src/testlib/qsignalspy.qdoc:101: (qdoc) warning: clang found diagnostics parsing \fn QSignalSpy(const QObject *obj, const QMetaMethod &signal): error: expected unqualified-id src/testlib/doc/src/qttest-best-practices.qdoc:28: (qdoc) warning: Can't link to 'Q_VERIFY2()' src/widgets/kernel/qactiongroup.cpp:291: (qdoc) warning: Undocumented parameter 'b' in QActionGroup::setExclusive() src/widgets/kernel/qactiongroup.cpp:305: (qdoc) warning: Undocumented return value (hint: use 'return' or 'returns' in the text src/widgets/kernel/qshortcut.cpp:542: (qdoc) warning: No such parameter 'context' in QShortcut::QShortcut() src/widgets/widgets/qdatetimeedit.cpp:632: (qdoc) warning: No such parameter 'minimumTime' in QDateTimeEdit::setTimeRange() src/widgets/widgets/qdatetimeedit.cpp:632: (qdoc) warning: No such parameter 'maximumTime' in QDateTimeEdit::setTimeRange() src/widgets/widgets/qdatetimeedit.cpp:632: (qdoc) warning: No such parameter 'less' in QDateTimeEdit::setTimeRange() Change-Id: I9799b5135e84c4d811674b2d114ef27315bc12df Reviewed-by: Paul Wicking --- src/corelib/global/qfloat16.cpp | 8 ++++---- src/corelib/kernel/qobject.cpp | 2 +- src/corelib/text/qlocale.qdoc | 8 -------- src/corelib/tools/qhash.cpp | 2 +- src/network/kernel/qhostinfo.cpp | 2 +- src/printsupport/dialogs/qabstractprintdialog.cpp | 7 ------- src/testlib/doc/src/qttest-best-practices.qdoc | 2 +- src/testlib/qsignalspy.qdoc | 2 +- src/widgets/kernel/qactiongroup.cpp | 5 +++-- src/widgets/kernel/qshortcut.cpp | 2 +- src/widgets/widgets/qdatetimeedit.cpp | 7 +++---- 11 files changed, 16 insertions(+), 31 deletions(-) (limited to 'src') diff --git a/src/corelib/global/qfloat16.cpp b/src/corelib/global/qfloat16.cpp index 6c21b7de5a..c868e879b7 100644 --- a/src/corelib/global/qfloat16.cpp +++ b/src/corelib/global/qfloat16.cpp @@ -109,7 +109,7 @@ QT_BEGIN_NAMESPACE /*! \internal \since 5.14 - bool qfloat16::isInf() const noexcept + \fn bool qfloat16::isInf() const noexcept Tests whether this \c qfloat16 value is an infinity. @@ -119,7 +119,7 @@ QT_BEGIN_NAMESPACE /*! \internal \since 5.14 - bool qfloat16::isNaN() const noexcept + \fn bool qfloat16::isNaN() const noexcept Tests whether this \c qfloat16 value is "not a number". @@ -128,7 +128,7 @@ QT_BEGIN_NAMESPACE /*! \since 5.14 - bool qfloat16::isNormal() const noexcept + \fn bool qfloat16::isNormal() const noexcept Tests whether this \c qfloat16 value is finite and in normal form. @@ -138,7 +138,7 @@ QT_BEGIN_NAMESPACE /*! \internal \since 5.14 - bool qfloat16::isFinite() const noexcept + \fn bool qfloat16::isFinite() const noexcept Tests whether this \c qfloat16 value is finite. diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp index cf107498dd..cc50d9ccc7 100644 --- a/src/corelib/kernel/qobject.cpp +++ b/src/corelib/kernel/qobject.cpp @@ -4612,7 +4612,7 @@ QDebug operator<<(QDebug dbg, const QObject *o) It works exactly like the Q_NAMESPACE macro. However, the external \c{staticMetaObject} variable that gets defined in the namespace - is declared with the supplied \c{EXPORT_MACRO} qualifier. This is + is declared with the supplied \a EXPORT_MACRO qualifier. This is useful if the object needs to be exported from a dynamic library. \sa Q_NAMESPACE, {Creating Shared Libraries} diff --git a/src/corelib/text/qlocale.qdoc b/src/corelib/text/qlocale.qdoc index 6c9d6f9d11..dbcd71f1a0 100644 --- a/src/corelib/text/qlocale.qdoc +++ b/src/corelib/text/qlocale.qdoc @@ -1201,14 +1201,6 @@ \sa toShort() */ -/*! -\fn QString QLocale::toString(ushort i) const - -\overload - -\sa toUShort() -*/ - /*! \fn QString QLocale::toString(int i) const diff --git a/src/corelib/tools/qhash.cpp b/src/corelib/tools/qhash.cpp index a53d6db997..6ec8019ba3 100644 --- a/src/corelib/tools/qhash.cpp +++ b/src/corelib/tools/qhash.cpp @@ -2597,7 +2597,7 @@ uint qHash(long double key, uint seed) noexcept \sa operator=() */ -/*! \fn template template QMultiHash::QMultiHash(InputIterator begin, InputIterator end) +/*! \fn template template QMultiHash::QMultiHash(InputIterator begin, InputIterator end) \since 5.14 Constructs a multi-hash with a copy of each of the elements in the iterator range diff --git a/src/network/kernel/qhostinfo.cpp b/src/network/kernel/qhostinfo.cpp index f9335c3bb9..9dbb154914 100644 --- a/src/network/kernel/qhostinfo.cpp +++ b/src/network/kernel/qhostinfo.cpp @@ -595,7 +595,7 @@ QHostInfo::QHostInfo(const QHostInfo &other) } /*! - \fn QHostInfo(QHostInfo &&other) + \fn QHostInfo::QHostInfo(QHostInfo &&other) Move-constructs a new QHostInfo from \a other. diff --git a/src/printsupport/dialogs/qabstractprintdialog.cpp b/src/printsupport/dialogs/qabstractprintdialog.cpp index 1a2aa7afac..b0d03037e6 100644 --- a/src/printsupport/dialogs/qabstractprintdialog.cpp +++ b/src/printsupport/dialogs/qabstractprintdialog.cpp @@ -343,13 +343,6 @@ void QAbstractPrintDialogPrivate::setPrinter(QPrinter *newPrinter) pd = printer->d_func(); } -/*! - \fn int QAbstractPrintDialog::exec() - - This virtual function is called to pop up the dialog. It must be - reimplemented in subclasses. -*/ - /*! \class QPrintDialog diff --git a/src/testlib/doc/src/qttest-best-practices.qdoc b/src/testlib/doc/src/qttest-best-practices.qdoc index 8ad67acce6..952fd3259d 100644 --- a/src/testlib/doc/src/qttest-best-practices.qdoc +++ b/src/testlib/doc/src/qttest-best-practices.qdoc @@ -243,7 +243,7 @@ Instead of \c Q_ASSERT, the \l QCOMPARE() or \l QVERIFY() macro variants should be used. They cause the current test to report a failure and terminate, but allow the remaining test functions to be executed and the - entire test program to terminate normally. \l Q_VERIFY2() even allows a + entire test program to terminate normally. \l QVERIFY2() even allows a descriptive error message to be recorded in the test log. \section1 Writing Reliable Tests diff --git a/src/testlib/qsignalspy.qdoc b/src/testlib/qsignalspy.qdoc index d532ad478d..d40c84907c 100644 --- a/src/testlib/qsignalspy.qdoc +++ b/src/testlib/qsignalspy.qdoc @@ -98,7 +98,7 @@ \snippet code/doc_src_qsignalspy.cpp 6 */ -/*! \fn QSignalSpy(const QObject *obj, const QMetaMethod &signal) +/*! \fn QSignalSpy::QSignalSpy(const QObject *obj, const QMetaMethod &signal) \since 5.14 Constructs a new QSignalSpy that listens for emissions of the \a signal diff --git a/src/widgets/kernel/qactiongroup.cpp b/src/widgets/kernel/qactiongroup.cpp index 1d9213de0c..d359703db3 100644 --- a/src/widgets/kernel/qactiongroup.cpp +++ b/src/widgets/kernel/qactiongroup.cpp @@ -292,7 +292,8 @@ QList QActionGroup::actions() const \brief Enable or disable the group exclusion checking This is a convenience method that calls - setExclusionPolicy(ExclusionPolicy::Exclusive). + setExclusionPolicy(ExclusionPolicy::Exclusive) when \a b is true, + else setExclusionPolicy(QActionGroup::ExclusionPolicy::None). \sa QActionGroup::exclusionPolicy */ @@ -303,7 +304,7 @@ void QActionGroup::setExclusive(bool b) } /*! - \brief Returs true if the group is exclusive + \brief Returns true if the group is exclusive The group is exclusive if the ExclusionPolicy is either Exclusive or ExclusionOptional. diff --git a/src/widgets/kernel/qshortcut.cpp b/src/widgets/kernel/qshortcut.cpp index eec65c8625..f157ba2943 100644 --- a/src/widgets/kernel/qshortcut.cpp +++ b/src/widgets/kernel/qshortcut.cpp @@ -475,7 +475,7 @@ QShortcut::QShortcut(QWidget *parent) match the \a key sequence. Depending on the ambiguity of the event, the shortcut will call the \a member function, or the \a ambiguousMember function, if the key press was in the shortcut's - \a context. + \a shortcutContext. */ QShortcut::QShortcut(const QKeySequence &key, QWidget *parent, const char *member, const char *ambiguousMember, diff --git a/src/widgets/widgets/qdatetimeedit.cpp b/src/widgets/widgets/qdatetimeedit.cpp index 9189319364..da4aaadc97 100644 --- a/src/widgets/widgets/qdatetimeedit.cpp +++ b/src/widgets/widgets/qdatetimeedit.cpp @@ -335,7 +335,6 @@ void QDateTimeEdit::setCalendar(QCalendar calendar) /*! \since 4.4 \property QDateTimeEdit::minimumDateTime - \brief the minimum datetime of the date time edit Changing this property implicitly updates the \l minimumDate and \l @@ -637,8 +636,8 @@ void QDateTimeEdit::setDateRange(const QDate &min, const QDate &max) Note that these only constrain the date time edit's value on, respectively, the \l minimumDate and \l maximumDate. When these date - properties do not coincide, times after \a maximumTime are allowed on dates - before \l maximumDate and times before \a minimumTime are allowed on dates + properties do not coincide, times after \a max are allowed on dates + before \l maximumDate and times before \a min are allowed on dates after \l minimumDate. \snippet code/src_gui_widgets_qdatetimeedit.cpp 5 @@ -649,7 +648,7 @@ void QDateTimeEdit::setDateRange(const QDate &min, const QDate &max) If either \a min or \a max is invalid, this function does nothing. This function preserves the \l minimumDate and \l maximumDate properties. If those - properties coincide and max is \a less than \a min, \a min is used as \a max. + properties coincide and \a max is less than \a min, \a min is used as \a max. \sa minimumTime, maximumTime, setDateTimeRange(), QTime::isValid() */ -- cgit v1.2.3 From 240a8514f84e9be116acb34991b12a7aa2279914 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Thu, 2 Jan 2020 13:58:49 +0100 Subject: Fix syncqt warning in qtestsupport_widgets.h Change-Id: I4f350e3c209dc9a39e849c9c39c41da700abeb60 Reviewed-by: Timur Pocheptsov --- src/widgets/kernel/qtestsupport_widgets.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/widgets/kernel/qtestsupport_widgets.h b/src/widgets/kernel/qtestsupport_widgets.h index ca1406b0b2..2b37a9e858 100644 --- a/src/widgets/kernel/qtestsupport_widgets.h +++ b/src/widgets/kernel/qtestsupport_widgets.h @@ -40,7 +40,7 @@ #ifndef QTESTSUPPORT_WIDGETS_H #define QTESTSUPPORT_WIDGETS_H -#include "qtwidgetsglobal.h" +#include QT_BEGIN_NAMESPACE -- cgit v1.2.3 From 105e662221cc90d5002e06c97febf50c5c601336 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Thu, 2 Jan 2020 13:21:58 +0100 Subject: macOS: Handle missing color space information in IOSurface backingstore Fixes: QTBUG-80972 Change-Id: Iab3f1a9cf03251340e5f32bcc73103428e93282d Reviewed-by: Timur Pocheptsov --- src/plugins/platforms/cocoa/qiosurfacegraphicsbuffer.mm | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/plugins/platforms/cocoa/qiosurfacegraphicsbuffer.mm b/src/plugins/platforms/cocoa/qiosurfacegraphicsbuffer.mm index 285e316d4a..fc187e0f51 100644 --- a/src/plugins/platforms/cocoa/qiosurfacegraphicsbuffer.mm +++ b/src/plugins/platforms/cocoa/qiosurfacegraphicsbuffer.mm @@ -89,9 +89,16 @@ QIOSurfaceGraphicsBuffer::~QIOSurfaceGraphicsBuffer() void QIOSurfaceGraphicsBuffer::setColorSpace(QCFType colorSpace) { - Q_ASSERT(colorSpace); - IOSurfaceSetValue(m_surface, CFSTR("IOSurfaceColorSpace"), - QCFType(CGColorSpaceCopyPropertyList(colorSpace))); + static const auto kIOSurfaceColorSpace = CFSTR("IOSurfaceColorSpace"); + + qCDebug(lcQpaIOSurface) << "Tagging" << this << "with color space" << colorSpace; + + if (colorSpace) { + IOSurfaceSetValue(m_surface, kIOSurfaceColorSpace, + QCFType(CGColorSpaceCopyPropertyList(colorSpace))); + } else { + IOSurfaceRemoveValue(m_surface, kIOSurfaceColorSpace); + } } const uchar *QIOSurfaceGraphicsBuffer::data() const -- cgit v1.2.3 From dcef0b96eef04c4e17c2e51ea71aea1f78625864 Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Thu, 19 Dec 2019 21:59:09 +0100 Subject: Fix CVE-2019-19242 in SQLite Task-number: QTBUG-80903 Change-Id: I78a72a574da5cf3503950afe47146ae6424f00c6 Reviewed-by: Christian Ehrlicher Reviewed-by: Volker Hilsheimer --- .../0002-Fix-CVE-2019-19242-in-SQLite.patch | 31 ++++++++++++++++++++++ src/3rdparty/sqlite/sqlite3.c | 7 ++++- 2 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 src/3rdparty/sqlite/patches/0002-Fix-CVE-2019-19242-in-SQLite.patch (limited to 'src') diff --git a/src/3rdparty/sqlite/patches/0002-Fix-CVE-2019-19242-in-SQLite.patch b/src/3rdparty/sqlite/patches/0002-Fix-CVE-2019-19242-in-SQLite.patch new file mode 100644 index 0000000000..92739192e4 --- /dev/null +++ b/src/3rdparty/sqlite/patches/0002-Fix-CVE-2019-19242-in-SQLite.patch @@ -0,0 +1,31 @@ +From 7905740b8e79479298e83d8e559fc49b46cf980e Mon Sep 17 00:00:00 2001 +From: Andy Shaw +Date: Thu, 19 Dec 2019 21:59:09 +0100 +Subject: [PATCH] Fix CVE-2019-19242 in SQLite + +Change-Id: I78a72a574da5cf3503950afe47146ae6424f00c6 +--- + src/3rdparty/sqlite/sqlite3.c | 7 ++++++- + 1 file changed, 6 insertions(+), 1 deletion(-) + +diff --git a/src/3rdparty/sqlite/sqlite3.c b/src/3rdparty/sqlite/sqlite3.c +index bd647ca1c2..d3e0c065b6 100644 +--- a/src/3rdparty/sqlite/sqlite3.c ++++ b/src/3rdparty/sqlite/sqlite3.c +@@ -101055,7 +101055,12 @@ expr_code_doover: + ** constant. + */ + int iReg = sqlite3ExprCodeTarget(pParse, pExpr->pLeft,target); +- int aff = sqlite3TableColumnAffinity(pExpr->y.pTab, pExpr->iColumn); ++ int aff; ++ if( pExpr->y.pTab ){ ++ aff = sqlite3TableColumnAffinity(pExpr->y.pTab, pExpr->iColumn); ++ }else{ ++ aff = pExpr->affExpr; ++ } + if( aff>SQLITE_AFF_BLOB ){ + static const char zAff[] = "B\000C\000D\000E"; + assert( SQLITE_AFF_BLOB=='A' ); +-- +2.21.0 (Apple Git-122.2) + diff --git a/src/3rdparty/sqlite/sqlite3.c b/src/3rdparty/sqlite/sqlite3.c index bd647ca1c2..d3e0c065b6 100644 --- a/src/3rdparty/sqlite/sqlite3.c +++ b/src/3rdparty/sqlite/sqlite3.c @@ -101055,7 +101055,12 @@ expr_code_doover: ** constant. */ int iReg = sqlite3ExprCodeTarget(pParse, pExpr->pLeft,target); - int aff = sqlite3TableColumnAffinity(pExpr->y.pTab, pExpr->iColumn); + int aff; + if( pExpr->y.pTab ){ + aff = sqlite3TableColumnAffinity(pExpr->y.pTab, pExpr->iColumn); + }else{ + aff = pExpr->affExpr; + } if( aff>SQLITE_AFF_BLOB ){ static const char zAff[] = "B\000C\000D\000E"; assert( SQLITE_AFF_BLOB=='A' ); -- cgit v1.2.3 From a75d238b3194ae4973be7f6ce0508a526d4aa49e Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Thu, 19 Dec 2019 22:31:15 +0100 Subject: Fix CVE-2019-19603 in SQLite This includes the patch needed to fix this CVE and a supporting one to include a new function added that it depends on. Task-number: QTBUG-80903 Change-Id: Ic7639d50c89a3ee7d45426588c3ab0efd0eebb72 Reviewed-by: Christian Ehrlicher Reviewed-by: Volker Hilsheimer --- .../0003-Fix-CVE-2019-19603-in-SQLite.patch | 95 ++++++++++++++++++++++ src/3rdparty/sqlite/sqlite3.c | 32 ++++++-- 2 files changed, 121 insertions(+), 6 deletions(-) create mode 100644 src/3rdparty/sqlite/patches/0003-Fix-CVE-2019-19603-in-SQLite.patch (limited to 'src') diff --git a/src/3rdparty/sqlite/patches/0003-Fix-CVE-2019-19603-in-SQLite.patch b/src/3rdparty/sqlite/patches/0003-Fix-CVE-2019-19603-in-SQLite.patch new file mode 100644 index 0000000000..1b8deaa4a1 --- /dev/null +++ b/src/3rdparty/sqlite/patches/0003-Fix-CVE-2019-19603-in-SQLite.patch @@ -0,0 +1,95 @@ +From 11a2f4647b67494fb731a6fd793f1b28074631d3 Mon Sep 17 00:00:00 2001 +From: Andy Shaw +Date: Thu, 19 Dec 2019 22:31:15 +0100 +Subject: [PATCH] Fix CVE-2019-19603 in SQLite + +This includes the patch needed to fix this CVE and a supporting one to +include a new function added that it depends on. + +Task-number: QTBUG-80903 +Change-Id: Ic7639d50c89a3ee7d45426588c3ab0efd0eebb72 +--- + src/3rdparty/sqlite/sqlite3.c | 32 ++++++++++++++++++++++++++------ + 1 file changed, 26 insertions(+), 6 deletions(-) + +diff --git a/src/3rdparty/sqlite/sqlite3.c b/src/3rdparty/sqlite/sqlite3.c +index d3e0c065b6..a430554db7 100644 +--- a/src/3rdparty/sqlite/sqlite3.c ++++ b/src/3rdparty/sqlite/sqlite3.c +@@ -19519,6 +19519,12 @@ SQLITE_PRIVATE Module *sqlite3VtabCreateModule( + ); + # define sqlite3VtabInSync(db) ((db)->nVTrans>0 && (db)->aVTrans==0) + #endif ++SQLITE_PRIVATE int sqlite3ReadOnlyShadowTables(sqlite3 *db); ++#ifndef SQLITE_OMIT_VIRTUALTABLE ++SQLITE_PRIVATE int sqlite3ShadowTableName(sqlite3 *db, const char *zName); ++#else ++# define sqlite3ShadowTableName(A,B) 0 ++#endif + SQLITE_PRIVATE int sqlite3VtabEponymousTableInit(Parse*,Module*); + SQLITE_PRIVATE void sqlite3VtabEponymousTableClear(sqlite3*,Module*); + SQLITE_PRIVATE void sqlite3VtabMakeWritable(Parse*,Table*); +@@ -108483,6 +108489,22 @@ SQLITE_PRIVATE int sqlite3WritableSchema(sqlite3 *db){ + return (db->flags&(SQLITE_WriteSchema|SQLITE_Defensive))==SQLITE_WriteSchema; + } + ++/* ++ ** Return TRUE if shadow tables should be read-only in the current ++ ** context. ++ */ ++int sqlite3ReadOnlyShadowTables(sqlite3 *db){ ++#ifndef SQLITE_OMIT_VIRTUALTABLE ++ if( (db->flags & SQLITE_Defensive)!=0 ++ && db->pVtabCtx==0 ++ && db->nVdbeExec==0 ++ ){ ++ return 1; ++ } ++#endif ++ return 0; ++} ++ + /* + ** This routine is used to check if the UTF-8 string zName is a legal + ** unqualified name for a new schema object (table, index, view or +@@ -108516,8 +108538,8 @@ SQLITE_PRIVATE int sqlite3CheckObjectName( + } + } + }else{ +- if( pParse->nested==0 +- && 0==sqlite3StrNICmp(zName, "sqlite_", 7) ++ if( (pParse->nested==0 && 0==sqlite3StrNICmp(zName, "sqlite_", 7)) ++ || (sqlite3ReadOnlyShadowTables(db) && sqlite3ShadowTableName(db, zName)) + ){ + sqlite3ErrorMsg(pParse, "object name reserved for internal use: %s", + zName); +@@ -109662,7 +109684,7 @@ static void convertToWithoutRowidTable(Parse *pParse, Table *pTab){ + ** zName is temporarily modified while this routine is running, but is + ** restored to its original value prior to this routine returning. + */ +-static int isShadowTableName(sqlite3 *db, char *zName){ ++int sqlite3ShadowTableName(sqlite3 *db, const char *zName){ + char *zTail; /* Pointer to the last "_" in zName */ + Table *pTab; /* Table that zName is a shadow of */ + Module *pMod; /* Module for the virtual table */ +@@ -109680,8 +109702,6 @@ static int isShadowTableName(sqlite3 *db, char *zName){ + if( pMod->pModule->xShadowName==0 ) return 0; + return pMod->pModule->xShadowName(zTail+1); + } +-#else +-# define isShadowTableName(x,y) 0 + #endif /* ifndef SQLITE_OMIT_VIRTUALTABLE */ + + /* +@@ -109723,7 +109743,7 @@ SQLITE_PRIVATE void sqlite3EndTable( + p = pParse->pNewTable; + if( p==0 ) return; + +- if( pSelect==0 && isShadowTableName(db, p->zName) ){ ++ if( pSelect==0 && sqlite3ShadowTableName(db, p->zName) ){ + p->tabFlags |= TF_Shadow; + } + +-- +2.21.0 (Apple Git-122.2) + diff --git a/src/3rdparty/sqlite/sqlite3.c b/src/3rdparty/sqlite/sqlite3.c index d3e0c065b6..a430554db7 100644 --- a/src/3rdparty/sqlite/sqlite3.c +++ b/src/3rdparty/sqlite/sqlite3.c @@ -19519,6 +19519,12 @@ SQLITE_PRIVATE Module *sqlite3VtabCreateModule( ); # define sqlite3VtabInSync(db) ((db)->nVTrans>0 && (db)->aVTrans==0) #endif +SQLITE_PRIVATE int sqlite3ReadOnlyShadowTables(sqlite3 *db); +#ifndef SQLITE_OMIT_VIRTUALTABLE +SQLITE_PRIVATE int sqlite3ShadowTableName(sqlite3 *db, const char *zName); +#else +# define sqlite3ShadowTableName(A,B) 0 +#endif SQLITE_PRIVATE int sqlite3VtabEponymousTableInit(Parse*,Module*); SQLITE_PRIVATE void sqlite3VtabEponymousTableClear(sqlite3*,Module*); SQLITE_PRIVATE void sqlite3VtabMakeWritable(Parse*,Table*); @@ -108483,6 +108489,22 @@ SQLITE_PRIVATE int sqlite3WritableSchema(sqlite3 *db){ return (db->flags&(SQLITE_WriteSchema|SQLITE_Defensive))==SQLITE_WriteSchema; } +/* + ** Return TRUE if shadow tables should be read-only in the current + ** context. + */ +int sqlite3ReadOnlyShadowTables(sqlite3 *db){ +#ifndef SQLITE_OMIT_VIRTUALTABLE + if( (db->flags & SQLITE_Defensive)!=0 + && db->pVtabCtx==0 + && db->nVdbeExec==0 + ){ + return 1; + } +#endif + return 0; +} + /* ** This routine is used to check if the UTF-8 string zName is a legal ** unqualified name for a new schema object (table, index, view or @@ -108516,8 +108538,8 @@ SQLITE_PRIVATE int sqlite3CheckObjectName( } } }else{ - if( pParse->nested==0 - && 0==sqlite3StrNICmp(zName, "sqlite_", 7) + if( (pParse->nested==0 && 0==sqlite3StrNICmp(zName, "sqlite_", 7)) + || (sqlite3ReadOnlyShadowTables(db) && sqlite3ShadowTableName(db, zName)) ){ sqlite3ErrorMsg(pParse, "object name reserved for internal use: %s", zName); @@ -109662,7 +109684,7 @@ static void convertToWithoutRowidTable(Parse *pParse, Table *pTab){ ** zName is temporarily modified while this routine is running, but is ** restored to its original value prior to this routine returning. */ -static int isShadowTableName(sqlite3 *db, char *zName){ +int sqlite3ShadowTableName(sqlite3 *db, const char *zName){ char *zTail; /* Pointer to the last "_" in zName */ Table *pTab; /* Table that zName is a shadow of */ Module *pMod; /* Module for the virtual table */ @@ -109680,8 +109702,6 @@ static int isShadowTableName(sqlite3 *db, char *zName){ if( pMod->pModule->xShadowName==0 ) return 0; return pMod->pModule->xShadowName(zTail+1); } -#else -# define isShadowTableName(x,y) 0 #endif /* ifndef SQLITE_OMIT_VIRTUALTABLE */ /* @@ -109723,7 +109743,7 @@ SQLITE_PRIVATE void sqlite3EndTable( p = pParse->pNewTable; if( p==0 ) return; - if( pSelect==0 && isShadowTableName(db, p->zName) ){ + if( pSelect==0 && sqlite3ShadowTableName(db, p->zName) ){ p->tabFlags |= TF_Shadow; } -- cgit v1.2.3 From 3b697f496303bd005ae9d1d2c974efeed259d8a3 Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Thu, 2 Jan 2020 09:07:08 +0100 Subject: Fix CVE-2019-19646 in SQLite Task-number: QTBUG-81020 Change-Id: I7176db20d4a44b1fb443a6108675f719e9643343 Reviewed-by: Volker Hilsheimer --- .../0004-Fix-CVE-2019-19646-in-SQLite.patch | 29 ++++++++++++++++++++++ src/3rdparty/sqlite/sqlite3.c | 4 ++- 2 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 src/3rdparty/sqlite/patches/0004-Fix-CVE-2019-19646-in-SQLite.patch (limited to 'src') diff --git a/src/3rdparty/sqlite/patches/0004-Fix-CVE-2019-19646-in-SQLite.patch b/src/3rdparty/sqlite/patches/0004-Fix-CVE-2019-19646-in-SQLite.patch new file mode 100644 index 0000000000..db436ab4f6 --- /dev/null +++ b/src/3rdparty/sqlite/patches/0004-Fix-CVE-2019-19646-in-SQLite.patch @@ -0,0 +1,29 @@ +From a83bbce4d6f31d93ea4d2a681aa52c148f148e26 Mon Sep 17 00:00:00 2001 +From: Andy Shaw +Date: Thu, 2 Jan 2020 09:07:08 +0100 +Subject: [PATCH] Fix CVE-2019-19646 in SQLite + +Task-number: QTBUG-81020 +Change-Id: I7176db20d4a44b1fb443a6108675f719e9643343 +--- + src/3rdparty/sqlite/sqlite3.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/src/3rdparty/sqlite/sqlite3.c b/src/3rdparty/sqlite/sqlite3.c +index 57e61b8313..980a149b1a 100644 +--- a/src/3rdparty/sqlite/sqlite3.c ++++ b/src/3rdparty/sqlite/sqlite3.c +@@ -123765,7 +123765,9 @@ SQLITE_PRIVATE void sqlite3Pragma( + if( j==pTab->iPKey ) continue; + if( pTab->aCol[j].notNull==0 ) continue; + sqlite3ExprCodeGetColumnOfTable(v, pTab, iDataCur, j, 3); +- sqlite3VdbeChangeP5(v, OPFLAG_TYPEOFARG); ++ if( sqlite3VdbeGetOp(v,-1)->opcode==OP_Column ){ ++ sqlite3VdbeChangeP5(v, OPFLAG_TYPEOFARG); ++ } + jmp2 = sqlite3VdbeAddOp1(v, OP_NotNull, 3); VdbeCoverage(v); + zErr = sqlite3MPrintf(db, "NULL value in %s.%s", pTab->zName, + pTab->aCol[j].zName); +-- +2.21.0 (Apple Git-122.2) + diff --git a/src/3rdparty/sqlite/sqlite3.c b/src/3rdparty/sqlite/sqlite3.c index a430554db7..712a103ef6 100644 --- a/src/3rdparty/sqlite/sqlite3.c +++ b/src/3rdparty/sqlite/sqlite3.c @@ -123776,7 +123776,9 @@ SQLITE_PRIVATE void sqlite3Pragma( if( j==pTab->iPKey ) continue; if( pTab->aCol[j].notNull==0 ) continue; sqlite3ExprCodeGetColumnOfTable(v, pTab, iDataCur, j, 3); - sqlite3VdbeChangeP5(v, OPFLAG_TYPEOFARG); + if( sqlite3VdbeGetOp(v,-1)->opcode==OP_Column ){ + sqlite3VdbeChangeP5(v, OPFLAG_TYPEOFARG); + } jmp2 = sqlite3VdbeAddOp1(v, OP_NotNull, 3); VdbeCoverage(v); zErr = sqlite3MPrintf(db, "NULL value in %s.%s", pTab->zName, pTab->aCol[j].zName); -- cgit v1.2.3 From 1e89c132e1280276e1d3a82ec3464afec8c14c3a Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Thu, 2 Jan 2020 08:47:23 +0100 Subject: Fix CVE-2019-19645 in SQLite Task-number: QTBUG-81020 Change-Id: I58b1dd9e7a90ba998c3af7f25a4627d8bdd70970 Reviewed-by: Volker Hilsheimer --- .../0005-Fix-CVE-2019-19645-in-SQLite.patch | 83 ++++++++++++++++++++++ src/3rdparty/sqlite/sqlite3.c | 11 ++- 2 files changed, 93 insertions(+), 1 deletion(-) create mode 100644 src/3rdparty/sqlite/patches/0005-Fix-CVE-2019-19645-in-SQLite.patch (limited to 'src') diff --git a/src/3rdparty/sqlite/patches/0005-Fix-CVE-2019-19645-in-SQLite.patch b/src/3rdparty/sqlite/patches/0005-Fix-CVE-2019-19645-in-SQLite.patch new file mode 100644 index 0000000000..e92c566881 --- /dev/null +++ b/src/3rdparty/sqlite/patches/0005-Fix-CVE-2019-19645-in-SQLite.patch @@ -0,0 +1,83 @@ +From 78c972eec5bab03a408b8ba1373572bcfe2db630 Mon Sep 17 00:00:00 2001 +From: Andy Shaw +Date: Thu, 2 Jan 2020 08:47:23 +0100 +Subject: [PATCH] Fix CVE-2019-19645 in SQLite + +Task-number: QTBUG-81020 +Change-Id: I58b1dd9e7a90ba998c3af7f25a4627d8bdd70970 +--- + src/3rdparty/sqlite/sqlite3.c | 11 ++++++++++- + 1 file changed, 10 insertions(+), 1 deletion(-) + +diff --git a/src/3rdparty/sqlite/sqlite3.c b/src/3rdparty/sqlite/sqlite3.c +index d3e0c065b6..57e61b8313 100644 +--- a/src/3rdparty/sqlite/sqlite3.c ++++ b/src/3rdparty/sqlite/sqlite3.c +@@ -17946,6 +17946,7 @@ struct Select { + #define SF_IncludeHidden 0x20000 /* Include hidden columns in output */ + #define SF_ComplexResult 0x40000 /* Result contains subquery or function */ + #define SF_WhereBegin 0x80000 /* Really a WhereBegin() call. Debug Only */ ++#define SF_View 0x0200000 /* SELECT statement is a view */ + + /* + ** The results of a SELECT can be distributed in several ways, as defined +@@ -103920,6 +103921,7 @@ static int renameUnmapExprCb(Walker *pWalker, Expr *pExpr){ + static int renameUnmapSelectCb(Walker *pWalker, Select *p){ + Parse *pParse = pWalker->pParse; + int i; ++ if( p->selFlags & SF_View ) return WRC_Prune; + if( ALWAYS(p->pEList) ){ + ExprList *pList = p->pEList; + for(i=0; inExpr; i++){ +@@ -104024,6 +104026,7 @@ static void renameWalkWith(Walker *pWalker, Select *pSelect){ + ** descend into sub-select statements. + */ + static int renameColumnSelectCb(Walker *pWalker, Select *p){ ++ if( p->selFlags & SF_View ) return WRC_Prune; + renameWalkWith(pWalker, p); + return WRC_Continue; + } +@@ -104489,8 +104492,9 @@ static void renameColumnFunc( + if( sParse.pNewTable ){ + Select *pSelect = sParse.pNewTable->pSelect; + if( pSelect ){ ++ pSelect->selFlags &= ~SF_View; + sParse.rc = SQLITE_OK; +- sqlite3SelectPrep(&sParse, sParse.pNewTable->pSelect, 0); ++ sqlite3SelectPrep(&sParse, pSelect, 0); + rc = (db->mallocFailed ? SQLITE_NOMEM : sParse.rc); + if( rc==SQLITE_OK ){ + sqlite3WalkSelect(&sWalker, pSelect); +@@ -104602,6 +104606,7 @@ static int renameTableSelectCb(Walker *pWalker, Select *pSelect){ + int i; + RenameCtx *p = pWalker->u.pRename; + SrcList *pSrc = pSelect->pSrc; ++ if( pSelect->selFlags & SF_View ) return WRC_Prune; + if( pSrc==0 ){ + assert( pWalker->pParse->db->mallocFailed ); + return WRC_Abort; +@@ -104681,10 +104686,13 @@ static void renameTableFunc( + + if( pTab->pSelect ){ + if( isLegacy==0 ){ ++ Select *pSelect = pTab->pSelect; + NameContext sNC; + memset(&sNC, 0, sizeof(sNC)); + sNC.pParse = &sParse; + ++ assert( pSelect->selFlags & SF_View ); ++ pSelect->selFlags &= ~SF_View; + sqlite3SelectPrep(&sParse, pTab->pSelect, &sNC); + if( sParse.nErr ) rc = sParse.rc; + sqlite3WalkSelect(&sWalker, pTab->pSelect); +@@ -109994,6 +110002,7 @@ SQLITE_PRIVATE void sqlite3CreateView( + ** allocated rather than point to the input string - which means that + ** they will persist after the current sqlite3_exec() call returns. + */ ++ pSelect->selFlags |= SF_View; + if( IN_RENAME_OBJECT ){ + p->pSelect = pSelect; + pSelect = 0; +-- +2.21.0 (Apple Git-122.2) + diff --git a/src/3rdparty/sqlite/sqlite3.c b/src/3rdparty/sqlite/sqlite3.c index 712a103ef6..d5b43857ad 100644 --- a/src/3rdparty/sqlite/sqlite3.c +++ b/src/3rdparty/sqlite/sqlite3.c @@ -17946,6 +17946,7 @@ struct Select { #define SF_IncludeHidden 0x20000 /* Include hidden columns in output */ #define SF_ComplexResult 0x40000 /* Result contains subquery or function */ #define SF_WhereBegin 0x80000 /* Really a WhereBegin() call. Debug Only */ +#define SF_View 0x0200000 /* SELECT statement is a view */ /* ** The results of a SELECT can be distributed in several ways, as defined @@ -103926,6 +103927,7 @@ static int renameUnmapExprCb(Walker *pWalker, Expr *pExpr){ static int renameUnmapSelectCb(Walker *pWalker, Select *p){ Parse *pParse = pWalker->pParse; int i; + if( p->selFlags & SF_View ) return WRC_Prune; if( ALWAYS(p->pEList) ){ ExprList *pList = p->pEList; for(i=0; inExpr; i++){ @@ -104030,6 +104032,7 @@ static void renameWalkWith(Walker *pWalker, Select *pSelect){ ** descend into sub-select statements. */ static int renameColumnSelectCb(Walker *pWalker, Select *p){ + if( p->selFlags & SF_View ) return WRC_Prune; renameWalkWith(pWalker, p); return WRC_Continue; } @@ -104495,8 +104498,9 @@ static void renameColumnFunc( if( sParse.pNewTable ){ Select *pSelect = sParse.pNewTable->pSelect; if( pSelect ){ + pSelect->selFlags &= ~SF_View; sParse.rc = SQLITE_OK; - sqlite3SelectPrep(&sParse, sParse.pNewTable->pSelect, 0); + sqlite3SelectPrep(&sParse, pSelect, 0); rc = (db->mallocFailed ? SQLITE_NOMEM : sParse.rc); if( rc==SQLITE_OK ){ sqlite3WalkSelect(&sWalker, pSelect); @@ -104608,6 +104612,7 @@ static int renameTableSelectCb(Walker *pWalker, Select *pSelect){ int i; RenameCtx *p = pWalker->u.pRename; SrcList *pSrc = pSelect->pSrc; + if( pSelect->selFlags & SF_View ) return WRC_Prune; if( pSrc==0 ){ assert( pWalker->pParse->db->mallocFailed ); return WRC_Abort; @@ -104687,10 +104692,13 @@ static void renameTableFunc( if( pTab->pSelect ){ if( isLegacy==0 ){ + Select *pSelect = pTab->pSelect; NameContext sNC; memset(&sNC, 0, sizeof(sNC)); sNC.pParse = &sParse; + assert( pSelect->selFlags & SF_View ); + pSelect->selFlags &= ~SF_View; sqlite3SelectPrep(&sParse, pTab->pSelect, &sNC); if( sParse.nErr ) rc = sParse.rc; sqlite3WalkSelect(&sWalker, pTab->pSelect); @@ -110014,6 +110022,7 @@ SQLITE_PRIVATE void sqlite3CreateView( ** allocated rather than point to the input string - which means that ** they will persist after the current sqlite3_exec() call returns. */ + pSelect->selFlags |= SF_View; if( IN_RENAME_OBJECT ){ p->pSelect = pSelect; pSelect = 0; -- cgit v1.2.3 From 8669b8e60fc6a46baaeeea264a1ed3008dd52ea2 Mon Sep 17 00:00:00 2001 From: Fabian Kosmale Date: Wed, 11 Dec 2019 10:54:57 +0100 Subject: QVariant: Prefer direct conversion to QVariant{List,Map,Hash} If a type has both a converter to QVariantList and to QSequentialIterableImpl registered, we would have chosen the QSequentialIterableImpl version. In the case of types like QJSValue, this is more costly. With this change we therefore uses the direct conversion if it has been registered. The same applies to QAssociativeIterableImpl and QVariantHash/QVariantMap. Change-Id: I9c0b5068efe4bfbc5e0598a200e6db59201e9974 Reviewed-by: Ulf Hermann Reviewed-by: Olivier Goffart (Woboq GmbH) --- src/corelib/kernel/qvariant.h | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/corelib/kernel/qvariant.h b/src/corelib/kernel/qvariant.h index a4957472ec..c95882d48f 100644 --- a/src/corelib/kernel/qvariant.h +++ b/src/corelib/kernel/qvariant.h @@ -801,7 +801,8 @@ namespace QtPrivate { static QVariantList invoke(const QVariant &v) { const int typeId = v.userType(); - if (typeId == qMetaTypeId() || typeId == qMetaTypeId() || QMetaType::hasRegisteredConverterFunction(typeId, qMetaTypeId())) { + if (typeId == qMetaTypeId() || typeId == qMetaTypeId() || + (QMetaType::hasRegisteredConverterFunction(typeId, qMetaTypeId()) && !QMetaType::hasRegisteredConverterFunction(typeId, qMetaTypeId()))) { QSequentialIterable iter = QVariantValueHelperInterface::invoke(v); QVariantList l; l.reserve(iter.size()); @@ -818,7 +819,7 @@ namespace QtPrivate { static QVariantHash invoke(const QVariant &v) { const int typeId = v.userType(); - if (typeId == qMetaTypeId() || QMetaType::hasRegisteredConverterFunction(typeId, qMetaTypeId())) { + if (typeId == qMetaTypeId() || ((QMetaType::hasRegisteredConverterFunction(typeId, qMetaTypeId())) && !QMetaType::hasRegisteredConverterFunction(typeId, qMetaTypeId()))) { QAssociativeIterable iter = QVariantValueHelperInterface::invoke(v); QVariantHash l; l.reserve(iter.size()); @@ -835,7 +836,7 @@ namespace QtPrivate { static QVariantMap invoke(const QVariant &v) { const int typeId = v.userType(); - if (typeId == qMetaTypeId() || QMetaType::hasRegisteredConverterFunction(typeId, qMetaTypeId())) { + if (typeId == qMetaTypeId() || (QMetaType::hasRegisteredConverterFunction(typeId, qMetaTypeId()) && !QMetaType::hasRegisteredConverterFunction(typeId, qMetaTypeId()))) { QAssociativeIterable iter = QVariantValueHelperInterface::invoke(v); QVariantMap l; for (QAssociativeIterable::const_iterator it = iter.begin(), end = iter.end(); it != end; ++it) @@ -851,10 +852,8 @@ namespace QtPrivate { static QPair invoke(const QVariant &v) { const int typeId = v.userType(); - if (typeId == qMetaTypeId >()) - return QVariantValueHelper >::invoke(v); - if (QMetaType::hasRegisteredConverterFunction(typeId, qMetaTypeId())) { + if (QMetaType::hasRegisteredConverterFunction(typeId, qMetaTypeId()) && !(typeId == qMetaTypeId >())) { QtMetaTypePrivate::QPairVariantInterfaceImpl pi = v.value(); const QtMetaTypePrivate::VariantData d1 = pi.first(); -- cgit v1.2.3 From 7c0341daeef9c975b0e736b9d8a52b9649c6a06c Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Fri, 3 Jan 2020 12:51:20 +0100 Subject: uic: Fix empty strings for Python Introduce a constant in the language namespace. Fixes: PYSIDE-1174 Change-Id: Ic3e58580b20c1d9a6ddf97f20709a3046d4b6f0c Reviewed-by: Cristian Maureira-Fredes --- src/tools/uic/cpp/cppwriteinitialization.cpp | 12 +++++------- src/tools/uic/shared/language.cpp | 3 +++ src/tools/uic/shared/language.h | 1 + 3 files changed, 9 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/tools/uic/cpp/cppwriteinitialization.cpp b/src/tools/uic/cpp/cppwriteinitialization.cpp index 570a61a1f1..4fbf01262b 100644 --- a/src/tools/uic/cpp/cppwriteinitialization.cpp +++ b/src/tools/uic/cpp/cppwriteinitialization.cpp @@ -731,7 +731,7 @@ void WriteInitialization::acceptWidget(DomWidget *node) if (const DomProperty *picon = attributes.value(QLatin1String("icon"))) icon = QLatin1String(", ") + iconCall(picon); // Side effect: Writes icon definition m_output << m_indent << parentWidget << language::derefPointer << "addTab(" - << varName << icon << ", " << "QString())" << language::eol; + << varName << icon << ", " << language::emptyString << ')' << language::eol; autoTrOutput(ptitleString, pageDefaultString) << m_indent << parentWidget << language::derefPointer << "setTabText(" << parentWidget @@ -2086,7 +2086,7 @@ void WriteInitialization::initializeComboBox(DomWidget *w) m_output << iconValue << ", "; if (needsTranslation(text->elementString())) { - m_output << "QString())" << language::eol; + m_output << language::emptyString << ')' << language::eol; m_refreshOut << m_indent << varName << language::derefPointer << "setItemText(" << i << ", " << trCall(text->elementString()) << ')' << language::eol; @@ -2288,7 +2288,7 @@ void WriteInitialization::initializeTreeWidget(DomWidget *w) if (str && str->text().isEmpty()) { m_output << m_indent << varName << language::derefPointer << "headerItem()" << language::derefPointer << "setText(" - << i << ", QString())" << language::eol; + << i << ", " << language::emptyString << ')' << language::eol; } } } @@ -2451,10 +2451,8 @@ void WriteInitialization::initializeTableWidget(DomWidget *w) QString WriteInitialization::trCall(const QString &str, const QString &commentHint, const QString &id) const { - if (str.isEmpty()) { - return language::language() == Language::Cpp - ? QLatin1String("QString()") : QLatin1String("\"\""); - } + if (str.isEmpty()) + return language::emptyString; QString result; QTextStream ts(&result); diff --git a/src/tools/uic/shared/language.cpp b/src/tools/uic/shared/language.cpp index 235a8ed2fc..987d51e30c 100644 --- a/src/tools/uic/shared/language.cpp +++ b/src/tools/uic/shared/language.cpp @@ -49,6 +49,7 @@ void setLanguage(Language l) qualifier = QLatin1String("::"); self = QLatin1String(""); // for testing: change to "this->"; eol = QLatin1String(";\n"); + emptyString = QLatin1String("QString()"); encoding = Encoding::Utf8; break; case Language::Python: @@ -59,6 +60,7 @@ void setLanguage(Language l) qualifier = QLatin1String("."); self = QLatin1String("self."); eol = QLatin1String("\n"); + emptyString = QLatin1String("\"\""); encoding = Encoding::Unicode; break; } @@ -71,6 +73,7 @@ QString qtQualifier; QString qualifier; QString self; QString eol; +QString emptyString; QString cppQualifier = QLatin1String("::"); QString cppTrue = QLatin1String("true"); diff --git a/src/tools/uic/shared/language.h b/src/tools/uic/shared/language.h index fc8af9715b..7b019ec8fc 100644 --- a/src/tools/uic/shared/language.h +++ b/src/tools/uic/shared/language.h @@ -49,6 +49,7 @@ extern QString qtQualifier; extern QString qualifier; extern QString self; extern QString eol; +extern QString emptyString; extern QString cppQualifier; extern QString cppTrue; -- cgit v1.2.3 From 77f1d0bfa542e166deaa196b3b3b854d33a3a1b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Fri, 3 Jan 2020 13:22:06 +0100 Subject: macOS: Skip uninitialized buffers in IOSurface backingstore Task-number: QTBUG-80972 Change-Id: Ifb8eb84d6b802556ccd52ac129a91e142e265a81 Reviewed-by: Timur Pocheptsov --- src/plugins/platforms/cocoa/qcocoabackingstore.mm | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/plugins/platforms/cocoa/qcocoabackingstore.mm b/src/plugins/platforms/cocoa/qcocoabackingstore.mm index 8a815a7665..2e15d11564 100644 --- a/src/plugins/platforms/cocoa/qcocoabackingstore.mm +++ b/src/plugins/platforms/cocoa/qcocoabackingstore.mm @@ -617,8 +617,10 @@ QImage QCALayerBackingStore::toImage() const void QCALayerBackingStore::backingPropertiesChanged() { qCDebug(lcQpaBackingStore) << "Updating color space of existing buffers"; - for (auto &buffer : m_buffers) - buffer->setColorSpace(colorSpace()); + for (auto &buffer : m_buffers) { + if (buffer) + buffer->setColorSpace(colorSpace()); + } } QPlatformGraphicsBuffer *QCALayerBackingStore::graphicsBuffer() const -- cgit v1.2.3 From 8b0b2057d060c9f33cfeb0ea38a08ace22079f93 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Fri, 3 Jan 2020 13:08:52 +0100 Subject: uic: Add colon missing for "if()" constructs in Python Task-number: PYSIDE-1169 Change-Id: I63c5305b0ddad1c4fcd585b65c3c78c05b40bac1 Reviewed-by: Cristian Maureira-Fredes --- src/tools/uic/cpp/cppwriteinitialization.cpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/tools/uic/cpp/cppwriteinitialization.cpp b/src/tools/uic/cpp/cppwriteinitialization.cpp index 4fbf01262b..5dbe10082c 100644 --- a/src/tools/uic/cpp/cppwriteinitialization.cpp +++ b/src/tools/uic/cpp/cppwriteinitialization.cpp @@ -2372,9 +2372,11 @@ void WriteInitialization::initializeTableWidget(DomWidget *w) const auto &columns = w->elementColumn(); if (!columns.empty()) { - m_output << m_indent << "if (" << varName << language::derefPointer << "columnCount() < " - << columns.size() << ")\n" - << m_dindent << varName << language::derefPointer << "setColumnCount(" + m_output << m_indent << "if (" << varName << language::derefPointer + << "columnCount() < " << columns.size() << ')'; + if (language::language() == Language::Python) + m_output << ':'; + m_output << '\n' << m_dindent << varName << language::derefPointer << "setColumnCount(" << columns.size() << ')' << language::eol; } @@ -2400,8 +2402,11 @@ void WriteInitialization::initializeTableWidget(DomWidget *w) const auto &rows = w->elementRow(); if (!rows.isEmpty()) { - m_output << m_indent << "if (" << varName << language::derefPointer << "rowCount() < " << rows.size() << ")\n" - << m_dindent << varName << language::derefPointer << "setRowCount(" + m_output << m_indent << "if (" << varName << language::derefPointer + << "rowCount() < " << rows.size() << ')'; + if (language::language() == Language::Python) + m_output << ':'; + m_output << '\n' << m_dindent << varName << language::derefPointer << "setRowCount(" << rows.size() << ')' << language::eol; } -- cgit v1.2.3 From 01f0df1cf559991e4b7fbee1cb14b068fb6895c8 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Fri, 3 Jan 2020 15:02:44 +0100 Subject: uic: Add handling of resources imports for Python The Python-bases pyside2-uic would write an import for each resource file encountered, adding a "_rc" suffix. Add this handling. Task-number: PYSIDE-1171 Task-number: PYSIDE-1170 Change-Id: I870d61ca7262c0684de5359a5f990d23a4171032 Reviewed-by: Cristian Maureira-Fredes --- src/tools/uic/main.cpp | 5 +++++ src/tools/uic/option.h | 2 ++ src/tools/uic/python/pythonwriteimports.cpp | 32 +++++++++++++++++++++++++++++ src/tools/uic/python/pythonwriteimports.h | 1 + 4 files changed, 40 insertions(+) (limited to 'src') diff --git a/src/tools/uic/main.cpp b/src/tools/uic/main.cpp index 9cf22d502d..d6c63de869 100644 --- a/src/tools/uic/main.cpp +++ b/src/tools/uic/main.cpp @@ -108,6 +108,10 @@ int runUic(int argc, char *argv[]) idBasedOption.setDescription(QStringLiteral("Use id based function for i18n")); parser.addOption(idBasedOption); + QCommandLineOption fromImportsOption(QStringLiteral("from-imports")); + fromImportsOption.setDescription(QStringLiteral("Python: generate imports relative to '.'")); + parser.addOption(fromImportsOption); + parser.addPositionalArgument(QStringLiteral("[uifile]"), QStringLiteral("Input file (*.ui), otherwise stdin.")); parser.process(app); @@ -118,6 +122,7 @@ int runUic(int argc, char *argv[]) driver.option().headerProtection = !parser.isSet(noProtOption); driver.option().implicitIncludes = !parser.isSet(noImplicitIncludesOption); driver.option().idBased = parser.isSet(idBasedOption); + driver.option().fromImports = parser.isSet(fromImportsOption); driver.option().postfix = parser.value(postfixOption); driver.option().translateFunction = parser.value(translateOption); driver.option().includeFile = parser.value(includeOption); diff --git a/src/tools/uic/option.h b/src/tools/uic/option.h index 4fc442e94a..8e882079c9 100644 --- a/src/tools/uic/option.h +++ b/src/tools/uic/option.h @@ -45,6 +45,7 @@ struct Option unsigned int limitXPM_LineLength : 1; unsigned int implicitIncludes: 1; unsigned int idBased: 1; + unsigned int fromImports: 1; QString inputFile; QString outputFile; @@ -65,6 +66,7 @@ struct Option limitXPM_LineLength(0), implicitIncludes(1), idBased(0), + fromImports(0), prefix(QLatin1String("Ui_")) { indent.fill(QLatin1Char(' '), 4); } diff --git a/src/tools/uic/python/pythonwriteimports.cpp b/src/tools/uic/python/pythonwriteimports.cpp index 303615f77b..be55696683 100644 --- a/src/tools/uic/python/pythonwriteimports.cpp +++ b/src/tools/uic/python/pythonwriteimports.cpp @@ -29,6 +29,7 @@ #include "pythonwriteimports.h" #include +#include #include #include @@ -46,6 +47,20 @@ from PySide2.QtGui import (QBrush, QColor, QConicalGradient, QFont, from PySide2.QtWidgets import * )I"; +// Change the name of a qrc file "dir/foo.qrc" file to the Python +// module name "foo_rc" according to project conventions. +static QString pythonResource(QString resource) +{ + const int lastSlash = resource.lastIndexOf(QLatin1Char('/')); + if (lastSlash != -1) + resource.remove(0, lastSlash + 1); + if (resource.endsWith(QLatin1String(".qrc"))) { + resource.chop(4); + resource.append(QLatin1String("_rc")); + } + return resource; +} + namespace Python { WriteImports::WriteImports(Uic *uic) : m_uic(uic) @@ -60,6 +75,23 @@ void WriteImports::acceptUI(DomUI *node) TreeWalker::acceptCustomWidgets(customWidgets); output << '\n'; } + + if (auto resources = node->elementResources()) { + const auto includes = resources->elementInclude(); + for (auto include : includes) { + if (include->hasAttributeLocation()) + writeImport(pythonResource(include->attributeLocation())); + } + output << '\n'; + } +} + +void WriteImports::writeImport(const QString &module) +{ + + if (m_uic->option().fromImports) + m_uic->output() << "from . "; + m_uic->output() << "import " << module << '\n'; } QString WriteImports::qtModuleOf(const DomCustomWidget *node) const diff --git a/src/tools/uic/python/pythonwriteimports.h b/src/tools/uic/python/pythonwriteimports.h index 427cbb48b1..5462453962 100644 --- a/src/tools/uic/python/pythonwriteimports.h +++ b/src/tools/uic/python/pythonwriteimports.h @@ -46,6 +46,7 @@ public: void acceptCustomWidget(DomCustomWidget *node) override; private: + void writeImport(const QString &module); QString qtModuleOf(const DomCustomWidget *node) const; Uic *const m_uic; -- cgit v1.2.3 From 02ddf08db808304363454a9ef7cba9b41af3f112 Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Thu, 2 Jan 2020 15:03:16 +0100 Subject: Note that zh's "Chinese" is in fact Mandarin Task-number: QTBUG-63457 Change-Id: If1e36c3b2230d8c45311add26c976843eb5b3d36 Reviewed-by: Liang Qi Reviewed-by: Paul Wicking --- src/corelib/text/qlocale.qdoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/corelib/text/qlocale.qdoc b/src/corelib/text/qlocale.qdoc index dbcd71f1a0..592f9d0785 100644 --- a/src/corelib/text/qlocale.qdoc +++ b/src/corelib/text/qlocale.qdoc @@ -174,7 +174,7 @@ \value Chewa Obsolete, please use Nyanja \value Chickasaw Since Qt 5.14 \value Chiga - \value Chinese + \value Chinese (Mandarin) \value Church \value Chuvash \value ClassicalMandaic Since Qt 5.1 -- cgit v1.2.3 From c62333424839b3229706a6ebb64ba271689a3b8c Mon Sep 17 00:00:00 2001 From: Christian Ehrlicher Date: Sun, 22 Dec 2019 17:53:20 +0100 Subject: QPlainTextEdit: make sure firstVisibleBlock() is valid Under some circumstances it's possible that firstVisibleBlock() returns an invalid block within QPlainTextEditPrivate::_q_textChanged() which results in a nullptr access later on. Therefore add a check similar to other places and test the validity of the returned block before accessing it. Fixes: QTBUG-80929 Change-Id: I1fd4643b10b842acfe1c356048379f0ba225dddf Reviewed-by: Friedemann Kleint Reviewed-by: Timur Pocheptsov --- src/widgets/widgets/qplaintextedit.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/widgets/widgets/qplaintextedit.cpp b/src/widgets/widgets/qplaintextedit.cpp index e8da720b58..7e9e0fabe9 100644 --- a/src/widgets/widgets/qplaintextedit.cpp +++ b/src/widgets/widgets/qplaintextedit.cpp @@ -839,7 +839,8 @@ void QPlainTextEditPrivate::_q_textChanged() placeholderVisible = !placeholderText.isEmpty() && q->document()->isEmpty() - && q->firstVisibleBlock().layout()->preeditAreaText().isEmpty(); + && (!q->firstVisibleBlock().isValid() || + q->firstVisibleBlock().layout()->preeditAreaText().isEmpty()); if (placeholderCurrentyVisible != placeholderVisible) viewport->update(); -- cgit v1.2.3 From 9b647bf5acf6a5bd4bf87646feed7b19960fc274 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cristi=C3=A1n=20Maureira-Fredes?= Date: Fri, 3 Jan 2020 16:26:37 +0100 Subject: uic: setWeight replace semi-colon by language::eol Change-Id: I87f9c2896cfd6f83f683cf731e4a62aef627d69c Reviewed-by: Friedemann Kleint --- src/tools/uic/cpp/cppwriteinitialization.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/tools/uic/cpp/cppwriteinitialization.cpp b/src/tools/uic/cpp/cppwriteinitialization.cpp index 5dbe10082c..1444c681c0 100644 --- a/src/tools/uic/cpp/cppwriteinitialization.cpp +++ b/src/tools/uic/cpp/cppwriteinitialization.cpp @@ -1612,7 +1612,7 @@ QString WriteInitialization::writeFontProperties(const DomFont *f) } if (f->hasElementWeight() && f->elementWeight() > 0) { m_output << m_indent << fontName << ".setWeight(" - << f->elementWeight() << ");" << Qt::endl; + << f->elementWeight() << ")" << language::eol; } if (f->hasElementStrikeOut()) { m_output << m_indent << fontName << ".setStrikeOut(" -- cgit v1.2.3 From 56674dca36f113369d3ed598192a392ceb723605 Mon Sep 17 00:00:00 2001 From: Christian Ehrlicher Date: Wed, 25 Dec 2019 19:37:53 +0100 Subject: QSS/QComboBox: set correct palette when drawing SC_ComboBoxArrow When the dropdown button of a combobox is drawn with QStyleSheetStyle, not only the background color is used for drawing but also QPalette::Light/Dark/Shadow. Since the palette was not properly set up in some cases, the shaded frame around the button was drawn with the default colors instead the ones derived from the given background. Therefore we have to properly set up the palette before drawing the drop down button by calling QRenderRule::configurePalette() Fixes: QTBUG-80950 Change-Id: Ibf98fa28612b5c7527ef9dd6ae06c417315f2632 Reviewed-by: Friedemann Kleint Reviewed-by: Timur Pocheptsov --- src/widgets/styles/qstylesheetstyle.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/widgets/styles/qstylesheetstyle.cpp b/src/widgets/styles/qstylesheetstyle.cpp index 98c85684ae..c694e9db97 100644 --- a/src/widgets/styles/qstylesheetstyle.cpp +++ b/src/widgets/styles/qstylesheetstyle.cpp @@ -3019,6 +3019,7 @@ void QStyleSheetStyle::drawComplexControl(ComplexControl cc, const QStyleOptionC r = positionRect(w, subRule, subRule2, PseudoElement_ComboBoxArrow, r, opt->direction); subRule2.drawRule(p, r); } else { + rule.configurePalette(&cmbOpt.palette, QPalette::ButtonText, QPalette::Button); cmbOpt.subControls = QStyle::SC_ComboBoxArrow; QWindowsStyle::drawComplexControl(cc, &cmbOpt, p, w); } -- cgit v1.2.3 From 2c3eaa7b87219d24facfe81a5b22cb218324f1ae Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Fri, 27 Dec 2019 18:01:49 +0100 Subject: Fix semi-transparent text on Linux with subpixel anti-aliasing The newly optimized rgbBlend function wasn't updated to handle SourceOver compositing when dealing with semi-transparent text color. The extra composition isn't SIMD optimized but short-cut for all opaque colors. Fixes: QTBUG-80982 Change-Id: I88c1e60fd5e80a8c7f9e6b0e7de8248c7c00ebc2 Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/gui/painting/qdrawhelper.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp index e8d129d047..f8d5914f37 100644 --- a/src/gui/painting/qdrawhelper.cpp +++ b/src/gui/painting/qdrawhelper.cpp @@ -6048,7 +6048,11 @@ static inline void alphargbblend_argb32(quint32 *dst, uint coverage, const QRgba // Give up and do a naive gray alphablend. Needed to deal with ARGB32 and invalid ARGB32_premultiplied, see QTBUG-60571 blend_pixel(*dst, src, qRgbAvg(coverage)); } else if (!colorProfile) { - *dst = rgbBlend(*dst, src, coverage); + // First do naive blend with text-color + QRgb s = *dst; + blend_pixel(s, src); + // Then a naive blend with glyph shape + *dst = rgbBlend(*dst, s, coverage); } else if (srcLinear.isOpaque()) { rgbBlendPixel(dst, coverage, srcLinear, colorProfile); } else { -- cgit v1.2.3 From aa542be4e005b1feedc2e17fd6ca2387bf2fea1b Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Wed, 18 Dec 2019 17:23:50 +0100 Subject: Modernize setAlphaChannel(), and deprecated alphaChannel() The two methods have been marked obsolete for a very long time, setAlphaChannel() is still convenient though, so this patch modernizes it and removes obsolete from the API, while marking QImage::alphaChannel() as deprecated. They don't work as getter and setter anyway, since setAlphaChannel() actually does an alpha composition. Change-Id: I634d6463f78c42bb9c5fa3df17500ec01bfcac33 Reviewed-by: Eirik Aavitsland --- src/gui/image/qimage.cpp | 95 +++++++++------------------- src/gui/image/qimage.h | 4 +- src/plugins/imageformats/ico/qicohandler.cpp | 2 - 3 files changed, 32 insertions(+), 69 deletions(-) (limited to 'src') diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp index 99d64737c5..3ddc52bed4 100644 --- a/src/gui/image/qimage.cpp +++ b/src/gui/image/qimage.cpp @@ -4410,99 +4410,61 @@ bool QImage::isDetached() const /*! - \obsolete Sets the alpha channel of this image to the given \a alphaChannel. - If \a alphaChannel is an 8 bit grayscale image, the intensity values are - written into this buffer directly. Otherwise, \a alphaChannel is converted - to 32 bit and the intensity of the RGB pixel values is used. - - Note that the image will be converted to the Format_ARGB32_Premultiplied - format if the function succeeds. + If \a alphaChannel is an 8 bit alpha image, the alpha values are + used directly. Otherwise, \a alphaChannel is converted to 8 bit + grayscale and the intensity of the pixel values is used. - Use one of the composition modes in QPainter::CompositionMode instead. + If the image already has an alpha channel, the existing alpha channel + is multiplied with the new one. If the image doesn't have an alpha + channel it will be converted to a format that does. - \warning This function is expensive. + The operation is similar to painting \a alphaChannel as an alpha image + over this image using \c QPainter::CompositionMode_DestinationIn. - \sa alphaChannel(), {QImage#Image Transformations}{Image - Transformations}, {QImage#Image Formats}{Image Formats} + \sa hasAlphaChannel(), alphaChannel(), + {QImage#Image Transformations}{Image Transformations}, + {QImage#Image Formats}{Image Formats} */ void QImage::setAlphaChannel(const QImage &alphaChannel) { - if (!d) + if (!d || alphaChannel.isNull()) return; - int w = d->width; - int h = d->height; - - if (w != alphaChannel.d->width || h != alphaChannel.d->height) { - qWarning("QImage::setAlphaChannel: " - "Alpha channel must have same dimensions as the target image"); - return; - } - if (d->paintEngine && d->paintEngine->isActive()) { qWarning("QImage::setAlphaChannel: " "Unable to set alpha channel while image is being painted on"); return; } - if (d->format == QImage::Format_ARGB32_Premultiplied) + const Format alphaFormat = qt_alphaVersionForPainting(d->format); + if (d->format == alphaFormat) detach(); else - *this = convertToFormat(QImage::Format_ARGB32_Premultiplied); + convertTo(alphaFormat); if (isNull()) return; - // Slight optimization since alphachannels are returned as 8-bit grays. - if (alphaChannel.format() == QImage::Format_Alpha8 ||( alphaChannel.d->depth == 8 && alphaChannel.isGrayscale())) { - const uchar *src_data = alphaChannel.d->data; - uchar *dest_data = d->data; - for (int y=0; ybytes_per_line; - dest_data += d->bytes_per_line; - } + QImage sourceImage; + if (alphaChannel.format() == QImage::Format_Alpha8 || (alphaChannel.d->depth == 8 && alphaChannel.isGrayscale())) + sourceImage = alphaChannel; + else + sourceImage = alphaChannel.convertToFormat(QImage::Format_Grayscale8); + if (!sourceImage.reinterpretAsFormat(QImage::Format_Alpha8)) + return; - } else { - const QImage sourceImage = alphaChannel.convertToFormat(QImage::Format_RGB32); - if (sourceImage.isNull()) - return; - const uchar *src_data = sourceImage.d->data; - uchar *dest_data = d->data; - for (int y=0; ybytes_per_line; - dest_data += d->bytes_per_line; - } - } + QPainter painter(this); + if (sourceImage.size() != size()) + painter.setRenderHint(QPainter::SmoothPixmapTransform); + painter.setCompositionMode(QPainter::CompositionMode_DestinationIn); + painter.drawImage(rect(), sourceImage); } +#if QT_DEPRECATED_SINCE(5, 15) /*! \obsolete @@ -4592,6 +4554,7 @@ QImage QImage::alphaChannel() const return image; } +#endif /*! Returns \c true if the image has a format that respects the alpha diff --git a/src/gui/image/qimage.h b/src/gui/image/qimage.h index 7544ccca05..115071c16e 100644 --- a/src/gui/image/qimage.h +++ b/src/gui/image/qimage.h @@ -266,7 +266,9 @@ public: bool hasAlphaChannel() const; void setAlphaChannel(const QImage &alphaChannel); - QImage alphaChannel() const; +#if QT_DEPRECATED_SINCE(5, 15) + QT_DEPRECATED QImage alphaChannel() const; +#endif QImage createAlphaMask(Qt::ImageConversionFlags flags = Qt::AutoColor) const; #ifndef QT_NO_IMAGE_HEURISTIC_MASK QImage createHeuristicMask(bool clipTight = true) const; diff --git a/src/plugins/imageformats/ico/qicohandler.cpp b/src/plugins/imageformats/ico/qicohandler.cpp index 6515748bf5..eb50f52bd6 100644 --- a/src/plugins/imageformats/ico/qicohandler.cpp +++ b/src/plugins/imageformats/ico/qicohandler.cpp @@ -535,8 +535,6 @@ QImage ICOReader::iconAt(int index) if (!mask.isNull()) { img = image; img.setAlphaChannel(mask); - // (Luckily, it seems that setAlphaChannel() does not ruin the alpha values - // of partially transparent pixels in those icons that have that) } } } -- cgit v1.2.3 From 24b8b2cb6ccd3704545ef44519f567edb3da5d5d Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Fri, 3 Jan 2020 13:39:04 +0100 Subject: Stylesheet: Handle tabs with elide mode set correctly In order for SE_TabBarTabText to correctly calculate the space available for the text it needs to get the rectangle of the tab directly instead of relying on the option's rectangle as this may have been modified before this point. Therefore we introduce QStyleOptionTabV4 to be able to store the index as part of the option so it can be queried directly. [ChangeLog][QtWidgets] Added QStyleOptionTabV4 as a subclass of QStyleOptionTab so that the tab's index information can be obtained. Fixes: QTBUG-50637 Change-Id: If705f5069fdd14eeccf06bc63dba4e8d2e704359 Reviewed-by: Volker Hilsheimer Reviewed-by: Christian Ehrlicher --- src/widgets/styles/qstyleoption.cpp | 16 ++++++++++++++++ src/widgets/styles/qstyleoption.h | 8 ++++++++ src/widgets/styles/qstylesheetstyle.cpp | 10 ++++++++++ src/widgets/widgets/qtabbar.cpp | 16 +++++++++------- 4 files changed, 43 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/widgets/styles/qstyleoption.cpp b/src/widgets/styles/qstyleoption.cpp index 5292d971ea..aca4eec0e7 100644 --- a/src/widgets/styles/qstyleoption.cpp +++ b/src/widgets/styles/qstyleoption.cpp @@ -1470,6 +1470,22 @@ QStyleOptionTab::QStyleOptionTab(int version) The default value is QSize(-1, -1), i.e. an invalid size; */ +/*! + Constructs a QStyleOptionTabV4 object, initializing the members + variables to their default values. + */ + +QStyleOptionTabV4::QStyleOptionTabV4() : QStyleOptionTab(QStyleOptionTabV4::Version) +{ +} + +/*! + \variable QStyleOptionTabV4::tabIndex + \brief the index for the tab being represented. + + The default value is -1, i.e. a tab not on a tabbar; + */ + #endif // QT_CONFIG(tabbar) /*! diff --git a/src/widgets/styles/qstyleoption.h b/src/widgets/styles/qstyleoption.h index 7f5edf4279..a8ce3b465e 100644 --- a/src/widgets/styles/qstyleoption.h +++ b/src/widgets/styles/qstyleoption.h @@ -296,6 +296,14 @@ protected: QStyleOptionTab(int version); }; +class Q_WIDGETS_EXPORT QStyleOptionTabV4 : public QStyleOptionTab +{ +public: + enum StyleOptionVersion { Version = 4 }; + QStyleOptionTabV4(); + int tabIndex = -1; +}; + Q_DECLARE_OPERATORS_FOR_FLAGS(QStyleOptionTab::CornerWidgets) typedef Q_DECL_DEPRECATED QStyleOptionTab QStyleOptionTabV2; diff --git a/src/widgets/styles/qstylesheetstyle.cpp b/src/widgets/styles/qstylesheetstyle.cpp index 7e8c9a6050..7fe46e24b6 100644 --- a/src/widgets/styles/qstylesheetstyle.cpp +++ b/src/widgets/styles/qstylesheetstyle.cpp @@ -6009,6 +6009,16 @@ QRect QStyleSheetStyle::subElementRect(SubElement se, const QStyleOption *opt, c case SE_TabBarTabRightButton: { QRenderRule subRule = renderRule(w, opt, PseudoElement_TabBarTab); if (subRule.hasBox() || !subRule.hasNativeBorder()) { + if (se == SE_TabBarTabText) { + if (const QStyleOptionTabV4 *tab = qstyleoption_cast(opt)) { + const QTabBar *bar = qobject_cast(w); + const QRect optRect = bar && tab->tabIndex != -1 ? bar->tabRect(tab->tabIndex) : opt->rect; + const QRect r = positionRect(w, subRule, PseudoElement_TabBarTab, optRect, opt->direction); + QStyleOptionTabV4 tabCopy(*tab); + tabCopy.rect = subRule.contentsRect(r); + return ParentStyle::subElementRect(se, &tabCopy, w); + } + } return ParentStyle::subElementRect(se, opt, w); } break; diff --git a/src/widgets/widgets/qtabbar.cpp b/src/widgets/widgets/qtabbar.cpp index aff95b0931..a7b115a1bc 100644 --- a/src/widgets/widgets/qtabbar.cpp +++ b/src/widgets/widgets/qtabbar.cpp @@ -229,6 +229,8 @@ void QTabBarPrivate::initBasicStyleOption(QStyleOptionTab *option, int tabIndex) option->cornerWidgets |= QStyleOptionTab::RightCornerWidget; } #endif + if (QStyleOptionTabV4 *optv4 = qstyleoption_cast(option)) + optv4->tabIndex = tabIndex; } /*! @@ -628,7 +630,7 @@ QRect QTabBarPrivate::normalizedScrollRect(int index) // tab bar itself is in a different orientation. Q_Q(QTabBar); - QStyleOptionTab opt; + QStyleOptionTabV4 opt; q->initStyleOption(&opt, currentIndex); opt.rect = q->rect(); @@ -757,7 +759,7 @@ void QTabBarPrivate::layoutTab(int index) if (!(tab.leftWidget || tab.rightWidget)) return; - QStyleOptionTab opt; + QStyleOptionTabV4 opt; q->initStyleOption(&opt, index); if (tab.leftWidget) { QRect rect = q->style()->subElementRect(QStyle::SE_TabBarTabLeftButton, &opt, q); @@ -1003,7 +1005,7 @@ int QTabBar::insertTab(int index, const QIcon& icon, const QString &text) } if (d->closeButtonOnTabs) { - QStyleOptionTab opt; + QStyleOptionTabV4 opt; initStyleOption(&opt, index); ButtonPosition closeSide = (ButtonPosition)style()->styleHint(QStyle::SH_TabBar_CloseButtonPosition, nullptr, this); QAbstractButton *closeButton = new CloseButton(this); @@ -1574,7 +1576,7 @@ QSize QTabBar::tabSizeHint(int index) const //Note: this must match with the computations in QCommonStylePrivate::tabLayout Q_D(const QTabBar); if (const QTabBarPrivate::Tab *tab = d->at(index)) { - QStyleOptionTab opt; + QStyleOptionTabV4 opt; d->initBasicStyleOption(&opt, index); opt.text = d->tabList.at(index).text; QSize iconSize = tab->icon.isNull() ? QSize(0, 0) : opt.iconSize; @@ -1819,7 +1821,7 @@ void QTabBar::paintEvent(QPaintEvent *) for (int i = 0; i < d->tabList.count(); ++i) { if (!d->at(i)->visible) continue; - QStyleOptionTab tab; + QStyleOptionTabV4 tab; initStyleOption(&tab, i); if (d->paintWithOffsets && d->tabList[i].dragOffset != 0) { if (vertical) { @@ -1859,7 +1861,7 @@ void QTabBar::paintEvent(QPaintEvent *) // Draw the selected tab last to get it "on top" if (selected >= 0) { - QStyleOptionTab tab; + QStyleOptionTabV4 tab; initStyleOption(&tab, selected); if (d->paintWithOffsets && d->tabList[selected].dragOffset != 0) { if (vertical) @@ -2209,7 +2211,7 @@ void QTabBarPrivate::setupMovableTab() grabImage.fill(Qt::transparent); QStylePainter p(&grabImage, q); - QStyleOptionTab tab; + QStyleOptionTabV4 tab; q->initStyleOption(&tab, pressedIndex); tab.position = QStyleOptionTab::OnlyOneTab; if (verticalTabs(shape)) -- cgit v1.2.3 From 6d201aa1bddad04fd4176c526a878ec9cad6f9ab Mon Sep 17 00:00:00 2001 From: Giuseppe D'Angelo Date: Fri, 3 Jan 2020 12:00:10 +0100 Subject: QRegularExpression: make escape-like functions work on QStringView They don't store the strings. [ChangeLog][QtCore][QRegularExpression] The escape(), wildcardToRegularExpression() and anchoredPattern() functions now have overloads taking a QStringView parameter. Change-Id: Icc66ba1201ef1f1064d9565900439e78912b675c Reviewed-by: Samuel Gaist --- src/corelib/text/qregularexpression.cpp | 48 +++++++++++++++++++++++++++++---- src/corelib/text/qregularexpression.h | 20 ++++++++------ 2 files changed, 55 insertions(+), 13 deletions(-) (limited to 'src') diff --git a/src/corelib/text/qregularexpression.cpp b/src/corelib/text/qregularexpression.cpp index 068c960910..fb8f5a5efc 100644 --- a/src/corelib/text/qregularexpression.cpp +++ b/src/corelib/text/qregularexpression.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2016 Giuseppe D'Angelo . -** Copyright (C) 2016 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Giuseppe D'Angelo +** Copyright (C) 2020 Giuseppe D'Angelo . +** Copyright (C) 2020 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Giuseppe D'Angelo ** Copyright (C) 2016 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** @@ -1829,7 +1829,19 @@ uint qHash(const QRegularExpression &key, uint seed) noexcept return seed; } +#if QT_STRINGVIEW_LEVEL < 2 /*! + \overload +*/ +QString QRegularExpression::escape(const QString &str) +{ + return escape(QStringView(str)); +} +#endif // QT_STRINGVIEW_LEVEL < 2 + +/*! + \since 5.15 + Escapes all characters of \a str so that they no longer have any special meaning when used as a regular expression pattern string, and returns the escaped string. For instance: @@ -1847,7 +1859,7 @@ uint qHash(const QRegularExpression &key, uint seed) noexcept inside \a str is escaped with the sequence \c{"\\0"} (backslash + \c{'0'}), instead of \c{"\\\0"} (backslash + \c{NUL}). */ -QString QRegularExpression::escape(const QString &str) +QString QRegularExpression::escape(QStringView str) { QString result; const int count = str.size(); @@ -1882,8 +1894,19 @@ QString QRegularExpression::escape(const QString &str) return result; } +#if QT_STRINGVIEW_LEVEL < 2 /*! \since 5.12 + \overload +*/ +QString QRegularExpression::wildcardToRegularExpression(const QString &pattern) +{ + return wildcardToRegularExpression(QStringView(pattern)); +} +#endif // QT_STRINGVIEW_LEVEL < 2 + +/*! + \since 5.15 Returns a regular expression representation of the given glob \a pattern. The transformation is targeting file path globbing, which means in particular @@ -1928,13 +1951,13 @@ QString QRegularExpression::escape(const QString &str) \sa escape() */ -QString QRegularExpression::wildcardToRegularExpression(const QString &pattern) +QString QRegularExpression::wildcardToRegularExpression(QStringView pattern) { const int wclen = pattern.length(); QString rx; rx.reserve(wclen + wclen / 16); int i = 0; - const QChar *wc = pattern.unicode(); + const QChar *wc = pattern.data(); #ifdef Q_OS_WIN const QLatin1Char nativePathSeparator('\\'); @@ -2006,16 +2029,31 @@ QString QRegularExpression::wildcardToRegularExpression(const QString &pattern) return anchoredPattern(rx); } +#if QT_STRINGVIEW_LEVEL < 2 /*! \fn QRegularExpression::anchoredPattern(const QString &expression) \since 5.12 + \overload +*/ +#endif // QT_STRINGVIEW_LEVEL < 2 + +/*! + \since 5.15 + 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} */ +QString QRegularExpression::anchoredPattern(QStringView expression) +{ + return QString() + + QLatin1String("\\A(?:") + + expression + + QLatin1String(")\\z"); +} /*! \since 5.1 diff --git a/src/corelib/text/qregularexpression.h b/src/corelib/text/qregularexpression.h index f799a38ae4..4fa258b080 100644 --- a/src/corelib/text/qregularexpression.h +++ b/src/corelib/text/qregularexpression.h @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2012 Giuseppe D'Angelo . -** Copyright (C) 2012 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Giuseppe D'Angelo +** Copyright (C) 2020 Giuseppe D'Angelo . +** Copyright (C) 2020 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Giuseppe D'Angelo ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the QtCore module of the Qt Toolkit. @@ -42,9 +42,8 @@ #define QREGULAREXPRESSION_H #include - #include -#include +#include #include #include @@ -52,7 +51,8 @@ QT_REQUIRE_CONFIG(regularexpression); QT_BEGIN_NAMESPACE -class QStringView; +class QStringList; +class QLatin1String; class QRegularExpressionMatch; class QRegularExpressionMatchIterator; @@ -137,14 +137,18 @@ public: void optimize() const; +#if QT_STRINGVIEW_LEVEL < 2 static QString escape(const QString &str); static QString wildcardToRegularExpression(const QString &str); static inline QString anchoredPattern(const QString &expression) { - return QLatin1String("\\A(?:") - + expression - + QLatin1String(")\\z"); + return anchoredPattern(QStringView(expression)); } +#endif + + static QString escape(QStringView str); + static QString wildcardToRegularExpression(QStringView str); + static QString anchoredPattern(QStringView expression); bool operator==(const QRegularExpression &re) const; inline bool operator!=(const QRegularExpression &re) const { return !operator==(re); } -- cgit v1.2.3 From 908df199d0782d161e83d75dd7a7d9aab29ff9e7 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Fri, 13 Dec 2019 14:18:11 +0100 Subject: Add environment variables for customizing Vulkan QT_VULKAN_INSTANCE_EXTENSIONS to specify additional instance extensions. QT_VULKAN_INSTANCE_LAYERS to specify additional instance layers. QT_VULKAN_DEVICE_EXTENSIONS to specify additional device extensions. These will apply to all QVulkanWindows and everything that uses RHI, including Qt Quick with the Vulkan RHI backend. Task-number: QTBUG-80499 Change-Id: I912495affa987d62a9823d55d06d6a8209f6adc6 Reviewed-by: Laszlo Agocs --- src/gui/rhi/qrhivulkan.cpp | 11 +++++++++++ src/gui/vulkan/qvulkanwindow.cpp | 9 +++++++++ .../vkconvenience/qbasicvulkanplatforminstance.cpp | 16 ++++++++++++++++ 3 files changed, 36 insertions(+) (limited to 'src') diff --git a/src/gui/rhi/qrhivulkan.cpp b/src/gui/rhi/qrhivulkan.cpp index 21ae142b1d..c540e9fa85 100644 --- a/src/gui/rhi/qrhivulkan.cpp +++ b/src/gui/rhi/qrhivulkan.cpp @@ -501,6 +501,17 @@ bool QRhiVulkan::create(QRhi::Flags flags) } } + QByteArrayList envExtList; + if (qEnvironmentVariableIsSet("QT_VULKAN_DEVICE_EXTENSIONS")) { + envExtList = qgetenv("QT_VULKAN_DEVICE_EXTENSIONS").split(';'); + for (auto ext : requestedDevExts) + envExtList.removeAll(ext); + for (const QByteArray &ext : envExtList) { + if (!ext.isEmpty()) + requestedDevExts.append(ext.constData()); + } + } + VkDeviceCreateInfo devInfo; memset(&devInfo, 0, sizeof(devInfo)); devInfo.sType = VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO; diff --git a/src/gui/vulkan/qvulkanwindow.cpp b/src/gui/vulkan/qvulkanwindow.cpp index ed73a77683..e211863f21 100644 --- a/src/gui/vulkan/qvulkanwindow.cpp +++ b/src/gui/vulkan/qvulkanwindow.cpp @@ -689,6 +689,15 @@ void QVulkanWindowPrivate::init() QVulkanInfoVector supportedExtensions = q->supportedDeviceExtensions(); QByteArrayList reqExts = requestedDevExtensions; reqExts.append("VK_KHR_swapchain"); + + QByteArray envExts = qgetenv("QT_VULKAN_DEVICE_EXTENSIONS"); + if (!envExts.isEmpty()) { + QByteArrayList envExtList = envExts.split(';'); + for (auto ext : reqExts) + envExtList.removeAll(ext); + reqExts.append(envExtList); + } + for (const QByteArray &ext : reqExts) { if (supportedExtensions.contains(ext)) devExts.append(ext.constData()); diff --git a/src/platformsupport/vkconvenience/qbasicvulkanplatforminstance.cpp b/src/platformsupport/vkconvenience/qbasicvulkanplatforminstance.cpp index 68340a3173..6f6ba58319 100644 --- a/src/platformsupport/vkconvenience/qbasicvulkanplatforminstance.cpp +++ b/src/platformsupport/vkconvenience/qbasicvulkanplatforminstance.cpp @@ -214,6 +214,22 @@ void QBasicPlatformVulkanInstance::initInstance(QVulkanInstance *instance, const for (const QByteArray &ext : extraExts) m_enabledExtensions.append(ext); + QByteArray envExts = qgetenv("QT_VULKAN_INSTANCE_EXTENSIONS"); + if (!envExts.isEmpty()) { + QByteArrayList envExtList = envExts.split(';'); + for (auto ext : m_enabledExtensions) + envExtList.removeAll(ext); + m_enabledExtensions.append(envExtList); + } + + QByteArray envLayers = qgetenv("QT_VULKAN_INSTANCE_LAYERS"); + if (!envLayers.isEmpty()) { + QByteArrayList envLayerList = envLayers.split(';'); + for (auto ext : m_enabledLayers) + envLayerList.removeAll(ext); + m_enabledLayers.append(envLayerList); + } + // No clever stuff with QSet and friends: the order for layers matters // and the user-provided order must be kept. for (int i = 0; i < m_enabledLayers.count(); ++i) { -- cgit v1.2.3 From 844ef184e8021237280a45ead04a3ab39cefa657 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Tue, 17 Dec 2019 15:15:24 +0100 Subject: RHI: Remove old native texture API Task-number: QTBUG-78570 Change-Id: I8c4850828ac03319ac923a26c2e985883956c286 Reviewed-by: Laszlo Agocs --- src/gui/rhi/qrhi.cpp | 44 -------------------------------------- src/gui/rhi/qrhi_p.h | 2 -- src/gui/rhi/qrhid3d11.cpp | 43 +------------------------------------ src/gui/rhi/qrhid3d11_p.h | 5 ----- src/gui/rhi/qrhid3d11_p_p.h | 3 --- src/gui/rhi/qrhigles2.cpp | 41 +---------------------------------- src/gui/rhi/qrhigles2_p.h | 5 ----- src/gui/rhi/qrhigles2_p_p.h | 4 +--- src/gui/rhi/qrhimetal.mm | 43 +------------------------------------ src/gui/rhi/qrhimetal_p.h | 5 ----- src/gui/rhi/qrhimetal_p_p.h | 3 --- src/gui/rhi/qrhinull.cpp | 22 ++----------------- src/gui/rhi/qrhinull_p.h | 4 ---- src/gui/rhi/qrhinull_p_p.h | 3 --- src/gui/rhi/qrhivulkan.cpp | 51 +------------------------------------------- src/gui/rhi/qrhivulkan_p.h | 6 ------ src/gui/rhi/qrhivulkan_p_p.h | 3 --- 17 files changed, 7 insertions(+), 280 deletions(-) (limited to 'src') diff --git a/src/gui/rhi/qrhi.cpp b/src/gui/rhi/qrhi.cpp index 58f30deb41..00d4df53bd 100644 --- a/src/gui/rhi/qrhi.cpp +++ b/src/gui/rhi/qrhi.cpp @@ -2214,20 +2214,6 @@ QRhiResource::Type QRhiTexture::resourceType() const Regardless of the return value, calling release() is always safe. */ -/*! - \return a pointer to a backend-specific QRhiNativeHandles subclass, such as - QRhiVulkanTextureNativeHandles. The returned value is null when exposing - the underlying native resources is not supported by the backend. - - \sa QRhiVulkanTextureNativeHandles, QRhiD3D11TextureNativeHandles, - QRhiMetalTextureNativeHandles, QRhiGles2TextureNativeHandles - */ -// TODO: remove this version once QtQuick has stopped using it -const QRhiNativeHandles *QRhiTexture::nativeHandles() -{ - return nullptr; -} - /*! \return the underlying native resources for this texture. The returned value will be empty if exposing the underlying native resources is not supported by @@ -2240,36 +2226,6 @@ QRhiTexture::NativeTexture QRhiTexture::nativeTexture() return {}; } -/*! - Similar to build() except that no new native textures are created. Instead, - the texture from \a src is used. - - This allows importing an existing native texture object (which must belong - to the same device or sharing context, depending on the graphics API) from - an external graphics engine. - - \note format(), pixelSize(), sampleCount(), and flags() must still be set - correctly. Passing incorrect sizes and other values to QRhi::newTexture() - and then following it with a buildFrom() expecting that the native texture - object alone is sufficient to deduce such values is \b wrong and will lead - to problems. - - \note QRhiTexture does not take ownership of the texture object. release() - does not free the object or any associated memory. - - The opposite of this operation, exposing a QRhiTexture-created native - texture object to a foreign engine, is possible via nativeHandles(). - - \sa QRhiVulkanTextureNativeHandles, QRhiD3D11TextureNativeHandles, - QRhiMetalTextureNativeHandles, QRhiGles2TextureNativeHandles - */ -// TODO: remove this version once QtQuick has stopped using it -bool QRhiTexture::buildFrom(const QRhiNativeHandles *src) -{ - Q_UNUSED(src); - return false; -} - /*! Similar to build() except that no new native textures are created. Instead, the native texture resources specified by \a src is used. diff --git a/src/gui/rhi/qrhi_p.h b/src/gui/rhi/qrhi_p.h index 44118b2f10..a6c65aac5e 100644 --- a/src/gui/rhi/qrhi_p.h +++ b/src/gui/rhi/qrhi_p.h @@ -780,9 +780,7 @@ public: void setSampleCount(int s) { m_sampleCount = s; } virtual bool build() = 0; - virtual const QRhiNativeHandles *nativeHandles(); virtual NativeTexture nativeTexture(); - virtual bool buildFrom(const QRhiNativeHandles *src); virtual bool buildFrom(NativeTexture src); protected: diff --git a/src/gui/rhi/qrhid3d11.cpp b/src/gui/rhi/qrhid3d11.cpp index ba2488bffb..c5923fe411 100644 --- a/src/gui/rhi/qrhid3d11.cpp +++ b/src/gui/rhi/qrhid3d11.cpp @@ -108,17 +108,6 @@ QT_BEGIN_NAMESPACE \c{ID3D11Device *} and \c{ID3D11DeviceContext *}. */ -/*! - \class QRhiD3D11TextureNativeHandles - \internal - \inmodule QtGui - \brief Holds the D3D texture object that is backing a QRhiTexture instance. - - \note The class uses \c{void *} as the type since including the COM-based - \c{d3d11.h} headers is not acceptable here. The actual type is - \c{ID3D11Texture2D *}. - */ - // help mingw with its ancient sdk headers #ifndef DXGI_ADAPTER_FLAG_SOFTWARE #define DXGI_ADAPTER_FLAG_SOFTWARE 2 @@ -2674,8 +2663,6 @@ bool QD3D11Texture::finishBuild() return false; } - nativeHandlesStruct.texture = tex; - generation += 1; return true; } @@ -2741,29 +2728,6 @@ bool QD3D11Texture::build() return true; } -bool QD3D11Texture::buildFrom(const QRhiNativeHandles *src) -{ - const QRhiD3D11TextureNativeHandles *h = static_cast(src); - if (!h || !h->texture) - return false; - - if (!prepareBuild()) - return false; - - tex = static_cast(h->texture); - - if (!finishBuild()) - return false; - - QRHI_PROF; - QRHI_PROF_F(newTexture(this, false, int(mipLevelCount), m_flags.testFlag(CubeMap) ? 6 : 1, int(sampleDesc.Count))); - - owns = false; - QRHI_RES_RHI(QRhiD3D11); - rhiD->registerResource(this); - return true; -} - bool QD3D11Texture::buildFrom(QRhiTexture::NativeTexture src) { auto *srcTex = static_cast(src.object); @@ -2787,14 +2751,9 @@ bool QD3D11Texture::buildFrom(QRhiTexture::NativeTexture src) return true; } -const QRhiNativeHandles *QD3D11Texture::nativeHandles() -{ - return &nativeHandlesStruct; -} - QRhiTexture::NativeTexture QD3D11Texture::nativeTexture() { - return {&nativeHandlesStruct.texture, 0}; + return {&tex, 0}; } ID3D11UnorderedAccessView *QD3D11Texture::unorderedAccessViewForLevel(int level) diff --git a/src/gui/rhi/qrhid3d11_p.h b/src/gui/rhi/qrhid3d11_p.h index 5df1843b1e..aba0f37ee7 100644 --- a/src/gui/rhi/qrhid3d11_p.h +++ b/src/gui/rhi/qrhid3d11_p.h @@ -69,11 +69,6 @@ struct Q_GUI_EXPORT QRhiD3D11NativeHandles : public QRhiNativeHandles void *context = nullptr; }; -struct Q_GUI_EXPORT QRhiD3D11TextureNativeHandles : public QRhiNativeHandles -{ - void *texture = nullptr; // ID3D11Texture2D* -}; - QT_END_NAMESPACE #endif diff --git a/src/gui/rhi/qrhid3d11_p_p.h b/src/gui/rhi/qrhid3d11_p_p.h index 8f02c4300b..9ddd2aa797 100644 --- a/src/gui/rhi/qrhid3d11_p_p.h +++ b/src/gui/rhi/qrhid3d11_p_p.h @@ -99,9 +99,7 @@ struct QD3D11Texture : public QRhiTexture ~QD3D11Texture(); void release() override; bool build() override; - bool buildFrom(const QRhiNativeHandles *src) override; bool buildFrom(NativeTexture src) override; - const QRhiNativeHandles *nativeHandles() override; NativeTexture nativeTexture() override; bool prepareBuild(QSize *adjustedSize = nullptr); @@ -114,7 +112,6 @@ struct QD3D11Texture : public QRhiTexture DXGI_FORMAT dxgiFormat; uint mipLevelCount = 0; DXGI_SAMPLE_DESC sampleDesc; - QRhiD3D11TextureNativeHandles nativeHandlesStruct; ID3D11UnorderedAccessView *perLevelViews[QRhi::MAX_LEVELS]; uint generation = 0; friend class QRhiD3D11; diff --git a/src/gui/rhi/qrhigles2.cpp b/src/gui/rhi/qrhigles2.cpp index ffaccbad71..e63ed11dd4 100644 --- a/src/gui/rhi/qrhigles2.cpp +++ b/src/gui/rhi/qrhigles2.cpp @@ -137,13 +137,6 @@ QT_BEGIN_NAMESPACE \brief Holds the OpenGL context used by the QRhi. */ -/*! - \class QRhiGles2TextureNativeHandles - \internal - \inmodule QtGui - \brief Holds the OpenGL texture object that is backing a QRhiTexture instance. - */ - #ifndef GL_BGRA #define GL_BGRA 0x80E1 #endif @@ -3324,7 +3317,6 @@ void QGles2Texture::release() texture = 0; specified = false; - nativeHandlesStruct.texture = 0; QRHI_RES_RHI(QRhiGles2); if (owns) @@ -3483,31 +3475,6 @@ bool QGles2Texture::build() QRHI_PROF_F(newTexture(this, true, mipLevelCount, isCube ? 6 : 1, 1)); owns = true; - nativeHandlesStruct.texture = texture; - - generation += 1; - rhiD->registerResource(this); - return true; -} - -bool QGles2Texture::buildFrom(const QRhiNativeHandles *src) -{ - const QRhiGles2TextureNativeHandles *h = static_cast(src); - if (!h || !h->texture) - return false; - - if (!prepareBuild()) - return false; - - texture = h->texture; - specified = true; - - QRHI_RES_RHI(QRhiGles2); - QRHI_PROF; - QRHI_PROF_F(newTexture(this, false, mipLevelCount, m_flags.testFlag(CubeMap) ? 6 : 1, 1)); - - owns = false; - nativeHandlesStruct.texture = texture; generation += 1; rhiD->registerResource(this); @@ -3531,21 +3498,15 @@ bool QGles2Texture::buildFrom(QRhiTexture::NativeTexture src) QRHI_PROF_F(newTexture(this, false, mipLevelCount, m_flags.testFlag(CubeMap) ? 6 : 1, 1)); owns = false; - nativeHandlesStruct.texture = texture; generation += 1; rhiD->registerResource(this); return true; } -const QRhiNativeHandles *QGles2Texture::nativeHandles() -{ - return &nativeHandlesStruct; -} - QRhiTexture::NativeTexture QGles2Texture::nativeTexture() { - return {&nativeHandlesStruct.texture, 0}; + return {&texture, 0}; } QGles2Sampler::QGles2Sampler(QRhiImplementation *rhi, Filter magFilter, Filter minFilter, Filter mipmapMode, diff --git a/src/gui/rhi/qrhigles2_p.h b/src/gui/rhi/qrhigles2_p.h index 7f7c8b4c40..8d8f0c7396 100644 --- a/src/gui/rhi/qrhigles2_p.h +++ b/src/gui/rhi/qrhigles2_p.h @@ -74,11 +74,6 @@ struct Q_GUI_EXPORT QRhiGles2NativeHandles : public QRhiNativeHandles QOpenGLContext *context = nullptr; }; -struct Q_GUI_EXPORT QRhiGles2TextureNativeHandles : public QRhiNativeHandles -{ - uint texture = 0; -}; - QT_END_NAMESPACE #endif diff --git a/src/gui/rhi/qrhigles2_p_p.h b/src/gui/rhi/qrhigles2_p_p.h index d4f1336c3e..a9b3022612 100644 --- a/src/gui/rhi/qrhigles2_p_p.h +++ b/src/gui/rhi/qrhigles2_p_p.h @@ -132,9 +132,7 @@ struct QGles2Texture : public QRhiTexture ~QGles2Texture(); void release() override; bool build() override; - bool buildFrom(const QRhiNativeHandles *src) override; bool buildFrom(NativeTexture src) override; - const QRhiNativeHandles *nativeHandles() override; NativeTexture nativeTexture() override; bool prepareBuild(QSize *adjustedSize = nullptr); @@ -149,7 +147,7 @@ struct QGles2Texture : public QRhiTexture QGles2SamplerData samplerState; bool specified = false; int mipLevelCount = 0; - QRhiGles2TextureNativeHandles nativeHandlesStruct; + enum Access { AccessNone, AccessSample, diff --git a/src/gui/rhi/qrhimetal.mm b/src/gui/rhi/qrhimetal.mm index b6ca40e08b..222bf170dc 100644 --- a/src/gui/rhi/qrhimetal.mm +++ b/src/gui/rhi/qrhimetal.mm @@ -113,15 +113,6 @@ QT_BEGIN_NAMESPACE \c{id}. */ -/*! - \class QRhiMetalTextureNativeHandles - \inmodule QtRhi - \brief Holds the Metal texture object that is backing a QRhiTexture instance. - - \note The class uses \c{void *} as the type since including the Objective C - headers is not acceptable here. The actual type is \c{id}. - */ - /*! \class QRhiMetalCommandBufferNativeHandles \inmodule QtRhi @@ -2296,7 +2287,6 @@ void QMetalTexture::release() e.texture.texture = d->owns ? d->tex : nil; d->tex = nil; - nativeHandlesStruct.texture = nullptr; for (int i = 0; i < QMTL_FRAMES_IN_FLIGHT; ++i) { e.texture.stagingBuffers[i] = d->stagingBuf[i]; @@ -2508,7 +2498,6 @@ bool QMetalTexture::build() d->tex.label = [NSString stringWithUTF8String: m_objectName.constData()]; d->owns = true; - nativeHandlesStruct.texture = d->tex; QRHI_PROF; QRHI_PROF_F(newTexture(this, true, mipLevelCount, isCube ? 6 : 1, samples)); @@ -2519,30 +2508,6 @@ bool QMetalTexture::build() return true; } -bool QMetalTexture::buildFrom(const QRhiNativeHandles *src) -{ - const QRhiMetalTextureNativeHandles *h = static_cast(src); - if (!h || !h->texture) - return false; - - if (!prepareBuild()) - return false; - - d->tex = (id) h->texture; - - d->owns = false; - nativeHandlesStruct.texture = d->tex; - - QRHI_PROF; - QRHI_PROF_F(newTexture(this, false, mipLevelCount, m_flags.testFlag(CubeMap) ? 6 : 1, samples)); - - lastActiveFrameSlot = -1; - generation += 1; - QRHI_RES_RHI(QRhiMetal); - rhiD->registerResource(this); - return true; -} - bool QMetalTexture::buildFrom(QRhiTexture::NativeTexture src) { void * const * tex = (void * const *) src.object; @@ -2555,7 +2520,6 @@ bool QMetalTexture::buildFrom(QRhiTexture::NativeTexture src) d->tex = (id) *tex; d->owns = false; - nativeHandlesStruct.texture = d->tex; QRHI_PROF; QRHI_PROF_F(newTexture(this, false, mipLevelCount, m_flags.testFlag(CubeMap) ? 6 : 1, samples)); @@ -2567,14 +2531,9 @@ bool QMetalTexture::buildFrom(QRhiTexture::NativeTexture src) return true; } -const QRhiNativeHandles *QMetalTexture::nativeHandles() -{ - return &nativeHandlesStruct; -} - QRhiTexture::NativeTexture QMetalTexture::nativeTexture() { - return {&nativeHandlesStruct.texture, 0}; + return {&d->tex, 0}; } id QMetalTextureData::viewForLevel(int level) diff --git a/src/gui/rhi/qrhimetal_p.h b/src/gui/rhi/qrhimetal_p.h index 094801c58c..17e28b2c0f 100644 --- a/src/gui/rhi/qrhimetal_p.h +++ b/src/gui/rhi/qrhimetal_p.h @@ -64,11 +64,6 @@ struct Q_GUI_EXPORT QRhiMetalNativeHandles : public QRhiNativeHandles void *cmdQueue = nullptr; // id }; -struct Q_GUI_EXPORT QRhiMetalTextureNativeHandles : public QRhiNativeHandles -{ - void *texture = nullptr; // id -}; - struct Q_GUI_EXPORT QRhiMetalCommandBufferNativeHandles : public QRhiNativeHandles { void *commandBuffer = nullptr; // id diff --git a/src/gui/rhi/qrhimetal_p_p.h b/src/gui/rhi/qrhimetal_p_p.h index 8e655fd98b..71d4325b1a 100644 --- a/src/gui/rhi/qrhimetal_p_p.h +++ b/src/gui/rhi/qrhimetal_p_p.h @@ -100,15 +100,12 @@ struct QMetalTexture : public QRhiTexture ~QMetalTexture(); void release() override; bool build() override; - bool buildFrom(const QRhiNativeHandles *src) override; bool buildFrom(NativeTexture src) override; - const QRhiNativeHandles *nativeHandles() override; NativeTexture nativeTexture() override; bool prepareBuild(QSize *adjustedSize = nullptr); QMetalTextureData *d; - QRhiMetalTextureNativeHandles nativeHandlesStruct; int mipLevelCount = 0; int samples = 1; uint generation = 0; diff --git a/src/gui/rhi/qrhinull.cpp b/src/gui/rhi/qrhinull.cpp index 80f004e049..ea67f80138 100644 --- a/src/gui/rhi/qrhinull.cpp +++ b/src/gui/rhi/qrhinull.cpp @@ -67,13 +67,6 @@ QT_BEGIN_NAMESPACE \brief Empty. */ -/*! - \class QRhiNullTextureNativeHandles - \internal - \inmodule QtGui - \brief Empty. - */ - QRhiNull::QRhiNull(QRhiNullInitParams *params) : offscreenCommandBuffer(this) { @@ -638,9 +631,9 @@ bool QNullTexture::build() return true; } -bool QNullTexture::buildFrom(const QRhiNativeHandles *src) +bool QNullTexture::buildFrom(QRhiTexture::NativeTexture src) { - Q_UNUSED(src); + Q_UNUSED(src) QRHI_RES_RHI(QRhiNull); const bool isCube = m_flags.testFlag(CubeMap); const bool hasMipMaps = m_flags.testFlag(MipMapped); @@ -651,17 +644,6 @@ bool QNullTexture::buildFrom(const QRhiNativeHandles *src) return true; } -bool QNullTexture::buildFrom(QRhiTexture::NativeTexture src) -{ - Q_UNUSED(src) - return buildFrom(nullptr); -} - -const QRhiNativeHandles *QNullTexture::nativeHandles() -{ - return &nativeHandlesStruct; -} - QNullSampler::QNullSampler(QRhiImplementation *rhi, Filter magFilter, Filter minFilter, Filter mipmapMode, AddressMode u, AddressMode v) : QRhiSampler(rhi, magFilter, minFilter, mipmapMode, u, v) diff --git a/src/gui/rhi/qrhinull_p.h b/src/gui/rhi/qrhinull_p.h index 7d3ce5dbf1..dbf385555d 100644 --- a/src/gui/rhi/qrhinull_p.h +++ b/src/gui/rhi/qrhinull_p.h @@ -60,10 +60,6 @@ struct Q_GUI_EXPORT QRhiNullNativeHandles : public QRhiNativeHandles { }; -struct Q_GUI_EXPORT QRhiNullTextureNativeHandles : public QRhiNativeHandles -{ -}; - QT_END_NAMESPACE #endif diff --git a/src/gui/rhi/qrhinull_p_p.h b/src/gui/rhi/qrhinull_p_p.h index 57c3de0418..f541fd90b8 100644 --- a/src/gui/rhi/qrhinull_p_p.h +++ b/src/gui/rhi/qrhinull_p_p.h @@ -80,11 +80,8 @@ struct QNullTexture : public QRhiTexture ~QNullTexture(); void release() override; bool build() override; - bool buildFrom(const QRhiNativeHandles *src) override; bool buildFrom(NativeTexture src) override; - const QRhiNativeHandles *nativeHandles() override; - QRhiNullTextureNativeHandles nativeHandlesStruct; QImage image[QRhi::MAX_LAYERS][QRhi::MAX_LEVELS]; }; diff --git a/src/gui/rhi/qrhivulkan.cpp b/src/gui/rhi/qrhivulkan.cpp index c540e9fa85..c5719b54aa 100644 --- a/src/gui/rhi/qrhivulkan.cpp +++ b/src/gui/rhi/qrhivulkan.cpp @@ -176,21 +176,6 @@ QT_BEGIN_NAMESPACE \note Ownership of the Vulkan objects is never transferred. */ -/*! - \class QRhiVulkanTextureNativeHandles - \internal - \inmodule QtGui - \brief Holds the Vulkan image object that is backing a QRhiTexture. - - Importing and exporting Vulkan image objects that back a QRhiTexture when - running with the Vulkan backend is supported via this class. Ownership of - the Vulkan object is never transferred. - - \note Memory allocation details are not exposed. This is intentional since - memory is typically suballocated from a bigger chunk of VkDeviceMemory, and - exposing the allocator details is not desirable for now. - */ - /*! \class QRhiVulkanCommandBufferNativeHandles \internal @@ -5198,7 +5183,6 @@ void QVkTexture::release() image = VK_NULL_HANDLE; imageView = VK_NULL_HANDLE; imageAlloc = nullptr; - nativeHandlesStruct.image = VK_NULL_HANDLE; QRHI_RES_RHI(QRhiVulkan); rhiD->releaseQueue.append(e); @@ -5283,8 +5267,6 @@ bool QVkTexture::finishBuild() return false; } - nativeHandlesStruct.image = image; - lastActiveFrameSlot = -1; generation += 1; @@ -5356,31 +5338,6 @@ bool QVkTexture::build() return true; } -bool QVkTexture::buildFrom(const QRhiNativeHandles *src) -{ - const QRhiVulkanTextureNativeHandles *h = static_cast(src); - if (!h || !h->image) - return false; - - if (!prepareBuild()) - return false; - - image = h->image; - - if (!finishBuild()) - return false; - - QRHI_PROF; - QRHI_PROF_F(newTexture(this, false, int(mipLevelCount), m_flags.testFlag(CubeMap) ? 6 : 1, samples)); - - usageState.layout = h->layout; - - owns = false; - QRHI_RES_RHI(QRhiVulkan); - rhiD->registerResource(this); - return true; -} - bool QVkTexture::buildFrom(QRhiTexture::NativeTexture src) { auto *img = static_cast(src.object); @@ -5406,15 +5363,9 @@ bool QVkTexture::buildFrom(QRhiTexture::NativeTexture src) return true; } -const QRhiNativeHandles *QVkTexture::nativeHandles() -{ - nativeHandlesStruct.layout = usageState.layout; - return &nativeHandlesStruct; -} - QRhiTexture::NativeTexture QVkTexture::nativeTexture() { - return {&nativeHandlesStruct.image, usageState.layout}; + return {&image, usageState.layout}; } VkImageView QVkTexture::imageViewForLevel(int level) diff --git a/src/gui/rhi/qrhivulkan_p.h b/src/gui/rhi/qrhivulkan_p.h index ff19c7a54e..d495919671 100644 --- a/src/gui/rhi/qrhivulkan_p.h +++ b/src/gui/rhi/qrhivulkan_p.h @@ -69,12 +69,6 @@ struct Q_GUI_EXPORT QRhiVulkanNativeHandles : public QRhiNativeHandles void *vmemAllocator = nullptr; }; -struct Q_GUI_EXPORT QRhiVulkanTextureNativeHandles : public QRhiNativeHandles -{ - VkImage image = VK_NULL_HANDLE; - VkImageLayout layout = VK_IMAGE_LAYOUT_GENERAL; -}; - struct Q_GUI_EXPORT QRhiVulkanCommandBufferNativeHandles : public QRhiNativeHandles { VkCommandBuffer commandBuffer = VK_NULL_HANDLE; diff --git a/src/gui/rhi/qrhivulkan_p_p.h b/src/gui/rhi/qrhivulkan_p_p.h index d1b77870a1..9f18d0bf5e 100644 --- a/src/gui/rhi/qrhivulkan_p_p.h +++ b/src/gui/rhi/qrhivulkan_p_p.h @@ -120,9 +120,7 @@ struct QVkTexture : public QRhiTexture ~QVkTexture(); void release() override; bool build() override; - bool buildFrom(const QRhiNativeHandles *src) override; bool buildFrom(NativeTexture src) override; - const QRhiNativeHandles *nativeHandles() override; NativeTexture nativeTexture() override; bool prepareBuild(QSize *adjustedSize = nullptr); @@ -136,7 +134,6 @@ struct QVkTexture : public QRhiTexture QVkAlloc stagingAllocations[QVK_FRAMES_IN_FLIGHT]; VkImageView perLevelImageViews[QRhi::MAX_LEVELS]; bool owns = true; - QRhiVulkanTextureNativeHandles nativeHandlesStruct; struct UsageState { // no tracking of subresource layouts (some operations can keep // subresources in different layouts for some time, but that does not -- cgit v1.2.3 From 82d02b7b95908dec16e41c5af1c63579729c589b Mon Sep 17 00:00:00 2001 From: Sona Kurazyan Date: Thu, 7 Nov 2019 17:26:55 +0100 Subject: Deprecate SAX classes in Qt XML Deprecated the SAX classes and disabled or replaced their uses in tests if applicable. Removed the saxbookmarks example, no point in keeping examples for the deprecated code. [ChangeLog][QtXml] SAX classes are now deprecated. Use QXmlStreamReader, QXmlStreamWriter in QtCore instead. Task-number: QTBUG-76177 Change-Id: Ic171d62fa0527b0f36f94cf09a69586092269957 Reviewed-by: Friedemann Kleint Reviewed-by: Paul Wicking Reviewed-by: Kai Koehne --- src/xml/dom/qdom.cpp | 37 ++++++++++++++++++++++-- src/xml/dom/qdom.h | 12 ++++++++ src/xml/dom/qdom_p.h | 5 ++++ src/xml/dom/qdomhelpers.cpp | 22 +++++++++++++- src/xml/dom/qdomhelpers_p.h | 23 +++++++++++++++ src/xml/sax/qxml.cpp | 38 ++++++++++++++++++++++++ src/xml/sax/qxml.h | 70 ++++++++++++++++++++++++++++++++++----------- src/xml/sax/qxml_p.h | 9 ++++++ 8 files changed, 196 insertions(+), 20 deletions(-) (limited to 'src') diff --git a/src/xml/dom/qdom.cpp b/src/xml/dom/qdom.cpp index cb753ed573..bbc877eead 100644 --- a/src/xml/dom/qdom.cpp +++ b/src/xml/dom/qdom.cpp @@ -5691,6 +5691,10 @@ void QDomDocumentPrivate::clear() QDomNodePrivate::clear(); } +#if QT_DEPRECATED_SINCE(5, 15) + +QT_WARNING_PUSH +QT_WARNING_DISABLE_DEPRECATED static void initializeReader(QXmlSimpleReader &reader, bool namespaceProcessing) { reader.setFeature(QLatin1String("http://xml.org/sax/features/namespaces"), namespaceProcessing); @@ -5734,6 +5738,9 @@ bool QDomDocumentPrivate::setContent(QXmlInputSource *source, QXmlReader *reader return true; } +QT_WARNING_POP + +#endif // QT_DEPRECATED_SINCE(5, 15) bool QDomDocumentPrivate::setContent(QXmlStreamReader *reader, bool namespaceProcessing, QString *errorMsg, int *errorLine, int *errorColumn) @@ -6183,8 +6190,11 @@ bool QDomDocument::setContent(const QString& text, bool namespaceProcessing, QSt if (!impl) impl = new QDomDocumentPrivate(); -#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) +#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) && QT_DEPRECATED_SINCE(5, 15) +QT_WARNING_PUSH +QT_WARNING_DISABLE_DEPRECATED QXmlInputSource source; +QT_WARNING_POP source.setData(text); return IMPL->setContent(&source, namespaceProcessing, errorMsg, errorLine, errorColumn); #else @@ -6252,10 +6262,13 @@ bool QDomDocument::setContent(const QByteArray &data, bool namespaceProcessing, if (!impl) impl = new QDomDocumentPrivate(); -#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) +#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) && QT_DEPRECATED_SINCE(5, 15) QBuffer buf; buf.setData(data); +QT_WARNING_PUSH +QT_WARNING_DISABLE_DEPRECATED QXmlInputSource source(&buf); +QT_WARNING_POP return IMPL->setContent(&source, namespaceProcessing, errorMsg, errorLine, errorColumn); #else QXmlStreamReader streamReader(data); @@ -6275,8 +6288,11 @@ bool QDomDocument::setContent(QIODevice* dev, bool namespaceProcessing, QString if (!impl) impl = new QDomDocumentPrivate(); -#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) +#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) && QT_DEPRECATED_SINCE(5, 15) +QT_WARNING_PUSH +QT_WARNING_DISABLE_DEPRECATED QXmlInputSource source(dev); +QT_WARNING_POP return IMPL->setContent(&source, namespaceProcessing, errorMsg, errorLine, errorColumn); #else QXmlStreamReader streamReader(dev); @@ -6285,14 +6301,18 @@ bool QDomDocument::setContent(QIODevice* dev, bool namespaceProcessing, QString #endif } +#if QT_DEPRECATED_SINCE(5, 15) /*! \overload + \obsolete \since 4.5 This function reads the XML document from the QXmlInputSource \a source, returning true if the content was successfully parsed; otherwise returns \c false. */ +QT_WARNING_PUSH +QT_WARNING_DISABLE_DEPRECATED bool QDomDocument::setContent(QXmlInputSource *source, bool namespaceProcessing, QString *errorMsg, int *errorLine, int *errorColumn ) { if (!impl) @@ -6301,6 +6321,9 @@ bool QDomDocument::setContent(QXmlInputSource *source, bool namespaceProcessing, initializeReader(reader, namespaceProcessing); return IMPL->setContent(source, &reader, &reader, errorMsg, errorLine, errorColumn); } +QT_WARNING_POP + +#endif /*! \overload @@ -6333,6 +6356,7 @@ bool QDomDocument::setContent(const QByteArray& buffer, QString *errorMsg, int * /*! \overload + \obsolete This function reads the XML document from the IO device \a dev, returning true if the content was successfully parsed; otherwise returns \c false. @@ -6344,8 +6368,10 @@ bool QDomDocument::setContent(QIODevice* dev, QString *errorMsg, int *errorLine, return setContent(dev, false, errorMsg, errorLine, errorColumn); } +#if QT_DEPRECATED_SINCE(5, 15) /*! \overload + \obsolete This function reads the XML document from the QXmlInputSource \a source and parses it with the QXmlReader \a reader, returning true if the content was @@ -6357,12 +6383,17 @@ bool QDomDocument::setContent(QIODevice* dev, QString *errorMsg, int *errorLine, \sa QXmlSimpleReader */ +QT_WARNING_PUSH +QT_WARNING_DISABLE_DEPRECATED bool QDomDocument::setContent(QXmlInputSource *source, QXmlReader *reader, QString *errorMsg, int *errorLine, int *errorColumn ) { if (!impl) impl = new QDomDocumentPrivate(); return IMPL->setContent(source, reader, nullptr, errorMsg, errorLine, errorColumn); } +QT_WARNING_POP + +#endif /*! \overload diff --git a/src/xml/dom/qdom.h b/src/xml/dom/qdom.h index 1b00a14179..d50c5e8394 100644 --- a/src/xml/dom/qdom.h +++ b/src/xml/dom/qdom.h @@ -339,11 +339,23 @@ public: bool setContent(const QByteArray& text, bool namespaceProcessing, QString *errorMsg=nullptr, int *errorLine=nullptr, int *errorColumn=nullptr ); bool setContent(const QString& text, bool namespaceProcessing, QString *errorMsg=nullptr, int *errorLine=nullptr, int *errorColumn=nullptr ); bool setContent(QIODevice* dev, bool namespaceProcessing, QString *errorMsg=nullptr, int *errorLine=nullptr, int *errorColumn=nullptr ); +#if QT_DEPRECATED_SINCE(5, 15) +QT_WARNING_PUSH +QT_WARNING_DISABLE_DEPRECATED + QT_DEPRECATED_X("Use other overloads instead") bool setContent(QXmlInputSource *source, bool namespaceProcessing, QString *errorMsg=nullptr, int *errorLine=nullptr, int *errorColumn=nullptr ); +QT_WARNING_POP +#endif bool setContent(const QByteArray& text, QString *errorMsg=nullptr, int *errorLine=nullptr, int *errorColumn=nullptr ); bool setContent(const QString& text, QString *errorMsg=nullptr, int *errorLine=nullptr, int *errorColumn=nullptr ); bool setContent(QIODevice* dev, QString *errorMsg=nullptr, int *errorLine=nullptr, int *errorColumn=nullptr ); +#if QT_DEPRECATED_SINCE(5, 15) +QT_WARNING_PUSH +QT_WARNING_DISABLE_DEPRECATED + QT_DEPRECATED_X("Use other overloads instead") bool setContent(QXmlInputSource *source, QXmlReader *reader, QString *errorMsg=nullptr, int *errorLine=nullptr, int *errorColumn=nullptr ); +QT_WARNING_POP +#endif bool setContent(QXmlStreamReader *reader, bool namespaceProcessing, QString *errorMsg = nullptr, int *errorLine = nullptr, int *errorColumn = nullptr); diff --git a/src/xml/dom/qdom_p.h b/src/xml/dom/qdom_p.h index b66c756af0..a9399d9901 100644 --- a/src/xml/dom/qdom_p.h +++ b/src/xml/dom/qdom_p.h @@ -461,10 +461,15 @@ public: QDomDocumentPrivate(QDomDocumentPrivate *n, bool deep); ~QDomDocumentPrivate(); +#if QT_DEPRECATED_SINCE(5, 15) +QT_WARNING_PUSH +QT_WARNING_DISABLE_DEPRECATED bool setContent(QXmlInputSource *source, bool namespaceProcessing, QString *errorMsg, int *errorLine, int *errorColumn); bool setContent(QXmlInputSource *source, QXmlReader *reader, QXmlSimpleReader *simpleReader, QString *errorMsg, int *errorLine, int *errorColumn); +QT_WARNING_POP +#endif bool setContent(QXmlStreamReader *reader, bool namespaceProcessing, QString *errorMsg, int *errorLine, int *errorColumn); diff --git a/src/xml/dom/qdomhelpers.cpp b/src/xml/dom/qdomhelpers.cpp index 9399ad3b9b..10e37f7c0f 100644 --- a/src/xml/dom/qdomhelpers.cpp +++ b/src/xml/dom/qdomhelpers.cpp @@ -44,12 +44,15 @@ QT_BEGIN_NAMESPACE +#if QT_DEPRECATED_SINCE(5, 15) + /************************************************************** * * QDomHandler * **************************************************************/ - +QT_WARNING_PUSH +QT_WARNING_DISABLE_DEPRECATED QDomHandler::QDomHandler(QDomDocumentPrivate *adoc, QXmlSimpleReader *areader, bool namespaceProcessing) : cdata(false), reader(areader), domBuilder(adoc, &locator, namespaceProcessing) @@ -160,6 +163,9 @@ QDomBuilder::ErrorInfo QDomHandler::errorInfo() const { return domBuilder.error(); } +QT_WARNING_POP + +#endif // QT_DEPRECATED_SINCE(5, 15) /************************************************************** * @@ -179,10 +185,15 @@ int QDomDocumentLocator::line() const return static_cast(reader->lineNumber()); } +#if QT_DEPRECATED_SINCE(5, 15) + +QT_WARNING_PUSH +QT_WARNING_DISABLE_DEPRECATED void QSAXDocumentLocator::setLocator(QXmlLocator *l) { locator = l; } +QT_WARNING_POP int QSAXDocumentLocator::column() const { @@ -200,6 +211,8 @@ int QSAXDocumentLocator::line() const return static_cast(locator->lineNumber()); } +#endif // QT_DEPRECATED_SINCE(5, 15) + /************************************************************** * * QDomBuilder @@ -234,6 +247,10 @@ bool QDomBuilder::startDTD(const QString &name, const QString &publicId, const Q return true; } +#if QT_DEPRECATED_SINCE(5, 15) + +QT_WARNING_PUSH +QT_WARNING_DISABLE_DEPRECATED bool QDomBuilder::startElement(const QString &nsURI, const QString &qName, const QXmlAttributes &atts) { @@ -264,6 +281,9 @@ bool QDomBuilder::startElement(const QString &nsURI, const QString &qName, return true; } +QT_WARNING_POP + +#endif // QT_DEPRECATED_SINCE(5, 15) inline QString stringRefToString(const QStringRef &stringRef) { diff --git a/src/xml/dom/qdomhelpers_p.h b/src/xml/dom/qdomhelpers_p.h index f5efd8a42d..4de18f7d4d 100644 --- a/src/xml/dom/qdomhelpers_p.h +++ b/src/xml/dom/qdomhelpers_p.h @@ -93,6 +93,11 @@ private: QXmlStreamReader *reader; }; +#if QT_DEPRECATED_SINCE(5, 15) + +QT_WARNING_PUSH +QT_WARNING_DISABLE_DEPRECATED + class QSAXDocumentLocator : public QXmlDocumentLocator { public: @@ -107,6 +112,10 @@ private: QXmlLocator *locator = nullptr; }; +QT_WARNING_POP + +#endif + /************************************************************** * * QDomBuilder @@ -120,7 +129,12 @@ public: ~QDomBuilder(); bool endDocument(); +#if QT_DEPRECATED_SINCE(5, 15) +QT_WARNING_PUSH +QT_WARNING_DISABLE_DEPRECATED bool startElement(const QString &nsURI, const QString &qName, const QXmlAttributes &atts); +QT_WARNING_POP +#endif bool startElement(const QString &nsURI, const QString &qName, const QXmlStreamAttributes &atts); bool endElement(); bool characters(const QString &characters, bool cdata = false); @@ -152,12 +166,17 @@ private: bool nsProcessing; }; +#if QT_DEPRECATED_SINCE(5, 15) + /************************************************************** * * QDomHandler * **************************************************************/ +QT_WARNING_PUSH +QT_WARNING_DISABLE_DEPRECATED + class QDomHandler : public QXmlDefaultHandler { public: @@ -205,6 +224,10 @@ private: QDomBuilder domBuilder; }; +QT_WARNING_POP + +#endif // QT_DEPRECATED_SINCE(5, 15) + /************************************************************** * * QDomParser diff --git a/src/xml/sax/qxml.cpp b/src/xml/sax/qxml.cpp index 1993073cce..0033d042d4 100644 --- a/src/xml/sax/qxml.cpp +++ b/src/xml/sax/qxml.cpp @@ -51,6 +51,7 @@ #include "qstack.h" #include +#if QT_DEPRECATED_SINCE(5, 15) #ifdef Q_CC_BOR // borland 6 finds bogus warnings when building this file in uic3 # pragma warn -8080 @@ -284,6 +285,7 @@ class QXmlDefaultHandlerPrivate /*! \class QXmlParseException + \obsolete \reentrant \brief The QXmlParseException class is used to report errors with the QXmlErrorHandler interface. @@ -403,6 +405,7 @@ QString QXmlParseException::systemId() const /*! \class QXmlLocator + \obsolete \reentrant \brief The QXmlLocator class provides the XML handler classes with information about the parsing position within a file. @@ -445,6 +448,9 @@ QXmlLocator::~QXmlLocator() number available. */ +QT_WARNING_PUSH +QT_WARNING_DISABLE_DEPRECATED + class QXmlSimpleReaderLocator : public QXmlLocator { public: @@ -497,6 +503,7 @@ public: /*! \class QXmlNamespaceSupport + \obsolete \since 4.4 \reentrant \brief The QXmlNamespaceSupport class is a helper class for XML @@ -745,6 +752,7 @@ void QXmlNamespaceSupport::reset() /*! \class QXmlAttributes + \obsolete \reentrant \brief The QXmlAttributes class provides XML attributes. @@ -1028,6 +1036,7 @@ void QXmlAttributes::append(const QString &qName, const QString &uri, const QStr /*! \class QXmlInputSource + \obsolete \reentrant \brief The QXmlInputSource class provides the input data for the QXmlReader subclasses. @@ -1446,6 +1455,7 @@ QString QXmlInputSource::fromRawData(const QByteArray &data, bool beginning) /*! \class QXmlContentHandler + \obsolete \reentrant \brief The QXmlContentHandler class provides an interface to report the logical content of XML data. @@ -1688,6 +1698,7 @@ QString QXmlInputSource::fromRawData(const QByteArray &data, bool beginning) /*! \class QXmlErrorHandler + \obsolete \reentrant \brief The QXmlErrorHandler class provides an interface to report errors in XML data. @@ -1763,6 +1774,7 @@ events are reported. /*! \class QXmlDTDHandler + \obsolete \reentrant \brief The QXmlDTDHandler class provides an interface to report DTD content of XML data. @@ -1830,6 +1842,7 @@ events are reported. /*! \class QXmlEntityResolver + \obsolete \reentrant \brief The QXmlEntityResolver class provides an interface to resolve external entities contained in XML data. @@ -1886,6 +1899,7 @@ events are reported. /*! \class QXmlLexicalHandler + \obsolete \reentrant \brief The QXmlLexicalHandler class provides an interface to report the lexical content of XML data. @@ -2037,6 +2051,7 @@ events are reported. /*! \class QXmlDeclHandler + \obsolete \reentrant \brief The QXmlDeclHandler class provides an interface to report declaration content of XML data. @@ -2124,6 +2139,7 @@ events are reported. /*! \class QXmlDefaultHandler + \obsolete \reentrant \brief The QXmlDefaultHandler class provides a default implementation of all the XML handler classes. @@ -2558,6 +2574,7 @@ void QXmlSimpleReaderPrivate::initIncrementalParsing() /*! \class QXmlReader + \obsolete \reentrant \brief The QXmlReader class provides an interface for XML readers (i.e. parsers). @@ -2597,6 +2614,9 @@ void QXmlSimpleReaderPrivate::initIncrementalParsing() setDeclHandler(). The parse itself is started with a call to parse(). + Note that this class is now deprecated, please use QXmlStreamReader or + QDomDocument for reading XML files. + \sa QXmlSimpleReader */ @@ -2783,6 +2803,7 @@ void QXmlSimpleReaderPrivate::initIncrementalParsing() /*! \class QXmlSimpleReader + \obsolete \nonreentrant \brief The QXmlSimpleReader class provides an implementation of a simple XML parser. @@ -2845,6 +2866,9 @@ void QXmlSimpleReaderPrivate::initIncrementalParsing() QXmlSimpleReader is not reentrant. If you want to use the class in threaded code, lock the code using QXmlSimpleReader with a locking mechanism, such as a QMutex. + + Note that this class is now deprecated, please use QXmlStreamReader or + QDomDocument for reading XML files. */ static inline bool is_S(QChar ch) @@ -5255,7 +5279,10 @@ bool QXmlSimpleReaderPrivate::parsePEReference() } else if (entityRes) { QMap::Iterator it2; it2 = externParameterEntities.find(ref()); +QT_WARNING_PUSH +QT_WARNING_DISABLE_DEPRECATED QXmlInputSource *ret = nullptr; +QT_WARNING_POP if (it2 != externParameterEntities.end()) { if (!entityRes->resolveEntity((*it2).publicId, (*it2).systemId, ret)) { delete ret; @@ -7610,7 +7637,10 @@ bool QXmlSimpleReaderPrivate::processReference() // Included if validating bool skipIt = true; if (entityRes) { +QT_WARNING_PUSH +QT_WARNING_DISABLE_DEPRECATED QXmlInputSource *ret = nullptr; +QT_WARNING_POP if (!entityRes->resolveEntity((*itExtern).publicId, (*itExtern).systemId, ret)) { delete ret; reportParseError(entityRes->errorString()); @@ -7850,6 +7880,8 @@ bool QXmlSimpleReaderPrivate::next_eat_ws() This private function initializes the reader. \a i is the input source to read the data from. */ +QT_WARNING_PUSH +QT_WARNING_DISABLE_DEPRECATED void QXmlSimpleReaderPrivate::init(const QXmlInputSource *i) { lineNr = 0; @@ -7870,6 +7902,7 @@ void QXmlSimpleReaderPrivate::init(const QXmlInputSource *i) standalone = QXmlSimpleReaderPrivate::Unknown; error.clear(); } +QT_WARNING_POP /* This private function initializes the XML data related variables. Especially, @@ -7898,6 +7931,8 @@ bool QXmlSimpleReaderPrivate::entityExist(const QString& e) const } } +QT_WARNING_PUSH +QT_WARNING_DISABLE_DEPRECATED void QXmlSimpleReaderPrivate::reportParseError(const QString& error) { this->error = error; @@ -7913,6 +7948,7 @@ void QXmlSimpleReaderPrivate::reportParseError(const QString& error) } } } +QT_WARNING_POP /* This private function is called when a parsing function encounters an @@ -8006,3 +8042,5 @@ void QXmlSimpleReaderPrivate::refAddC(QChar ch) refArray[refArrayPos++] = ch; } QT_END_NAMESPACE + +#endif // QT_DEPRECATED_SINCE(5, 15) diff --git a/src/xml/sax/qxml.h b/src/xml/sax/qxml.h index 9be14bd7a9..e19a398ca7 100644 --- a/src/xml/sax/qxml.h +++ b/src/xml/sax/qxml.h @@ -40,6 +40,26 @@ #ifndef QXML_H #define QXML_H +#if 0 +// This is needed because of QTBUG-80347 +#pragma qt_class(QXmlNamespaceSupport) +#pragma qt_class(QXmlAttributes) +#pragma qt_class(QXmlInputSource) +#pragma qt_class(QXmlParseException) +#pragma qt_class(QXmlReader) +#pragma qt_class(QXmlSimpleReader) +#pragma qt_class(QXmlLocator) +#pragma qt_class(QXmlContentHandler) +#pragma qt_class(QXmlErrorHandler) +#pragma qt_class(QXmlDTDHandler) +#pragma qt_class(QXmlEntityResolver) +#pragma qt_class(QXmlLexicalHandler) +#pragma qt_class(QXmlDeclHandler) +#pragma qt_class(QXmlDefaultHandler) +#endif + +#include + #include #include #include @@ -48,8 +68,12 @@ #include #include +#if QT_DEPRECATED_SINCE(5, 15) + QT_BEGIN_NAMESPACE +QT_WARNING_PUSH +QT_WARNING_DISABLE_DEPRECATED class QXmlNamespaceSupport; class QXmlAttributes; @@ -76,12 +100,11 @@ class QXmlParseExceptionPrivate; class QXmlLocatorPrivate; class QXmlDefaultHandlerPrivate; - // // SAX Namespace Support // -class Q_XML_EXPORT QXmlNamespaceSupport +class QT_DEPRECATED_VERSION(5, 15) Q_XML_EXPORT QXmlNamespaceSupport { public: QXmlNamespaceSupport(); @@ -112,10 +135,15 @@ private: // SAX Attributes // +// Although deprecated warnings are disabled, the intel icc 18 compiler +// still complains during the instantiation of the templated qSwap() call below +// (with the parameter QXmlAttributes::AttributeList) when QXmlAttributes is +// deprecated. This makes the build fail when warnings are treated as errors. +// To workaround this, deprecated only the constructor. class Q_XML_EXPORT QXmlAttributes { public: - QXmlAttributes(); + QT_DEPRECATED_VERSION(5, 15) QXmlAttributes(); QXmlAttributes(const QXmlAttributes &) = default; QXmlAttributes(QXmlAttributes &&) noexcept = default; QXmlAttributes &operator=(const QXmlAttributes &) = default; @@ -158,6 +186,7 @@ private: QXmlAttributesPrivate *d; }; + Q_DECLARE_TYPEINFO(QXmlAttributes::Attribute, Q_MOVABLE_TYPE); Q_DECLARE_SHARED_NOT_MOVABLE_UNTIL_QT6(QXmlAttributes) @@ -165,7 +194,7 @@ Q_DECLARE_SHARED_NOT_MOVABLE_UNTIL_QT6(QXmlAttributes) // SAX Input Source // -class Q_XML_EXPORT QXmlInputSource +class QT_DEPRECATED_VERSION(5, 15) Q_XML_EXPORT QXmlInputSource { public: QXmlInputSource(); @@ -194,7 +223,7 @@ private: // SAX Exception Classes // -class Q_XML_EXPORT QXmlParseException +class QT_DEPRECATED_VERSION(5, 15) Q_XML_EXPORT QXmlParseException { public: explicit QXmlParseException(const QString &name = QString(), int c = -1, int l = -1, @@ -217,7 +246,7 @@ private: // XML Reader // -class Q_XML_EXPORT QXmlReader +class QT_DEPRECATED_VERSION_X(5, 15, "Use QXmlStreamReader") Q_XML_EXPORT QXmlReader { public: virtual ~QXmlReader() {} @@ -243,7 +272,8 @@ public: virtual bool parse(const QXmlInputSource* input) = 0; }; -class Q_XML_EXPORT QXmlSimpleReader : public QXmlReader +class QT_DEPRECATED_VERSION_X(5, 15, "Use QXmlStreamReader") Q_XML_EXPORT QXmlSimpleReader + : public QXmlReader { public: QXmlSimpleReader(); @@ -288,7 +318,7 @@ private: // SAX Locator // -class Q_XML_EXPORT QXmlLocator +class QT_DEPRECATED_VERSION(5, 15) Q_XML_EXPORT QXmlLocator { public: QXmlLocator(); @@ -304,7 +334,7 @@ public: // SAX handler classes // -class Q_XML_EXPORT QXmlContentHandler +class QT_DEPRECATED_VERSION(5, 15) Q_XML_EXPORT QXmlContentHandler { public: virtual ~QXmlContentHandler() {} @@ -322,7 +352,7 @@ public: virtual QString errorString() const = 0; }; -class Q_XML_EXPORT QXmlErrorHandler +class QT_DEPRECATED_VERSION(5, 15) Q_XML_EXPORT QXmlErrorHandler { public: virtual ~QXmlErrorHandler() {} @@ -332,7 +362,7 @@ public: virtual QString errorString() const = 0; }; -class Q_XML_EXPORT QXmlDTDHandler +class QT_DEPRECATED_VERSION(5, 15) Q_XML_EXPORT QXmlDTDHandler { public: virtual ~QXmlDTDHandler() {} @@ -341,7 +371,7 @@ public: virtual QString errorString() const = 0; }; -class Q_XML_EXPORT QXmlEntityResolver +class QT_DEPRECATED_VERSION(5, 15) Q_XML_EXPORT QXmlEntityResolver { public: virtual ~QXmlEntityResolver() {} @@ -349,7 +379,7 @@ public: virtual QString errorString() const = 0; }; -class Q_XML_EXPORT QXmlLexicalHandler +class QT_DEPRECATED_VERSION(5, 15) Q_XML_EXPORT QXmlLexicalHandler { public: virtual ~QXmlLexicalHandler() {} @@ -363,7 +393,7 @@ public: virtual QString errorString() const = 0; }; -class Q_XML_EXPORT QXmlDeclHandler +class QT_DEPRECATED_VERSION(5, 15) Q_XML_EXPORT QXmlDeclHandler { public: virtual ~QXmlDeclHandler() {} @@ -374,8 +404,12 @@ public: // ### Conform to SAX by adding elementDecl }; - -class Q_XML_EXPORT QXmlDefaultHandler : public QXmlContentHandler, public QXmlErrorHandler, public QXmlDTDHandler, public QXmlEntityResolver, public QXmlLexicalHandler, public QXmlDeclHandler +class QT_DEPRECATED_VERSION(5, 15) Q_XML_EXPORT QXmlDefaultHandler : public QXmlContentHandler, + public QXmlErrorHandler, + public QXmlDTDHandler, + public QXmlEntityResolver, + public QXmlLexicalHandler, + public QXmlDeclHandler { public: QXmlDefaultHandler(); @@ -426,6 +460,10 @@ private: inline int QXmlAttributes::count() const { return length(); } +QT_WARNING_POP + QT_END_NAMESPACE +#endif // QT_DEPRECATED_SINCE(5, 15) + #endif // QXML_H diff --git a/src/xml/sax/qxml_p.h b/src/xml/sax/qxml_p.h index eb6135db04..1b614dd886 100644 --- a/src/xml/sax/qxml_p.h +++ b/src/xml/sax/qxml_p.h @@ -46,6 +46,8 @@ #include +#if QT_DEPRECATED_SINCE(5, 15) + QT_BEGIN_NAMESPACE // @@ -59,6 +61,9 @@ QT_BEGIN_NAMESPACE // We mean it. // +QT_WARNING_PUSH +QT_WARNING_DISABLE_DEPRECATED + class QXmlSimpleReaderPrivate { public: @@ -313,6 +318,10 @@ Q_DECLARE_TYPEINFO(QXmlSimpleReaderPrivate::XmlRef, Q_MOVABLE_TYPE); Q_DECLARE_TYPEINFO(QXmlSimpleReaderPrivate::ExternParameterEntity, Q_MOVABLE_TYPE); Q_DECLARE_TYPEINFO(QXmlSimpleReaderPrivate::ExternEntity, Q_MOVABLE_TYPE); +QT_WARNING_POP + QT_END_NAMESPACE +#endif // QT_DEPRECATED_SINCE(5, 15) + #endif // QXML_P_H -- cgit v1.2.3 From bd4a1b98b813dfbbb4a9db35a380bed8dd5f0ce3 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Mon, 6 Jan 2020 10:50:33 +0100 Subject: eglfs: kms: Query the current mode correctly via the encoder ...not the connector. Passing the connector id to drmModeGetEncoder() is clearly an oversight. Task-number: QTBUG-80976 Change-Id: I80a6088fca558d1637bd01b0aca8c4a8ba3b25f5 Reviewed-by: Eirik Aavitsland --- src/platformsupport/kmsconvenience/qkmsdevice.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/platformsupport/kmsconvenience/qkmsdevice.cpp b/src/platformsupport/kmsconvenience/qkmsdevice.cpp index b820fafd50..18f7b5e23b 100644 --- a/src/platformsupport/kmsconvenience/qkmsdevice.cpp +++ b/src/platformsupport/kmsconvenience/qkmsdevice.cpp @@ -262,7 +262,7 @@ QPlatformScreen *QKmsDevice::createScreenForConnector(drmModeResPtr resources, // Get the current mode on the current crtc drmModeModeInfo crtc_mode; memset(&crtc_mode, 0, sizeof crtc_mode); - if (drmModeEncoderPtr encoder = drmModeGetEncoder(m_dri_fd, connector->connector_id)) { + if (drmModeEncoderPtr encoder = drmModeGetEncoder(m_dri_fd, connector->encoder_id)) { drmModeCrtcPtr crtc = drmModeGetCrtc(m_dri_fd, encoder->crtc_id); drmModeFreeEncoder(encoder); -- cgit v1.2.3