From a1f4321bbba2f3bff24d753ce766be738dbfa61a Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Tue, 3 Dec 2019 15:12:51 +0100 Subject: [PATCH 01/29] 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 - .../text/qtextdocument/tst_qtextdocument.cpp | 21 ++++++++++ 3 files changed, 35 insertions(+), 26 deletions(-) diff --git a/src/gui/text/qtextdocument.cpp b/src/gui/text/qtextdocument.cpp index 4b35509ace6..25c153910d2 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 f4e7a25f225..40252c93ebd 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); diff --git a/tests/auto/gui/text/qtextdocument/tst_qtextdocument.cpp b/tests/auto/gui/text/qtextdocument/tst_qtextdocument.cpp index 33d4976b2a8..e075c107b73 100644 --- a/tests/auto/gui/text/qtextdocument/tst_qtextdocument.cpp +++ b/tests/auto/gui/text/qtextdocument/tst_qtextdocument.cpp @@ -194,6 +194,8 @@ private slots: void fontTagFace(); void clearUndoRedoStacks(); + void mergeFontFamilies(); + private: void backgroundImage_checkExpectedHtml(const QTextDocument &doc); void buildRegExpData(); @@ -3579,6 +3581,25 @@ void tst_QTextDocument::fontTagFace() } } +void tst_QTextDocument::mergeFontFamilies() +{ + QTextDocument td; + td.setHtml(QLatin1String( + "" + "Hello world" + "")); + + QTextCharFormat newFormat; + newFormat.setFontFamily(QLatin1String("Jokerman")); + + QTextCursor cursor = QTextCursor(&td); + cursor.setPosition(0); + cursor.setPosition(QByteArray("Hello World").length(), QTextCursor::KeepAnchor); + cursor.mergeCharFormat(newFormat); + + QVERIFY(td.toHtml().contains(QLatin1String("font-family:'Jokerman','MS Shell Dlg 2';"))); +} + void tst_QTextDocument::clearUndoRedoStacks() { QTextDocument doc; 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: [PATCH 02/29] 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(-) diff --git a/src/plugins/platforms/cocoa/qcocoaintegration.mm b/src/plugins/platforms/cocoa/qcocoaintegration.mm index d8c931e9a17..b7f15a2bf12 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; } From a6f56251ca6090cb0ba4c4989d7ccc638b1dbe2b Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Thu, 2 Jan 2020 12:24:15 +0100 Subject: [PATCH 03/29] 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(-) diff --git a/src/corelib/global/qfloat16.cpp b/src/corelib/global/qfloat16.cpp index 6c21b7de5a3..c868e879b7e 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 cf107498dd7..cc50d9ccc71 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 6c9d6f9d11f..dbcd71f1a01 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 a53d6db9975..6ec8019ba36 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 f9335c3bb97..9dbb1549149 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 1a2aa7afac5..b0d03037e6e 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 8ad67acce62..952fd3259d1 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 d532ad478d6..d40c84907c3 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 1d9213de0c0..d359703db34 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 eec65c86259..f157ba2943f 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 9189319364d..da4aaadc979 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() */ From 05e5306787d3511ce9df2ffc8dbefe529f889eb6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Fri, 21 Jun 2019 14:43:39 +0200 Subject: [PATCH 04/29] styles example: Implement standarPalette() Instead of polishing the (possible) system palette. Makes the checkbox for "Use style's standard palette" actually work for the custom style, and is how styles are supposed to provide their own preferred palette. Change-Id: I3228ef45c023d0d058e48ff0fc14f094367b2008 Reviewed-by: Timur Pocheptsov --- examples/widgets/doc/src/styles.qdoc | 10 +-- .../widgets/styles/norwegianwoodstyle.cpp | 64 ++++++++++--------- .../widgets/styles/norwegianwoodstyle.h | 4 +- 3 files changed, 41 insertions(+), 37 deletions(-) diff --git a/examples/widgets/doc/src/styles.qdoc b/examples/widgets/doc/src/styles.qdoc index a3a02768c66..7a7ae20e910 100644 --- a/examples/widgets/doc/src/styles.qdoc +++ b/examples/widgets/doc/src/styles.qdoc @@ -85,8 +85,8 @@ \snippet widgets/styles/norwegianwoodstyle.cpp 0 - The \c polish() function is reimplemented from QStyle. It takes a - QPalette as a reference and adapts the palette to fit the style. + The \c standardPalette() function is reimplemented from QStyle. + It returns a QPalette with the style's preferred colors and textures. Most styles don't need to reimplement that function. The Norwegian Wood style reimplements it to set a "wooden" palette. @@ -381,7 +381,7 @@ a certain \l{QPalette::ColorRole}{color role}, for all three \l{QPalette::ColorGroup}{color groups} (active, disabled, inactive). We used it to initialize the Norwegian Wood palette in - \c polish(QPalette &). + \c standardPalette. \snippet widgets/styles/norwegianwoodstyle.cpp 39 \snippet widgets/styles/norwegianwoodstyle.cpp 40 @@ -444,10 +444,6 @@ current style's \l{QStyle::standardPalette()}{standard palette} is used; otherwise, the system's default palette is honored. - For the Norwegian Wood style, this makes no difference because we - always override the palette with our own palette in \c - NorwegianWoodStyle::polish(). - \snippet widgets/styles/widgetgallery.cpp 9 \snippet widgets/styles/widgetgallery.cpp 10 diff --git a/examples/widgets/widgets/styles/norwegianwoodstyle.cpp b/examples/widgets/widgets/styles/norwegianwoodstyle.cpp index bbdb626a186..31150cd994e 100644 --- a/examples/widgets/widgets/styles/norwegianwoodstyle.cpp +++ b/examples/widgets/widgets/styles/norwegianwoodstyle.cpp @@ -62,42 +62,48 @@ NorwegianWoodStyle::NorwegianWoodStyle() : } //! [0] -void NorwegianWoodStyle::polish(QPalette &palette) +QPalette NorwegianWoodStyle::standardPalette() const { - QColor brown(212, 140, 95); - QColor beige(236, 182, 120); - QColor slightlyOpaqueBlack(0, 0, 0, 63); + if (!m_standardPalette.isBrushSet(QPalette::Disabled, QPalette::Mid)) { + QColor brown(212, 140, 95); + QColor beige(236, 182, 120); + QColor slightlyOpaqueBlack(0, 0, 0, 63); - QImage backgroundImage(":/images/woodbackground.png"); - QImage buttonImage(":/images/woodbutton.png"); - QImage midImage = buttonImage.convertToFormat(QImage::Format_RGB32); + QImage backgroundImage(":/images/woodbackground.png"); + QImage buttonImage(":/images/woodbutton.png"); + QImage midImage = buttonImage.convertToFormat(QImage::Format_RGB32); - QPainter painter; - painter.begin(&midImage); - painter.setPen(Qt::NoPen); - painter.fillRect(midImage.rect(), slightlyOpaqueBlack); - painter.end(); -//! [0] + QPainter painter; + painter.begin(&midImage); + painter.setPen(Qt::NoPen); + painter.fillRect(midImage.rect(), slightlyOpaqueBlack); + painter.end(); + //! [0] -//! [1] - palette = QPalette(brown); + //! [1] + QPalette palette(brown); - palette.setBrush(QPalette::BrightText, Qt::white); - palette.setBrush(QPalette::Base, beige); - palette.setBrush(QPalette::Highlight, Qt::darkGreen); - setTexture(palette, QPalette::Button, buttonImage); - setTexture(palette, QPalette::Mid, midImage); - setTexture(palette, QPalette::Window, backgroundImage); + palette.setBrush(QPalette::BrightText, Qt::white); + palette.setBrush(QPalette::Base, beige); + palette.setBrush(QPalette::Highlight, Qt::darkGreen); + setTexture(palette, QPalette::Button, buttonImage); + setTexture(palette, QPalette::Mid, midImage); + setTexture(palette, QPalette::Window, backgroundImage); - QBrush brush = palette.window(); - brush.setColor(brush.color().darker()); + QBrush brush = palette.window(); + brush.setColor(brush.color().darker()); - palette.setBrush(QPalette::Disabled, QPalette::WindowText, brush); - palette.setBrush(QPalette::Disabled, QPalette::Text, brush); - palette.setBrush(QPalette::Disabled, QPalette::ButtonText, brush); - palette.setBrush(QPalette::Disabled, QPalette::Base, brush); - palette.setBrush(QPalette::Disabled, QPalette::Button, brush); - palette.setBrush(QPalette::Disabled, QPalette::Mid, brush); + palette.setBrush(QPalette::Disabled, QPalette::WindowText, brush); + palette.setBrush(QPalette::Disabled, QPalette::Text, brush); + palette.setBrush(QPalette::Disabled, QPalette::ButtonText, brush); + palette.setBrush(QPalette::Disabled, QPalette::Base, brush); + palette.setBrush(QPalette::Disabled, QPalette::Button, brush); + palette.setBrush(QPalette::Disabled, QPalette::Mid, brush); + + m_standardPalette = palette; + } + + return m_standardPalette; } //! [1] diff --git a/examples/widgets/widgets/styles/norwegianwoodstyle.h b/examples/widgets/widgets/styles/norwegianwoodstyle.h index 5a1783eb4d1..62ca502d05c 100644 --- a/examples/widgets/widgets/styles/norwegianwoodstyle.h +++ b/examples/widgets/widgets/styles/norwegianwoodstyle.h @@ -66,7 +66,8 @@ class NorwegianWoodStyle : public QProxyStyle public: NorwegianWoodStyle(); - void polish(QPalette &palette) override; + QPalette standardPalette() const override; + void polish(QWidget *widget) override; void unpolish(QWidget *widget) override; int pixelMetric(PixelMetric metric, const QStyleOption *option, @@ -82,6 +83,7 @@ private: static void setTexture(QPalette &palette, QPalette::ColorRole role, const QImage &image); static QPainterPath roundRectPath(const QRect &rect); + mutable QPalette m_standardPalette; }; //! [0] From ee1b77e13240ae9e68af62ed9cfadabe3f8c936e Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Fri, 13 Dec 2019 13:14:34 +0100 Subject: [PATCH 05/29] dumpcpp: Use tblCopy to ensure the path is detected correctly This amends faf742b05d0564a58bfe0290e53e0b2844bc59c1 Change-Id: Ia80a4274f61d895c297b2fae5df62c86db95c14c Reviewed-by: Joerg Bornemann --- mkspecs/features/win32/dumpcpp.prf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mkspecs/features/win32/dumpcpp.prf b/mkspecs/features/win32/dumpcpp.prf index d19da3d0778..589d700e4e0 100644 --- a/mkspecs/features/win32/dumpcpp.prf +++ b/mkspecs/features/win32/dumpcpp.prf @@ -26,9 +26,9 @@ QMAKE_EXTRA_COMPILERS += dumpcpp_impl !build_pass:have_target:!contains(TEMPLATE, vc.*) { for(tlb, TYPELIBS) { tlbCopy = $$replace(tlb, \", ) - hdr = $$basename(tlb) + hdr = $$basename(tlbCopy) hdr = $$section(hdr, ., 0, -2) - tmp_command = $$QMAKE_DUMPCPP $$system_quote($$absolute_path($$tlb, $$_PRO_FILE_PWD_)) \ + tmp_command = $$QMAKE_DUMPCPP $$system_quote($$absolute_path($$tlbCopy, $$_PRO_FILE_PWD_)) \ -o $$system_quote($$OUT_PWD/$$hdr) qaxcontainer_compat: tmp_command += -compat !exists($$OUT_PWD/$${hdr}.h): system($$tmp_command) From ef4448f1294f0e8ff2e398f1b8917917c3ac0d0b Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Wed, 11 Dec 2019 08:13:32 +0100 Subject: [PATCH 06/29] Always add the extra Android apk and aab targets The extra targets should be added to the project regardless so that qmake can handle it appropriately. This enables make apk to work correctly then from a SUBDIRS project. Fixes: QTBUG-80351 Change-Id: If5903e0d2f543babfdb4ebbb13502e32ab97c6fc Reviewed-by: Joerg Bornemann --- mkspecs/features/android/android.prf | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/mkspecs/features/android/android.prf b/mkspecs/features/android/android.prf index 26374cabcaf..af004bbb25c 100644 --- a/mkspecs/features/android/android.prf +++ b/mkspecs/features/android/android.prf @@ -41,10 +41,9 @@ build_pass { INSTALLS *= target } } else { - QMAKE_EXTRA_TARGETS *= aab apk apk_install_target - android-build-distclean.commands = \ $$QMAKE_DEL_TREE $$shell_quote($$shell_path($$OUT_PWD/android-build)) QMAKE_EXTRA_TARGETS *= android-build-distclean CLEAN_DEPS += android-build-distclean } +QMAKE_EXTRA_TARGETS *= aab apk apk_install_target 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: [PATCH 07/29] 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(-) diff --git a/src/widgets/kernel/qtestsupport_widgets.h b/src/widgets/kernel/qtestsupport_widgets.h index ca1406b0b20..2b37a9e8583 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 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: [PATCH 08/29] macOS: Handle missing color space information in IOSurface backingstore Fixes: QTBUG-80972 Change-Id: Iab3f1a9cf03251340e5f32bcc73103428e93282d Reviewed-by: Timur Pocheptsov --- .../platforms/cocoa/qiosurfacegraphicsbuffer.mm | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/plugins/platforms/cocoa/qiosurfacegraphicsbuffer.mm b/src/plugins/platforms/cocoa/qiosurfacegraphicsbuffer.mm index 285e316d4af..fc187e0f515 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 From dcef0b96eef04c4e17c2e51ea71aea1f78625864 Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Thu, 19 Dec 2019 21:59:09 +0100 Subject: [PATCH 09/29] 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 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 00000000000..92739192e4f --- /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 bd647ca1c27..d3e0c065b69 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' ); From a75d238b3194ae4973be7f6ce0508a526d4aa49e Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Thu, 19 Dec 2019 22:31:15 +0100 Subject: [PATCH 10/29] 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 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 00000000000..1b8deaa4a11 --- /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 d3e0c065b69..a430554db7d 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; } From 3b697f496303bd005ae9d1d2c974efeed259d8a3 Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Thu, 2 Jan 2020 09:07:08 +0100 Subject: [PATCH 11/29] 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 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 00000000000..db436ab4f69 --- /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 a430554db7d..712a103ef6d 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); From 1e89c132e1280276e1d3a82ec3464afec8c14c3a Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Thu, 2 Jan 2020 08:47:23 +0100 Subject: [PATCH 12/29] 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 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 00000000000..e92c5668816 --- /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 712a103ef6d..d5b43857ad4 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; From 8669b8e60fc6a46baaeeea264a1ed3008dd52ea2 Mon Sep 17 00:00:00 2001 From: Fabian Kosmale Date: Wed, 11 Dec 2019 10:54:57 +0100 Subject: [PATCH 13/29] 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 +++-- .../corelib/kernel/qvariant/tst_qvariant.cpp | 44 +++++++++++++++++++ 2 files changed, 49 insertions(+), 6 deletions(-) diff --git a/src/corelib/kernel/qvariant.h b/src/corelib/kernel/qvariant.h index a4957472ec1..c95882d48f7 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(); diff --git a/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp b/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp index e7198711286..45eb61f6e4f 100644 --- a/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp +++ b/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp @@ -282,6 +282,8 @@ private slots: void fromStdVariant(); void qt4UuidDataStream(); + void preferDirectConversionOverInterfaces(); + private: void dataStream_data(QDataStream::Version version); void loadQVariantFromDataStream(QDataStream::Version version); @@ -5140,5 +5142,47 @@ void tst_QVariant::qt4UuidDataStream() QCOMPARE(result.value(), source); } +void tst_QVariant::preferDirectConversionOverInterfaces() +{ + using namespace QtMetaTypePrivate; + bool calledCorrectConverter = false; + QMetaType::registerConverter([](const MyType &) { + return QSequentialIterableImpl {}; + }); + QMetaType::registerConverter([&calledCorrectConverter](const MyType &) { + calledCorrectConverter = true; + return QVariantList {}; + }); + QMetaType::registerConverter([](const MyType &) { + return QAssociativeIterableImpl {}; + }); + QMetaType::registerConverter([&calledCorrectConverter](const MyType &) { + calledCorrectConverter = true; + return QVariantHash {}; + }); + QMetaType::registerConverter([&calledCorrectConverter](const MyType &) { + calledCorrectConverter = true; + return QVariantMap {}; + }); + auto holder = QVariant::fromValue(MyType {}); + + QVERIFY(holder.canConvert()); + QVERIFY(holder.canConvert()); + QVERIFY(holder.canConvert()); + QVERIFY(holder.canConvert()); + QVERIFY(holder.canConvert()); + + holder.value(); + QVERIFY(calledCorrectConverter); + calledCorrectConverter = false; + + holder.value(); + QVERIFY(calledCorrectConverter); + calledCorrectConverter = false; + + holder.value(); + QVERIFY(calledCorrectConverter); +} + QTEST_MAIN(tst_QVariant) #include "tst_qvariant.moc" From 7c0341daeef9c975b0e736b9d8a52b9649c6a06c Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Fri, 3 Jan 2020 12:51:20 +0100 Subject: [PATCH 14/29] 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(-) diff --git a/src/tools/uic/cpp/cppwriteinitialization.cpp b/src/tools/uic/cpp/cppwriteinitialization.cpp index 570a61a1f10..4fbf01262b6 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 235a8ed2fca..987d51e30ca 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 fc8af9715bb..7b019ec8fc4 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; 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: [PATCH 15/29] 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(-) diff --git a/src/plugins/platforms/cocoa/qcocoabackingstore.mm b/src/plugins/platforms/cocoa/qcocoabackingstore.mm index 8a815a7665e..2e15d115645 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 From 8b0b2057d060c9f33cfeb0ea38a08ace22079f93 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Fri, 3 Jan 2020 13:08:52 +0100 Subject: [PATCH 16/29] 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(-) diff --git a/src/tools/uic/cpp/cppwriteinitialization.cpp b/src/tools/uic/cpp/cppwriteinitialization.cpp index 4fbf01262b6..5dbe10082c7 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; } From 01f0df1cf559991e4b7fbee1cb14b068fb6895c8 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Fri, 3 Jan 2020 15:02:44 +0100 Subject: [PATCH 17/29] 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(+) diff --git a/src/tools/uic/main.cpp b/src/tools/uic/main.cpp index 9cf22d502d1..d6c63de869c 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 4fc442e94ab..8e882079c9f 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 303615f77b4..be556966834 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 427cbb48b11..54624539624 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; From 02ddf08db808304363454a9ef7cba9b41af3f112 Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Thu, 2 Jan 2020 15:03:16 +0100 Subject: [PATCH 18/29] 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(-) diff --git a/src/corelib/text/qlocale.qdoc b/src/corelib/text/qlocale.qdoc index dbcd71f1a01..592f9d0785a 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 From c62333424839b3229706a6ebb64ba271689a3b8c Mon Sep 17 00:00:00 2001 From: Christian Ehrlicher Date: Sun, 22 Dec 2019 17:53:20 +0100 Subject: [PATCH 19/29] 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(-) diff --git a/src/widgets/widgets/qplaintextedit.cpp b/src/widgets/widgets/qplaintextedit.cpp index e8da720b581..7e9e0fabe97 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(); 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: [PATCH 20/29] 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(-) diff --git a/src/tools/uic/cpp/cppwriteinitialization.cpp b/src/tools/uic/cpp/cppwriteinitialization.cpp index 5dbe10082c7..1444c681c0b 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(" From 56674dca36f113369d3ed598192a392ceb723605 Mon Sep 17 00:00:00 2001 From: Christian Ehrlicher Date: Wed, 25 Dec 2019 19:37:53 +0100 Subject: [PATCH 21/29] 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(+) diff --git a/src/widgets/styles/qstylesheetstyle.cpp b/src/widgets/styles/qstylesheetstyle.cpp index 98c85684ae4..c694e9db97b 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); } From 2c3eaa7b87219d24facfe81a5b22cb218324f1ae Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Fri, 27 Dec 2019 18:01:49 +0100 Subject: [PATCH 22/29] 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(-) diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp index e8d129d0470..f8d5914f374 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 { From aa542be4e005b1feedc2e17fd6ca2387bf2fea1b Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Wed, 18 Dec 2019 17:23:50 +0100 Subject: [PATCH 23/29] 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(-) diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp index 99d64737c59..3ddc52bed41 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. + 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. - Note that the image will be converted to the Format_ARGB32_Premultiplied - format if the function succeeds. + 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. - Use one of the composition modes in QPainter::CompositionMode instead. + The operation is similar to painting \a alphaChannel as an alpha image + over this image using \c QPainter::CompositionMode_DestinationIn. - \warning This function is expensive. - - \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 7544ccca05f..115071c16e3 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 6515748bf54..eb50f52bd63 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) } } } From 24b8b2cb6ccd3704545ef44519f567edb3da5d5d Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Fri, 3 Jan 2020 13:39:04 +0100 Subject: [PATCH 24/29] 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 ++-- .../widgets/widgets/qtabbar/qtabbar.pro | 1 + .../widgets/qtabbar/stylesheet/main.cpp | 71 ++++++++++++++++++ .../widgets/qtabbar/stylesheet/res.qrc | 5 ++ .../widgets/qtabbar/stylesheet/stylesheet.pro | 5 ++ .../widgets/widgets/qtabbar/stylesheet/v.ico | Bin 0 -> 1886 bytes tests/manual/widgets/widgets/widgets.pro | 3 +- 10 files changed, 127 insertions(+), 8 deletions(-) create mode 100644 tests/manual/widgets/widgets/qtabbar/qtabbar.pro create mode 100644 tests/manual/widgets/widgets/qtabbar/stylesheet/main.cpp create mode 100644 tests/manual/widgets/widgets/qtabbar/stylesheet/res.qrc create mode 100644 tests/manual/widgets/widgets/qtabbar/stylesheet/stylesheet.pro create mode 100644 tests/manual/widgets/widgets/qtabbar/stylesheet/v.ico diff --git a/src/widgets/styles/qstyleoption.cpp b/src/widgets/styles/qstyleoption.cpp index 5292d971ea2..aca4eec0e79 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 7f5edf42795..a8ce3b465ee 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 7e8c9a60507..7fe46e24b64 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 aff95b09318..a7b115a1bc6 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)) diff --git a/tests/manual/widgets/widgets/qtabbar/qtabbar.pro b/tests/manual/widgets/widgets/qtabbar/qtabbar.pro new file mode 100644 index 00000000000..b39c81493ba --- /dev/null +++ b/tests/manual/widgets/widgets/qtabbar/qtabbar.pro @@ -0,0 +1 @@ +SUBDIRS = stylesheet diff --git a/tests/manual/widgets/widgets/qtabbar/stylesheet/main.cpp b/tests/manual/widgets/widgets/qtabbar/stylesheet/main.cpp new file mode 100644 index 00000000000..02393f66f95 --- /dev/null +++ b/tests/manual/widgets/widgets/qtabbar/stylesheet/main.cpp @@ -0,0 +1,71 @@ +/**************************************************************************** + ** + ** Copyright (C) 2020 The Qt Company Ltd. + ** Contact: https://www.qt.io/licensing/ + ** + ** This file is part of the test suite of the Qt Toolkit. + ** + ** $QT_BEGIN_LICENSE:BSD$ + ** Commercial License Usage + ** Licensees holding valid commercial Qt licenses may use this file in + ** accordance with the commercial license agreement provided with the + ** Software or, alternatively, in accordance with the terms contained in + ** a written agreement between you and The Qt Company. For licensing terms + ** and conditions see https://www.qt.io/terms-conditions. For further + ** information use the contact form at https://www.qt.io/contact-us. + ** + ** BSD License Usage + ** Alternatively, you may use this file under the terms of the BSD license + ** as follows: + ** + ** "Redistribution and use in source and binary forms, with or without + ** modification, are permitted provided that the following conditions are + ** met: + ** * Redistributions of source code must retain the above copyright + ** notice, this list of conditions and the following disclaimer. + ** * Redistributions in binary form must reproduce the above copyright + ** notice, this list of conditions and the following disclaimer in + ** the documentation and/or other materials provided with the + ** distribution. + ** * Neither the name of The Qt Company Ltd nor the names of its + ** contributors may be used to endorse or promote products derived + ** from this software without specific prior written permission. + ** + ** + ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." + ** + ** $QT_END_LICENSE$ + ** + ****************************************************************************/ + +// This test is for checking that when there is padding set on the stylesheet and the elide mode is +// set that it is correctly shown as elided and not clipped. + +#include +#include +#include + +int main(int argc, char** argv) +{ + QApplication app(argc, argv); + app.setStyleSheet("QTabBar::tab { padding-left: 20px; }\n"); + QIcon icon(":/v.ico"); + + QTabBar b; + b.setElideMode(Qt::ElideRight); + b.addTab(icon, "some text"); + b.resize(80,32); + b.show(); + + return app.exec(); +} diff --git a/tests/manual/widgets/widgets/qtabbar/stylesheet/res.qrc b/tests/manual/widgets/widgets/qtabbar/stylesheet/res.qrc new file mode 100644 index 00000000000..9d0bb8e0618 --- /dev/null +++ b/tests/manual/widgets/widgets/qtabbar/stylesheet/res.qrc @@ -0,0 +1,5 @@ + + + v.ico + + diff --git a/tests/manual/widgets/widgets/qtabbar/stylesheet/stylesheet.pro b/tests/manual/widgets/widgets/qtabbar/stylesheet/stylesheet.pro new file mode 100644 index 00000000000..4957503abc5 --- /dev/null +++ b/tests/manual/widgets/widgets/qtabbar/stylesheet/stylesheet.pro @@ -0,0 +1,5 @@ +QT += widgets +TEMPLATE = app +TARGET = stylesheet +RESOURCES += res.qrc +SOURCES += main.cpp diff --git a/tests/manual/widgets/widgets/qtabbar/stylesheet/v.ico b/tests/manual/widgets/widgets/qtabbar/stylesheet/v.ico new file mode 100644 index 0000000000000000000000000000000000000000..90dfbc9f9bafcd35c4fdc81f5978396b676e596e GIT binary patch literal 1886 zcmb`IX;WHP7{}?WeuGXwg4&@ac1&v8?3rq|Nv3UVn`V+!v$zo?dZU6O2E@9MmQ0pG z?PSIcak&Eb!oBPuTV$|+Yfwax6c->M2GAhdlj%%ewDn!jne)7OX6|qP|K~a9xdg%o zV1N8E;aw!;e@GyFL?93{zyT=&37mKN{np+-YiDOC7LR$?y~agj-$dUp`d^CW#h0X) zj!BPwF8iE_6SI_And;0>RiEZ)a*k?_?t|G&r_-^mm@nirEtv#%0Y}HVjo-e2UN|B- zLPAMdSXKs>k*UZeDu@SF2Ty2E?916pN8?fVx?Ato_x#b*sA(*c6`d2GJ1jc3r_`tZlat;}CsWC_&9&*(X}L?@VeP2b)n7xeofVzUg>y+TDNB@< zA;|zV5=J_#IGm@+`!@$TO1@17V?j^IGwvIQr(m9$SE;PLBDs zXA#B395m-Be)PQN{69FLyz#AgI2QJXyv~4AyP)lN^f!++Q{}+B7!Qq3)MvvuV`9J7?_?rV{Y;SMJyLdx?1909$*2C*dfu%{$ zq<%&Z+u#mkN2{i_PFZ(XdbdzqSO6DX9J-h{katpW^7z2<Adj#nf^0p z2hLs?x$v#{+pGB15^YH$k%&g4fz`l*cfsLus3ufH=AlkaXS=eUfioZsqR1%4Xz^|2 z_Ro@^Z-{POg|B`;{C&Y-!R6u0!08q7l_Ggjxvo4Ci3C;x?j^T%+N!iFg=4}lO;;=4 z+JH4wAypJ9g^ZEQvGNkEqzo%7mzI}EN{YqBg`V5Tnx`xhBGwRfJ)$-~}X(bsYmm;ON zq_;}&60(XsH$OM-7?+#ngWACkyn`#{G7%<(Kov*@Sw<$y$rLrEMqk4+vRW)HJPYrU z`4M-F%hIrF6}42H3Pb`trfIy1XXo|0df^3Fz9`4tI68;++53PnriKaL3ou@al@2Q2L3k1# zOU$B4XpjuLhu@>Bsa5(anwiG2ad=K%x2qfVp{5m+J!rQDYzD6Zo5P;lp0^rWX=)k; zr+_YWpRd$X{6)yT2(FR3y{$;(a<*C_SE&X z+tZB%5L4JRyE*IM@<&pUH|aOg?dVEuWomUwy{PV)?0IN;2u2gQ7%YUvlr!s8b)YYd zaR%GYZl7&`w(v}_EI?Ke!)wFz=JfK`awHu|?j}>asjbvjFcEZz-KJ&J=-lYDiDzsh z8&X3|oXOBK8jKB0E0gVDb6;}#i~Jsck7P}v3+txeO#8NduXkPpB|CdNyL-DJ#%p_*KZ@r Date: Fri, 3 Jan 2020 12:00:10 +0100 Subject: [PATCH 25/29] 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(-) diff --git a/src/corelib/text/qregularexpression.cpp b/src/corelib/text/qregularexpression.cpp index 068c960910e..fb8f5a5efcc 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 f799a38ae4d..4fa258b0801 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); } From 908df199d0782d161e83d75dd7a7d9aab29ff9e7 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Fri, 13 Dec 2019 14:18:11 +0100 Subject: [PATCH 26/29] 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 +++++++++ .../qbasicvulkanplatforminstance.cpp | 16 ++++++++++++++++ 3 files changed, 36 insertions(+) diff --git a/src/gui/rhi/qrhivulkan.cpp b/src/gui/rhi/qrhivulkan.cpp index 21ae142b1dd..c540e9fa855 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 ed73a776837..e211863f21e 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 68340a31732..6f6ba583199 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) { From 844ef184e8021237280a45ead04a3ab39cefa657 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Tue, 17 Dec 2019 15:15:24 +0100 Subject: [PATCH 27/29] 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 -- tests/auto/gui/rhi/qrhi/tst_qrhi.cpp | 50 --------------------------- 18 files changed, 7 insertions(+), 330 deletions(-) diff --git a/src/gui/rhi/qrhi.cpp b/src/gui/rhi/qrhi.cpp index 58f30deb416..00d4df53bdd 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 44118b2f10f..a6c65aac5e9 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 ba2488bffb8..c5923fe4118 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 5df1843b1ea..aba0f37ee78 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 8f02c4300bc..9ddd2aa7970 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 ffaccbad711..e63ed11dd49 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 7f7c8b4c402..8d8f0c73965 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 d4f1336c3e8..a9b30226125 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 b6ca40e08b1..222bf170dca 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 094801c58cd..17e28b2c0fc 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 8e655fd98b0..71d4325b1aa 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 80f004e0496..ea67f80138e 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 7d3ce5dbf15..dbf385555d6 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 57c3de04184..f541fd90b8a 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 c540e9fa855..c5719b54aa0 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 ff19c7a54e7..d4959196710 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 d1b77870a1f..9f18d0bf5e0 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 diff --git a/tests/auto/gui/rhi/qrhi/tst_qrhi.cpp b/tests/auto/gui/rhi/qrhi/tst_qrhi.cpp index 6f88b7fab56..191260fd415 100644 --- a/tests/auto/gui/rhi/qrhi/tst_qrhi.cpp +++ b/tests/auto/gui/rhi/qrhi/tst_qrhi.cpp @@ -381,56 +381,6 @@ void tst_QRhi::nativeHandles() } } - // QRhiTexture::nativeHandles() - { - QScopedPointer tex(rhi->newTexture(QRhiTexture::RGBA8, QSize(512, 256))); - QVERIFY(tex->build()); - - const QRhiNativeHandles *texHandles = tex->nativeHandles(); - QVERIFY(texHandles); - - switch (impl) { - case QRhi::Null: - break; -#ifdef TST_VK - case QRhi::Vulkan: - { - const QRhiVulkanTextureNativeHandles *vkHandles = static_cast(texHandles); - QVERIFY(vkHandles->image); - QVERIFY(vkHandles->layout >= 1); // VK_IMAGE_LAYOUT_GENERAL - QVERIFY(vkHandles->layout <= 8); // VK_IMAGE_LAYOUT_PREINITIALIZED - } - break; -#endif -#ifdef TST_GL - case QRhi::OpenGLES2: - { - const QRhiGles2TextureNativeHandles *glHandles = static_cast(texHandles); - QVERIFY(glHandles->texture); - } - break; -#endif -#ifdef TST_D3D11 - case QRhi::D3D11: - { - const QRhiD3D11TextureNativeHandles *d3dHandles = static_cast(texHandles); - QVERIFY(d3dHandles->texture); - } - break; -#endif -#ifdef TST_MTL - case QRhi::Metal: - { - const QRhiMetalTextureNativeHandles *mtlHandles = static_cast(texHandles); - QVERIFY(mtlHandles->texture); - } - break; -#endif - default: - Q_ASSERT(false); - } - } - // QRhiCommandBuffer::nativeHandles() { QRhiCommandBuffer *cb = nullptr; From 82d02b7b95908dec16e41c5af1c63579729c589b Mon Sep 17 00:00:00 2001 From: Sona Kurazyan Date: Thu, 7 Nov 2019 17:26:55 +0100 Subject: [PATCH 28/29] 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 --- .../doc/images/saxbookmarks-example.png | Bin 26219 -> 0 bytes .../saxbookmarks/doc/src/saxbookmarks.qdoc | 41 ---- examples/xml/saxbookmarks/jennifer.xbel | 69 ------- examples/xml/saxbookmarks/main.cpp | 62 ------ examples/xml/saxbookmarks/mainwindow.cpp | 177 ------------------ examples/xml/saxbookmarks/mainwindow.h | 80 -------- examples/xml/saxbookmarks/saxbookmarks.pro | 15 -- examples/xml/saxbookmarks/xbelgenerator.cpp | 124 ------------ examples/xml/saxbookmarks/xbelgenerator.h | 78 -------- examples/xml/saxbookmarks/xbelhandler.cpp | 160 ---------------- examples/xml/saxbookmarks/xbelhandler.h | 88 --------- examples/xml/xml.pro | 1 - 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 + .../qxmlstream/tst_qxmlstream.cpp | 69 ++++--- tests/auto/xml/dom/qdom/tst_qdom.cpp | 36 +++- tests/auto/xml/sax/qxml/tst_qxml.cpp | 7 +- .../qxmlinputsource/tst_qxmlinputsource.cpp | 8 + .../sax/qxmlsimplereader/parser/parser.cpp | 10 +- .../xml/sax/qxmlsimplereader/parser/parser.h | 6 + .../qxmlsimplereader/tst_qxmlsimplereader.cpp | 9 + 27 files changed, 293 insertions(+), 963 deletions(-) delete mode 100644 examples/xml/saxbookmarks/doc/images/saxbookmarks-example.png delete mode 100644 examples/xml/saxbookmarks/doc/src/saxbookmarks.qdoc delete mode 100644 examples/xml/saxbookmarks/jennifer.xbel delete mode 100644 examples/xml/saxbookmarks/main.cpp delete mode 100644 examples/xml/saxbookmarks/mainwindow.cpp delete mode 100644 examples/xml/saxbookmarks/mainwindow.h delete mode 100644 examples/xml/saxbookmarks/saxbookmarks.pro delete mode 100644 examples/xml/saxbookmarks/xbelgenerator.cpp delete mode 100644 examples/xml/saxbookmarks/xbelgenerator.h delete mode 100644 examples/xml/saxbookmarks/xbelhandler.cpp delete mode 100644 examples/xml/saxbookmarks/xbelhandler.h diff --git a/examples/xml/saxbookmarks/doc/images/saxbookmarks-example.png b/examples/xml/saxbookmarks/doc/images/saxbookmarks-example.png deleted file mode 100644 index 54d793be564f68e3f00dc581dbab3699a4a00f9c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 26219 zcmbTdbySpH-#@BIiin7`fKnpiNK21WBHhi<-Q75Xf>P2AqjYzd0)lkM&`2{3T{Fa- z3-9}R*886ITj#8E{*bl2_I2(3-QSMSd{$PJA-YR__tvdjM6z!sRd3z8y$Sq-;Nt>M zK4wCG-nwPMEi3t2-D?JEfS2@0>RR-OYADzzu*w7+{*0wRX)ujU1V{2E1KB(h9US&oC6& zhtT6~aUCBFFY{`B@5F3REwagcD8v8V`vvQLiQm_tR^I4vOIrzP0VT!V~Z;YkG2*}jdo6r0+01}k3yab~LA6$yS7a{qJn9`Bn| zY@0vgr|D)iEalve{!Uj7g^-@sD?D{hL%qEb-|xkXv(`0yBbYtyDMLcc9r=oFQsp!7g1*;N*}P@cBpto|He!0*R$1x*^K+M_f3RPQ;`xk zmN`ne(XUs4ZEg$BA1=N!%*x2^HV5f2-nnzZ-ZrPmPwuGJe%j8Cl!)9ycT5|(o*a^W z+}3WgwZ$^X>6+Tcxn1LBgf2F>2^@O=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kQ@+RcLUQLIe4C*u!FNAVJK^bM zyMQzK5E@tiAAdHe2R%q=4&~o>hn - - - - Qt Resources - - Qt home page - - - Qt Partners - - - Training - - - Qt 5 documentation - - - Frequently Asked Questions - - - Community Resources - - Qt Centre - - - QtForum.org - - - The Independent Qt Tutorial - - - German Qt Forum - - - Korean Qt Community Site - - - Russian Qt Forum - - - - - Online Dictionaries - - Dictionary.com - - - Merriam-Webster Online - - - Cambridge Dictionaries Online - - - OneLook Dictionary Search - - - - TU Chemnitz German-English Dictionary - - - - Trésor de la Langue Française informatisé - - - Dictionnaire de l'Académie Française - - - diff --git a/examples/xml/saxbookmarks/main.cpp b/examples/xml/saxbookmarks/main.cpp deleted file mode 100644 index 8e577ca700e..00000000000 --- a/examples/xml/saxbookmarks/main.cpp +++ /dev/null @@ -1,62 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, you may use this file under the terms of the BSD license -** as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include - -#include "mainwindow.h" - -int main(int argc, char *argv[]) -{ - QApplication app(argc, argv); - MainWindow mainWin; - mainWin.show(); - mainWin.open(); - return app.exec(); -} diff --git a/examples/xml/saxbookmarks/mainwindow.cpp b/examples/xml/saxbookmarks/mainwindow.cpp deleted file mode 100644 index 8b7733081f0..00000000000 --- a/examples/xml/saxbookmarks/mainwindow.cpp +++ /dev/null @@ -1,177 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, you may use this file under the terms of the BSD license -** as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include - -#include "mainwindow.h" -#include "xbelgenerator.h" -#include "xbelhandler.h" - -MainWindow::MainWindow() -{ - QStringList labels; - labels << tr("Title") << tr("Location"); - - treeWidget = new QTreeWidget; - treeWidget->header()->setSectionResizeMode(QHeaderView::Stretch); - treeWidget->setHeaderLabels(labels); -#if !defined(QT_NO_CONTEXTMENU) && !defined(QT_NO_CLIPBOARD) - treeWidget->setContextMenuPolicy(Qt::CustomContextMenu); - connect(treeWidget, &QWidget::customContextMenuRequested, - this, &MainWindow::onCustomContextMenuRequested); -#endif - setCentralWidget(treeWidget); - - createMenus(); - - statusBar()->showMessage(tr("Ready")); - - setWindowTitle(tr("SAX Bookmarks")); - const QSize availableSize = screen()->availableGeometry().size(); - resize(availableSize.width() / 2, availableSize.height() / 3); -} - -#if !defined(QT_NO_CONTEXTMENU) && !defined(QT_NO_CLIPBOARD) -void MainWindow::onCustomContextMenuRequested(const QPoint &pos) -{ - const QTreeWidgetItem *item = treeWidget->itemAt(pos); - if (!item) - return; - const QString url = item->text(1); - QMenu contextMenu; - QAction *copyAction = contextMenu.addAction(tr("Copy Link to Clipboard")); - QAction *openAction = contextMenu.addAction(tr("Open")); - QAction *action = contextMenu.exec(treeWidget->viewport()->mapToGlobal(pos)); - if (action == copyAction) - QGuiApplication::clipboard()->setText(url); - else if (action == openAction) - QDesktopServices::openUrl(QUrl(url)); -} -#endif // !QT_NO_CONTEXTMENU && !QT_NO_CLIPBOARD - -void MainWindow::open() -{ - QString fileName = - QFileDialog::getOpenFileName(this, tr("Open Bookmark File"), - QDir::currentPath(), - tr("XBEL Files (*.xbel *.xml)")); - if (fileName.isEmpty()) - return; - - treeWidget->clear(); - - XbelHandler handler(treeWidget); - QXmlSimpleReader reader; - reader.setContentHandler(&handler); - reader.setErrorHandler(&handler); - - QFile file(fileName); - if (!file.open(QFile::ReadOnly | QFile::Text)) { - QMessageBox::warning(this, tr("SAX Bookmarks"), - tr("Cannot read file %1:\n%2.") - .arg(QDir::toNativeSeparators(fileName), - file.errorString())); - return; - } - - QXmlInputSource xmlInputSource(&file); - if (reader.parse(xmlInputSource)) - statusBar()->showMessage(tr("File loaded"), 2000); -} - -void MainWindow::saveAs() -{ - QString fileName = - QFileDialog::getSaveFileName(this, tr("Save Bookmark File"), - QDir::currentPath(), - tr("XBEL Files (*.xbel *.xml)")); - if (fileName.isEmpty()) - return; - - QFile file(fileName); - if (!file.open(QFile::WriteOnly | QFile::Text)) { - QMessageBox::warning(this, tr("SAX Bookmarks"), - tr("Cannot write file %1:\n%2.") - .arg(QDir::toNativeSeparators(fileName), - file.errorString())); - return; - } - - XbelGenerator generator(treeWidget); - if (generator.write(&file)) - statusBar()->showMessage(tr("File saved"), 2000); -} - -void MainWindow::about() -{ - QMessageBox::about(this, tr("About SAX Bookmarks"), - tr("The SAX Bookmarks example demonstrates how to use Qt's " - "SAX classes to read XML documents and how to generate XML by " - "hand.")); -} - -void MainWindow::createMenus() -{ - QMenu *fileMenu = menuBar()->addMenu(tr("&File")); - QAction *openAct = fileMenu->addAction(tr("&Open..."), this, &MainWindow::open); - openAct->setShortcuts(QKeySequence::Open); - - QAction *saveAsAct = fileMenu->addAction(tr("&Save As..."), this, &MainWindow::saveAs); - saveAsAct->setShortcuts(QKeySequence::SaveAs); - - QAction *exitAct = fileMenu->addAction(tr("E&xit"), this, &QWidget::close); - exitAct->setShortcuts(QKeySequence::Quit); - - menuBar()->addSeparator(); - - QMenu *helpMenu = menuBar()->addMenu(tr("&Help")); - helpMenu->addAction(tr("&About"), this, &MainWindow::about); - helpMenu->addAction(tr("About &Qt"), qApp, &QCoreApplication::quit); -} diff --git a/examples/xml/saxbookmarks/mainwindow.h b/examples/xml/saxbookmarks/mainwindow.h deleted file mode 100644 index 20a11bb2029..00000000000 --- a/examples/xml/saxbookmarks/mainwindow.h +++ /dev/null @@ -1,80 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, you may use this file under the terms of the BSD license -** as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef MAINWINDOW_H -#define MAINWINDOW_H - -#include - -QT_BEGIN_NAMESPACE -class QTreeWidget; -QT_END_NAMESPACE - -class MainWindow : public QMainWindow -{ - Q_OBJECT - -public: - MainWindow(); - -public slots: - void open(); - void saveAs(); - void about(); -#if !defined(QT_NO_CONTEXTMENU) && !defined(QT_NO_CLIPBOARD) - void onCustomContextMenuRequested(const QPoint &pos); -#endif -private: - void createMenus(); - - QTreeWidget *treeWidget; -}; - -#endif diff --git a/examples/xml/saxbookmarks/saxbookmarks.pro b/examples/xml/saxbookmarks/saxbookmarks.pro deleted file mode 100644 index af2a124a135..00000000000 --- a/examples/xml/saxbookmarks/saxbookmarks.pro +++ /dev/null @@ -1,15 +0,0 @@ -HEADERS = mainwindow.h \ - xbelgenerator.h \ - xbelhandler.h -SOURCES = main.cpp \ - mainwindow.cpp \ - xbelgenerator.cpp \ - xbelhandler.cpp -QT += xml widgets -requires(qtConfig(filedialog)) - -EXAMPLE_FILES = frank.xbel jennifer.xbel - -# install -target.path = $$[QT_INSTALL_EXAMPLES]/xml/saxbookmarks -INSTALLS += target diff --git a/examples/xml/saxbookmarks/xbelgenerator.cpp b/examples/xml/saxbookmarks/xbelgenerator.cpp deleted file mode 100644 index 77cb6748fe3..00000000000 --- a/examples/xml/saxbookmarks/xbelgenerator.cpp +++ /dev/null @@ -1,124 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, you may use this file under the terms of the BSD license -** as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include - -#include "xbelgenerator.h" - -XbelGenerator::XbelGenerator(const QTreeWidget *treeWidget) - : treeWidget(treeWidget) -{ -} - -bool XbelGenerator::write(QIODevice *device) -{ - out.setDevice(device); - out.setCodec("UTF-8"); - out << "\n" - << "\n" - << "\n"; - - for (int i = 0; i < treeWidget->topLevelItemCount(); ++i) - generateItem(treeWidget->topLevelItem(i), 1); - - out << "\n"; - return true; -} - -QString XbelGenerator::indent(int depth) -{ - const int IndentSize = 4; - return QString(IndentSize * depth, ' '); -} - -QString XbelGenerator::escapedText(const QString &str) -{ - QString result = str; - result.replace('&', "&"); - result.replace('<', "<"); - result.replace('>', ">"); - return result; -} - -QString XbelGenerator::escapedAttribute(const QString &str) -{ - QString result = escapedText(str); - result.replace(QLatin1Char('"'), """); - result.prepend(QLatin1Char('"')); - result.append(QLatin1Char('"')); - return result; -} - -void XbelGenerator::generateItem(const QTreeWidgetItem *item, int depth) -{ - QString tagName = item->data(0, Qt::UserRole).toString(); - if (tagName == QLatin1String("folder")) { - bool folded = !item->isExpanded(); - out << indent(depth) << "\n" - << indent(depth + 1) << "" << escapedText(item->text(0)) - << "\n"; - - for (int i = 0; i < item->childCount(); ++i) - generateItem(item->child(i), depth + 1); - - out << indent(depth) << "\n"; - } else if (tagName == QLatin1String("bookmark")) { - out << indent(depth) << "text(1).isEmpty()) - out << " href=" << escapedAttribute(item->text(1)); - out << ">\n" - << indent(depth + 1) << "" << escapedText(item->text(0)) - << "\n" - << indent(depth) << "\n"; - } else if (tagName == QLatin1String("separator")) { - out << indent(depth) << "\n"; - } -} diff --git a/examples/xml/saxbookmarks/xbelgenerator.h b/examples/xml/saxbookmarks/xbelgenerator.h deleted file mode 100644 index abfabfd75c0..00000000000 --- a/examples/xml/saxbookmarks/xbelgenerator.h +++ /dev/null @@ -1,78 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, you may use this file under the terms of the BSD license -** as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef XBELGENERATOR_H -#define XBELGENERATOR_H - -#include - -QT_BEGIN_NAMESPACE -class QTreeWidget; -class QTreeWidgetItem; -QT_END_NAMESPACE - -class XbelGenerator -{ -public: - explicit XbelGenerator(const QTreeWidget *treeWidget); - - bool write(QIODevice *device); - -private: - static QString indent(int indentLevel); - static QString escapedText(const QString &str); - static QString escapedAttribute(const QString &str); - void generateItem(const QTreeWidgetItem *item, int depth); - - const QTreeWidget *treeWidget; - QTextStream out; -}; - -#endif diff --git a/examples/xml/saxbookmarks/xbelhandler.cpp b/examples/xml/saxbookmarks/xbelhandler.cpp deleted file mode 100644 index 62dfbf94825..00000000000 --- a/examples/xml/saxbookmarks/xbelhandler.cpp +++ /dev/null @@ -1,160 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, you may use this file under the terms of the BSD license -** as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include - -#include "xbelhandler.h" - -static inline QString versionAttribute() { return QStringLiteral("version"); } -static inline QString hrefAttribute() { return QStringLiteral("href"); } -static inline QString foldedAttribute() { return QStringLiteral("folded"); } - -XbelHandler::XbelHandler(QTreeWidget *treeWidget) - : treeWidget(treeWidget) -{ - item = 0; - metXbelTag = false; - - QStyle *style = treeWidget->style(); - - folderIcon.addPixmap(style->standardPixmap(QStyle::SP_DirClosedIcon), - QIcon::Normal, QIcon::Off); - folderIcon.addPixmap(style->standardPixmap(QStyle::SP_DirOpenIcon), - QIcon::Normal, QIcon::On); - bookmarkIcon.addPixmap(style->standardPixmap(QStyle::SP_FileIcon)); -} - -bool XbelHandler::startElement(const QString & /* namespaceURI */, - const QString & /* localName */, - const QString &qName, - const QXmlAttributes &attributes) -{ - if (!metXbelTag && qName != QLatin1String("xbel")) { - errorStr = QObject::tr("The file is not an XBEL file."); - return false; - } - - if (qName == QLatin1String("xbel")) { - QString version = attributes.value(versionAttribute()); - if (!version.isEmpty() && version != QLatin1String("1.0")) { - errorStr = QObject::tr("The file is not an XBEL version 1.0 file."); - return false; - } - metXbelTag = true; - } else if (qName == QLatin1String("folder")) { - item = createChildItem(qName); - item->setFlags(item->flags() | Qt::ItemIsEditable); - item->setIcon(0, folderIcon); - item->setText(0, QObject::tr("Folder")); - bool folded = (attributes.value(foldedAttribute()) != QLatin1String("no")); - item->setExpanded(!folded); - } else if (qName == QLatin1String("bookmark")) { - item = createChildItem(qName); - item->setFlags(item->flags() | Qt::ItemIsEditable); - item->setIcon(0, bookmarkIcon); - item->setText(0, QObject::tr("Unknown title")); - item->setText(1, attributes.value(hrefAttribute())); - } else if (qName == QLatin1String("separator")) { - item = createChildItem(qName); - item->setFlags(item->flags() & ~Qt::ItemIsSelectable); - item->setText(0, QString(30, 0xB7)); - } - - currentText.clear(); - return true; -} - -bool XbelHandler::endElement(const QString & /* namespaceURI */, - const QString & /* localName */, - const QString &qName) -{ - if (qName == QLatin1String("title")) { - if (item) - item->setText(0, currentText); - } else if (qName == QLatin1String("folder") || qName == QLatin1String("bookmark") - || qName == QLatin1String("separator")) { - item = item->parent(); - } - return true; -} - -bool XbelHandler::characters(const QString &str) -{ - currentText += str; - return true; -} - -bool XbelHandler::fatalError(const QXmlParseException &exception) -{ - QMessageBox::information(treeWidget->window(), QObject::tr("SAX Bookmarks"), - QObject::tr("Parse error at line %1, column %2:\n" - "%3") - .arg(exception.lineNumber()) - .arg(exception.columnNumber()) - .arg(exception.message())); - return false; -} - -QString XbelHandler::errorString() const -{ - return errorStr; -} - -QTreeWidgetItem *XbelHandler::createChildItem(const QString &tagName) -{ - QTreeWidgetItem *childItem; - if (item) { - childItem = new QTreeWidgetItem(item); - } else { - childItem = new QTreeWidgetItem(treeWidget); - } - childItem->setData(0, Qt::UserRole, tagName); - return childItem; -} diff --git a/examples/xml/saxbookmarks/xbelhandler.h b/examples/xml/saxbookmarks/xbelhandler.h deleted file mode 100644 index 3f4cb109e92..00000000000 --- a/examples/xml/saxbookmarks/xbelhandler.h +++ /dev/null @@ -1,88 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, you may use this file under the terms of the BSD license -** as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef XBELHANDLER_H -#define XBELHANDLER_H - -#include -#include - -QT_BEGIN_NAMESPACE -class QTreeWidget; -class QTreeWidgetItem; -QT_END_NAMESPACE - -class XbelHandler : public QXmlDefaultHandler -{ -public: - XbelHandler(QTreeWidget *treeWidget); - - bool startElement(const QString &namespaceURI, const QString &localName, - const QString &qName, const QXmlAttributes &attributes) override; - bool endElement(const QString &namespaceURI, const QString &localName, - const QString &qName) override; - bool characters(const QString &str) override; - bool fatalError(const QXmlParseException &exception) override; - QString errorString() const override; - -private: - QTreeWidgetItem *createChildItem(const QString &tagName); - - QTreeWidget *treeWidget; - QTreeWidgetItem *item; - QString currentText; - QString errorStr; - bool metXbelTag; - - QIcon folderIcon; - QIcon bookmarkIcon; -}; - -#endif diff --git a/examples/xml/xml.pro b/examples/xml/xml.pro index 72bf95b2ea1..b0750574f45 100644 --- a/examples/xml/xml.pro +++ b/examples/xml/xml.pro @@ -4,7 +4,6 @@ SUBDIRS = htmlinfo \ qtHaveModule(widgets) { SUBDIRS += dombookmarks \ - saxbookmarks \ streambookmarks qtHaveModule(network): SUBDIRS += \ diff --git a/src/xml/dom/qdom.cpp b/src/xml/dom/qdom.cpp index cb753ed5732..bbc877eeada 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 1b00a141794..d50c5e83942 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 b66c756af05..a9399d99012 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 9399ad3b9b6..10e37f7c0fe 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 f5efd8a42df..4de18f7d4dd 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 1993073cce2..0033d042d4b 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 9be14bd7a9a..e19a398ca7b 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 eb6135db041..1b614dd8862 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 diff --git a/tests/auto/corelib/serialization/qxmlstream/tst_qxmlstream.cpp b/tests/auto/corelib/serialization/qxmlstream/tst_qxmlstream.cpp index 92a0d8bbfad..12279133a21 100644 --- a/tests/auto/corelib/serialization/qxmlstream/tst_qxmlstream.cpp +++ b/tests/auto/corelib/serialization/qxmlstream/tst_qxmlstream.cpp @@ -221,7 +221,7 @@ static QString documentElement(const QByteArray &document) * * See \l {http://www.w3.org/XML/Test/} {Extensible Markup Language (XML) Conformance Test Suites} */ -class TestSuiteHandler : public QXmlDefaultHandler +class TestSuiteHandler { public: /** @@ -286,29 +286,33 @@ public: m_baseURI.push(baseURI); } - virtual bool characters(const QString &chars) + bool runTests(QFile *file) { - m_ch = chars; - return true; + QXmlStreamReader reader(file); + while (!reader.atEnd() && !reader.hasError()) { + reader.readNext(); + + if (reader.isStartElement() && !startElement(reader.attributes())) + return false; + + if (reader.isEndElement() && !endElement(reader.name().toString())) + return false; + } + return !reader.hasError(); } - virtual bool startElement(const QString &, - const QString &, - const QString &, - const QXmlAttributes &atts) + bool startElement(const QXmlStreamAttributes &atts) { m_atts.push(atts); - const int i = atts.index(QLatin1String("xml:base")); - if(i != -1) - m_baseURI.push(m_baseURI.top().resolved(atts.value(i))); + const auto attr = atts.value(QLatin1String("xml:base")); + if (!attr.isEmpty()) + m_baseURI.push(m_baseURI.top().resolved(attr.toString())); return true; } - virtual bool endElement(const QString &, - const QString &localName, - const QString &) + bool endElement(const QString &localName) { if(localName == QLatin1String("TEST")) { @@ -329,19 +333,19 @@ public: return true; } - const QString inputFilePath(m_baseURI.top().resolved(m_atts.top().value(QString(), QLatin1String("URI"))) - .toLocalFile()); - const QString id(m_atts.top().value(QString(), QLatin1String("ID"))); - const QString type(m_atts.top().value(QString(), QLatin1String("TYPE"))); + const QString inputFilePath( + m_baseURI.top() + .resolved( + m_atts.top().value(QString(), QLatin1String("URI")).toString()) + .toLocalFile()); + const QString id(m_atts.top().value(QString(), QLatin1String("ID")).toString()); + const QString type(m_atts.top().value(QString(), QLatin1String("TYPE")).toString()); QString expectedFilePath; - const int index = m_atts.top().index(QString(), QLatin1String("OUTPUT")); - if(index != -1) - { - expectedFilePath = m_baseURI.top().resolved(m_atts.top().value(QString(), - QLatin1String("OUTPUT"))).toLocalFile(); - } + const auto attr = m_atts.top().value(QString(), QLatin1String("OUTPUT")); + if (!attr.isEmpty()) + expectedFilePath = m_baseURI.top().resolved(attr.toString()).toLocalFile(); /* testcases.dtd: 'No parser should accept a "not-wf" testcase * unless it's a nonvalidating parser and the test contains @@ -349,7 +353,7 @@ public: * * We also let this apply to "valid", "invalid" and "error" tests, although * I'm not fully sure this is correct. */ - const QString ents(m_atts.top().value(QString(), QLatin1String("ENTITIES"))); + const QString ents(m_atts.top().value(QString(), QLatin1String("ENTITIES")).toString()); m_atts.pop(); if(ents == QLatin1String("both") || @@ -455,8 +459,8 @@ public: qFatal("The input catalog is invalid."); return false; } - } - else if(localName == QLatin1String("TESTCASES") && m_atts.top().index(QLatin1String("xml:base")) != -1) + } else if (localName == QLatin1String("TESTCASES") + && m_atts.top().hasAttribute(QLatin1String("xml:base"))) m_baseURI.pop(); m_atts.pop(); @@ -516,9 +520,8 @@ public: } private: - QStack m_atts; - QString m_ch; - QStack m_baseURI; + QStack m_atts; + QStack m_baseURI; }; QT_BEGIN_NAMESPACE Q_DECLARE_SHARED(TestSuiteHandler::MissedBaseline) @@ -592,11 +595,7 @@ void tst_QXmlStream::initTestCase() QVERIFY2(file.open(QIODevice::ReadOnly), qPrintable(QString::fromLatin1("Failed to open the test suite catalog; %1").arg(file.fileName()))); - QXmlInputSource source(&file); - QXmlSimpleReader reader; - reader.setContentHandler(&m_handler); - - QVERIFY(reader.parse(&source, false)); + QVERIFY(m_handler.runTests(&file)); } void tst_QXmlStream::cleanupTestCase() diff --git a/tests/auto/xml/dom/qdom/tst_qdom.cpp b/tests/auto/xml/dom/qdom/tst_qdom.cpp index ab623077045..a2a5b22cade 100644 --- a/tests/auto/xml/dom/qdom/tst_qdom.cpp +++ b/tests/auto/xml/dom/qdom/tst_qdom.cpp @@ -173,7 +173,7 @@ void tst_QDom::setContent_data() " \n" "\n"); -#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) +#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) && QT_DEPRECATED_SINCE(5, 15) // These configurations cannot be supported by the QXmlStreamReader-based implementation QTest::newRow( "02" ) << doc01 << QString("http://trolltech.com/xml/features/report-whitespace-only-CharData").split(' ') @@ -246,7 +246,9 @@ void tst_QDom::setContent() QFETCH( QString, doc ); QDomDocument domDoc; -#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; source.setData( doc ); @@ -264,6 +266,7 @@ void tst_QDom::setContent() } QVERIFY( domDoc.setContent( &source, &reader ) ); +QT_WARNING_POP #else QXmlStreamReader reader(doc); QVERIFY(domDoc.setContent(&reader, true)); @@ -1483,7 +1486,7 @@ void tst_QDom::normalizeAttributes() const QDomDocument doc; QVERIFY(doc.setContent(&buffer, true)); -#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) +#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) && QT_DEPRECATED_SINCE(5, 15) QEXPECT_FAIL("", "The parser doesn't perform Attribute Value Normalization. Fixing that would change behavior.", Continue); #endif QCOMPARE(doc.documentElement().attribute(QLatin1String("attribute")), QString::fromLatin1("a a")); @@ -1528,7 +1531,10 @@ void tst_QDom::serializeNamespaces() const QDomDocument doc; QByteArray ba(input); -#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 + QBuffer buffer(&ba); QVERIFY(buffer.open(QIODevice::ReadOnly)); @@ -1538,6 +1544,7 @@ void tst_QDom::serializeNamespaces() const reader.setFeature("http://xml.org/sax/features/namespace-prefixes", false); QVERIFY(doc.setContent(&source, &reader)); +QT_WARNING_POP #else QXmlStreamReader streamReader(input); QVERIFY(doc.setContent(&streamReader, true)); @@ -1565,7 +1572,7 @@ void tst_QDom::flagInvalidNamespaces() const QDomDocument doc; QVERIFY(!doc.setContent(QString::fromLatin1(input, true))); -#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) +#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) && QT_DEPRECATED_SINCE(5, 15) QEXPECT_FAIL("", "The parser doesn't flag identical qualified attribute names. Fixing this would change behavior.", Continue); #endif QVERIFY(!doc.setContent(QString::fromLatin1(input))); @@ -1580,7 +1587,9 @@ void tst_QDom::flagUndeclaredNamespace() const QDomDocument doc; QByteArray ba(input); -#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 QBuffer buffer(&ba); QVERIFY(buffer.open(QIODevice::ReadOnly)); @@ -1592,6 +1601,7 @@ void tst_QDom::flagUndeclaredNamespace() const QEXPECT_FAIL("", "The parser doesn't flag not declared prefixes. Fixing this would change behavior.", Continue); QVERIFY(!doc.setContent(&source, &reader)); +QT_WARNING_POP #else QXmlStreamReader streamReader(ba); QVERIFY(!doc.setContent(&streamReader, true)); @@ -1662,7 +1672,7 @@ void tst_QDom::reportDuplicateAttributes() const QDomDocument dd; bool isSuccess = dd.setContent(QLatin1String("")); -#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) +#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) && QT_DEPRECATED_SINCE(5, 15) QEXPECT_FAIL("", "The parser doesn't flag duplicate attributes. Fixing this would change behavior.", Continue); #endif QVERIFY2(!isSuccess, "Duplicate attributes are well-formedness errors, and should be reported as such."); @@ -1864,11 +1874,14 @@ void tst_QDom::doubleNamespaceDeclarations() const QFile file(testFile); QVERIFY(file.open(QIODevice::ReadOnly)); -#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 QXmlSimpleReader reader; QXmlInputSource source(&file); QVERIFY(doc.setContent(&source, &reader)); +QT_WARNING_POP #else QXmlStreamReader streamReader(&file); QVERIFY(doc.setContent(&streamReader, true)); @@ -1889,11 +1902,14 @@ void tst_QDom::setContentQXmlReaderOverload() const { QDomDocument doc; -#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 QXmlSimpleReader reader; QXmlInputSource data; data.setData(QByteArray("")); doc.setContent(&data, true); +QT_WARNING_POP #else QXmlStreamReader streamReader(QByteArray("")); doc.setContent(&streamReader, true); @@ -1995,7 +2011,7 @@ void tst_QDom::taskQTBUG4595_dontAssertWhenDocumentSpecifiesUnknownEncoding() co // QXmlStreamReader fails to read XML documents with unknown encoding. It // needs to be modified if we want to support this case with the QXmlStreamReader-based // implementation. -#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) +#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) && QT_DEPRECATED_SINCE(5, 15) QString xmlWithUnknownEncoding("" "" " How will this sentence be handled?" diff --git a/tests/auto/xml/sax/qxml/tst_qxml.cpp b/tests/auto/xml/sax/qxml/tst_qxml.cpp index 1cdb9701fa9..db6584edda1 100644 --- a/tests/auto/xml/sax/qxml/tst_qxml.cpp +++ b/tests/auto/xml/sax/qxml/tst_qxml.cpp @@ -26,7 +26,6 @@ ** ****************************************************************************/ - #include #include @@ -38,13 +37,17 @@ class tst_QXml : public QObject Q_OBJECT private slots: +#if QT_DEPRECATED_SINCE(5, 15) void getSetCheck(); void interpretedAs0D() const; #ifndef QT_NO_EXCEPTIONS void exception(); #endif +#endif // QT_DEPRECATED_SINCE(5, 15) }; +#if QT_DEPRECATED_SINCE(5, 15) + class MyXmlEntityResolver : public QXmlEntityResolver { public: @@ -225,5 +228,7 @@ void tst_QXml::exception() } #endif +#endif // QT_DEPRECATED_SINCE(5, 15) + QTEST_MAIN(tst_QXml) #include "tst_qxml.moc" diff --git a/tests/auto/xml/sax/qxmlinputsource/tst_qxmlinputsource.cpp b/tests/auto/xml/sax/qxmlinputsource/tst_qxmlinputsource.cpp index d40c8c2fd6d..afdcc825d80 100644 --- a/tests/auto/xml/sax/qxmlinputsource/tst_qxmlinputsource.cpp +++ b/tests/auto/xml/sax/qxmlinputsource/tst_qxmlinputsource.cpp @@ -45,13 +45,18 @@ class tst_QXmlInputSource : public QObject { Q_OBJECT +#if QT_DEPRECATED_SINCE(5, 15) private slots: void reset() const; void resetSimplified() const; void waitForReadyIODevice() const; void inputFromSlowDevice() const; +#endif // QT_DEPRECATED_SINCE(5, 15) }; +#if QT_DEPRECATED_SINCE(5, 15) +QT_WARNING_PUSH +QT_WARNING_DISABLE_DEPRECATED /*! \internal \since 4.4 @@ -292,5 +297,8 @@ void tst_QXmlInputSource::inputFromSlowDevice() const QCOMPARE(data, expectedData); } +QT_WARNING_POP +#endif // QT_DEPRECATED_SINCE(5, 15) + QTEST_MAIN(tst_QXmlInputSource) #include "tst_qxmlinputsource.moc" diff --git a/tests/auto/xml/sax/qxmlsimplereader/parser/parser.cpp b/tests/auto/xml/sax/qxmlsimplereader/parser/parser.cpp index 556603a6818..44f81019555 100644 --- a/tests/auto/xml/sax/qxmlsimplereader/parser/parser.cpp +++ b/tests/auto/xml/sax/qxmlsimplereader/parser/parser.cpp @@ -26,12 +26,15 @@ ** ****************************************************************************/ +#include "parser.h" + +#if QT_DEPRECATED_SINCE(5, 15) #include #include -#include "parser.h" - +QT_WARNING_PUSH +QT_WARNING_DISABLE_DEPRECATED class ContentHandler : public QXmlDefaultHandler { public: @@ -440,3 +443,6 @@ QString Parser::errorMsg() const { return handler->errorMsg(); } + +QT_WARNING_POP +#endif // QT_DEPRECATED_SINCE(5, 15) diff --git a/tests/auto/xml/sax/qxmlsimplereader/parser/parser.h b/tests/auto/xml/sax/qxmlsimplereader/parser/parser.h index 604678f06b2..9c51cdf095d 100644 --- a/tests/auto/xml/sax/qxmlsimplereader/parser/parser.h +++ b/tests/auto/xml/sax/qxmlsimplereader/parser/parser.h @@ -28,6 +28,10 @@ #ifndef PARSER_H #define PARSER_H +#include + +#if QT_DEPRECATED_SINCE(5, 15) + #include #include #include @@ -48,4 +52,6 @@ private: ContentHandler *handler; }; +#endif // QT_DEPRECATED_SINCE(5, 15) + #endif diff --git a/tests/auto/xml/sax/qxmlsimplereader/tst_qxmlsimplereader.cpp b/tests/auto/xml/sax/qxmlsimplereader/tst_qxmlsimplereader.cpp index 8c4c6c7179d..cea4e3c8b81 100644 --- a/tests/auto/xml/sax/qxmlsimplereader/tst_qxmlsimplereader.cpp +++ b/tests/auto/xml/sax/qxmlsimplereader/tst_qxmlsimplereader.cpp @@ -127,6 +127,7 @@ class tst_QXmlSimpleReader : public QObject { Q_OBJECT +#if QT_DEPRECATED_SINCE(5, 15) public: tst_QXmlSimpleReader(); ~tst_QXmlSimpleReader(); @@ -157,8 +158,13 @@ class tst_QXmlSimpleReader : public QObject static QDomDocument fromByteArray(const QString &title, const QByteArray &ba, bool *ok); XmlServer *server; QString prefix; +#endif // QT_DEPRECATED_SINCE(5, 15) }; +#if QT_DEPRECATED_SINCE(5, 15) +QT_WARNING_PUSH +QT_WARNING_DISABLE_DEPRECATED + tst_QXmlSimpleReader::tst_QXmlSimpleReader() : server(new XmlServer(this)) { server->start(); @@ -820,5 +826,8 @@ void tst_QXmlSimpleReader::dtdRecursionLimit() } } +QT_WARNING_POP +#endif // QT_DEPRECATED_SINCE(5, 15) + QTEST_MAIN(tst_QXmlSimpleReader) #include "tst_qxmlsimplereader.moc" From bd4a1b98b813dfbbb4a9db35a380bed8dd5f0ce3 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Mon, 6 Jan 2020 10:50:33 +0100 Subject: [PATCH 29/29] 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(-) diff --git a/src/platformsupport/kmsconvenience/qkmsdevice.cpp b/src/platformsupport/kmsconvenience/qkmsdevice.cpp index b820fafd506..18f7b5e23bb 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);