From ec6dc5f78453048c4f0604655a34c6c20c79d819 Mon Sep 17 00:00:00 2001 From: Tasuku Suzuki Date: Wed, 22 May 2019 15:21:13 +0900 Subject: Fix gui build without feature.regularexpression Change-Id: Id27fc81af8d2b0355b186540f41d75a9c8d7c7f3 Reviewed-by: David Faure --- src/gui/kernel/qplatformdialoghelper.cpp | 6 ++++++ src/gui/text/qtextmarkdownimporter.cpp | 12 +++++++++++- src/gui/text/qtextmarkdownimporter_p.h | 4 ++++ src/gui/util/util.pri | 9 +++++++-- 4 files changed, 28 insertions(+), 3 deletions(-) (limited to 'src/gui') 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 #include +#if QT_CONFIG(regularexpression) #include +#endif #include #if QT_CONFIG(settings) #include @@ -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 +#if QT_CONFIG(regularexpression) #include +#endif #include #include #include @@ -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("(/>|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 m_nonEmptyTableCells; // in the current row QStack m_listStack; QStack 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 +} -- cgit v1.2.3