From e1915cd83e3b1abc0a7eec5e9917739ed512b459 Mon Sep 17 00:00:00 2001 From: Nico Vertriest Date: Mon, 17 Aug 2020 07:26:01 +0200 Subject: Doc: Make snippets Qt Gui compilable - textblock-fragments MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Task-number: QTBUG-81486 Change-Id: I3a6ee6ef744abb694d1cc7ef409f8bb584854395 Reviewed-by: Topi Reiniƶ --- src/gui/doc/snippets/snippets.pro | 1 + .../snippets/textblock-fragments/textblock-fragments.pro | 14 ++++++++------ src/gui/doc/snippets/textblock-fragments/xmlwriter.cpp | 12 +++++++++--- src/gui/doc/snippets/textblock-fragments/xmlwriter.h | 1 + 4 files changed, 19 insertions(+), 9 deletions(-) (limited to 'src/gui/doc') diff --git a/src/gui/doc/snippets/snippets.pro b/src/gui/doc/snippets/snippets.pro index 85876c15d4..079ffa7918 100644 --- a/src/gui/doc/snippets/snippets.pro +++ b/src/gui/doc/snippets/snippets.pro @@ -10,6 +10,7 @@ contains(QT_BUILD_PARTS, tests) { droparea \ qfontdatabase \ textblock-formats \ + textblock-fragments \ textdocument-blocks \ textdocument-charformats \ textdocument-css \ diff --git a/src/gui/doc/snippets/textblock-fragments/textblock-fragments.pro b/src/gui/doc/snippets/textblock-fragments/textblock-fragments.pro index 83ed78e573..b2fbea4fc3 100644 --- a/src/gui/doc/snippets/textblock-fragments/textblock-fragments.pro +++ b/src/gui/doc/snippets/textblock-fragments/textblock-fragments.pro @@ -1,6 +1,8 @@ -QT += xml -HEADERS = mainwindow.h \ - xmlwriter.h -SOURCES = main.cpp \ - mainwindow.cpp \ - xmlwriter.cpp +TEMPLATE = lib +TARGET = gui_snippets_textblock_fragments +QT += core gui widgets xml + +HEADERS = \ + xmlwriter.h +SOURCES = \ + xmlwriter.cpp diff --git a/src/gui/doc/snippets/textblock-fragments/xmlwriter.cpp b/src/gui/doc/snippets/textblock-fragments/xmlwriter.cpp index 1172b39847..96a2fdfb09 100644 --- a/src/gui/doc/snippets/textblock-fragments/xmlwriter.cpp +++ b/src/gui/doc/snippets/textblock-fragments/xmlwriter.cpp @@ -47,11 +47,10 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ - -#include - #include "xmlwriter.h" +#include + QDomDocument *XmlWriter::toXml() { QDomImplementation implementation; @@ -120,8 +119,15 @@ void XmlWriter::readFragment(const QTextBlock ¤tBlock, void XmlWriter::processBlock(const QTextBlock ¤tBlock) { + // Dummy use of specified parameter currentBlock + QTextBlock localBlock; + localBlock = currentBlock; + } void XmlWriter::processFragment(const QTextFragment ¤tFragment) { + // Dummy use of specified parameter currentFragment + QTextFragment localFragment; + localFragment = currentFragment; } diff --git a/src/gui/doc/snippets/textblock-fragments/xmlwriter.h b/src/gui/doc/snippets/textblock-fragments/xmlwriter.h index a9562e7c42..b140aa1c9b 100644 --- a/src/gui/doc/snippets/textblock-fragments/xmlwriter.h +++ b/src/gui/doc/snippets/textblock-fragments/xmlwriter.h @@ -52,6 +52,7 @@ #define XMLWRITER_H #include +#include class QTextDocument; -- cgit v1.2.3