diff options
author | Tasuku Suzuki <tasuku.suzuki@qbc.io> | 2019-05-22 15:21:13 +0900 |
---|---|---|
committer | Tasuku Suzuki <tasuku.suzuki@qbc.io> | 2019-05-22 22:11:41 +0900 |
commit | ec6dc5f78453048c4f0604655a34c6c20c79d819 (patch) | |
tree | 11abc64fbcf73b07f86ab090ad145cd6f3faec4a /src/gui | |
parent | 9f77c9152220abb26a4d6a9dfa46fec7f87d60e6 (diff) |
Fix gui build without feature.regularexpression
Change-Id: Id27fc81af8d2b0355b186540f41d75a9c8d7c7f3
Reviewed-by: David Faure <david.faure@kdab.com>
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/kernel/qplatformdialoghelper.cpp | 6 | ||||
-rw-r--r-- | src/gui/text/qtextmarkdownimporter.cpp | 12 | ||||
-rw-r--r-- | src/gui/text/qtextmarkdownimporter_p.h | 4 | ||||
-rw-r--r-- | src/gui/util/util.pri | 9 |
4 files changed, 28 insertions, 3 deletions
diff --git a/src/gui/kernel/qplatformdialoghelper.cpp b/src/gui/kernel/qplatformdialoghelper.cpp index d14d575056..4bee153489 100644 --- a/src/gui/kernel/qplatformdialoghelper.cpp +++ b/src/gui/kernel/qplatformdialoghelper.cpp @@ -41,7 +41,9 @@ #include <QtCore/QCoreApplication> #include <QtCore/QVariant> +#if QT_CONFIG(regularexpression) #include <QtCore/QRegularExpression> +#endif #include <QtCore/QSharedData> #if QT_CONFIG(settings) #include <QtCore/QSettings> @@ -786,6 +788,7 @@ const char QPlatformFileDialogHelper::filterRegExp[] = // Makes a list of filters from a normal filter string "Image Files (*.png *.jpg)" QStringList QPlatformFileDialogHelper::cleanFilterList(const QString &filter) { +#if QT_CONFIG(regularexpression) QRegularExpression regexp(QString::fromLatin1(filterRegExp)); Q_ASSERT(regexp.isValid()); QString f = filter; @@ -794,6 +797,9 @@ QStringList QPlatformFileDialogHelper::cleanFilterList(const QString &filter) if (match.hasMatch()) f = match.captured(2); return f.split(QLatin1Char(' '), QString::SkipEmptyParts); +#else + return QStringList(); +#endif } // Message dialog diff --git a/src/gui/text/qtextmarkdownimporter.cpp b/src/gui/text/qtextmarkdownimporter.cpp index d8ffec2496..8c80a3f0c7 100644 --- a/src/gui/text/qtextmarkdownimporter.cpp +++ b/src/gui/text/qtextmarkdownimporter.cpp @@ -40,7 +40,9 @@ #include "qtextmarkdownimporter_p.h" #include "qtextdocumentfragment_p.h" #include <QLoggingCategory> +#if QT_CONFIG(regularexpression) #include <QRegularExpression> +#endif #include <QTextCursor> #include <QTextDocument> #include <QTextDocumentFragment> @@ -425,16 +427,20 @@ int QTextMarkdownImporter::cbText(int textType, const char *text, unsigned size) return 0; // it's the alt-text if (m_needsInsertBlock) insertBlock(); +#if QT_CONFIG(regularexpression) static const QRegularExpression openingBracket(QStringLiteral("<[a-zA-Z]")); static const QRegularExpression closingBracket(QStringLiteral("(/>|</)")); +#endif QString s = QString::fromUtf8(text, int(size)); switch (textType) { case MD_TEXT_NORMAL: +#if QT_CONFIG(regularexpression) if (m_htmlTagDepth) { m_htmlAccumulator += s; s = QString(); } +#endif break; case MD_TEXT_NULLCHAR: s = QString(QChar(0xFFFD)); // CommonMark-required replacement for null @@ -448,12 +454,15 @@ int QTextMarkdownImporter::cbText(int textType, const char *text, unsigned size) case MD_TEXT_CODE: // We'll see MD_SPAN_CODE too, which will set the char format, and that's enough. break; +#if QT_CONFIG(texthtmlparser) case MD_TEXT_ENTITY: m_cursor->insertHtml(s); s = QString(); break; +#endif case MD_TEXT_HTML: // count how many tags are opened and how many are closed +#if QT_CONFIG(regularexpression) { int startIdx = 0; while ((startIdx = s.indexOf(openingBracket, startIdx)) >= 0) { @@ -467,7 +476,6 @@ int QTextMarkdownImporter::cbText(int textType, const char *text, unsigned size) } } m_htmlAccumulator += s; - s = QString(); if (!m_htmlTagDepth) { // all open tags are now closed qCDebug(lcMD) << "HTML" << m_htmlAccumulator; m_cursor->insertHtml(m_htmlAccumulator); @@ -477,6 +485,8 @@ int QTextMarkdownImporter::cbText(int textType, const char *text, unsigned size) m_cursor->setCharFormat(m_spanFormatStack.top()); m_htmlAccumulator = QString(); } +#endif + s = QString(); break; } diff --git a/src/gui/text/qtextmarkdownimporter_p.h b/src/gui/text/qtextmarkdownimporter_p.h index 1716530b1d..d62f1cf7dd 100644 --- a/src/gui/text/qtextmarkdownimporter_p.h +++ b/src/gui/text/qtextmarkdownimporter_p.h @@ -106,14 +106,18 @@ private: QTextDocument *m_doc = nullptr; QTextCursor *m_cursor = nullptr; QTextTable *m_currentTable = nullptr; // because m_cursor->currentTable() doesn't work +#if QT_CONFIG(regularexpression) QString m_htmlAccumulator; +#endif QString m_blockCodeLanguage; QVector<int> m_nonEmptyTableCells; // in the current row QStack<QTextList *> m_listStack; QStack<QTextCharFormat> m_spanFormatStack; QFont m_monoFont; QPalette m_palette; +#if QT_CONFIG(regularexpression) int m_htmlTagDepth = 0; +#endif int m_blockQuoteDepth = 0; int m_tableColumnCount = 0; int m_tableRowCount = 0; diff --git a/src/gui/util/util.pri b/src/gui/util/util.pri index e5e711b1a0..d3402133d6 100644 --- a/src/gui/util/util.pri +++ b/src/gui/util/util.pri @@ -8,7 +8,6 @@ HEADERS += \ util/qabstractlayoutstyleinfo_p.h \ util/qlayoutpolicy_p.h \ util/qshaderformat_p.h \ - util/qshadergenerator_p.h \ util/qshadergraph_p.h \ util/qshadergraphloader_p.h \ util/qshaderlanguage_p.h \ @@ -29,7 +28,6 @@ SOURCES += \ util/qabstractlayoutstyleinfo.cpp \ util/qlayoutpolicy.cpp \ util/qshaderformat.cpp \ - util/qshadergenerator.cpp \ util/qshadergraph.cpp \ util/qshadergraphloader.cpp \ util/qshaderlanguage.cpp \ @@ -41,3 +39,10 @@ SOURCES += \ util/qpkmhandler.cpp \ util/qktxhandler.cpp \ util/qastchandler.cpp + +qtConfig(regularexpression) { + HEADERS += \ + util/qshadergenerator_p.h + SOURCES += \ + util/qshadergenerator.cpp +} |