Fix build of Core module without regularexpression feature

qregularexpression.h requires FEATURE_regularexpression to be enabled.
Add a condition to the 'qt_pch.h' header to fix the build when PCH
are enabled and FEATURE_regularexpression is disabled.

It seems that the filter implementation of QSortFilterProxyModel
has QRegularExpression as its base. It's necessary to make
sortfilterproxymodel dependent on the regularexpression feature.

Fix the precompiler condition for the extractSections function in
the QString implementation. Use the same precompiler condition for
the QString::section and extractSections functions, since
QString::section depends on extractSections.

Change-Id: I5b775e0842a0aa1a8d47f8dded376bdfcf63b5bf
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
This commit is contained in:
Alexey Edelev 2021-03-03 16:23:53 +01:00
parent 4b9173e354
commit 6e5e8016dd
8 changed files with 8 additions and 22 deletions

View File

@ -782,7 +782,7 @@ qt_feature("sortfilterproxymodel" PUBLIC
SECTION "ItemViews"
LABEL "QSortFilterProxyModel"
PURPOSE "Supports sorting and filtering of data passed between another model and a view."
CONDITION QT_FEATURE_proxymodel
CONDITION QT_FEATURE_proxymodel AND QT_FEATURE_regularexpression
)
qt_feature_definition("sortfilterproxymodel" "QT_NO_SORTFILTERPROXYMODEL" NEGATE VALUE "1")
qt_feature("identityproxymodel" PUBLIC

View File

@ -788,7 +788,7 @@ qt_feature("sortfilterproxymodel" PUBLIC
SECTION "ItemViews"
LABEL "QSortFilterProxyModel"
PURPOSE "Supports sorting and filtering of data passed between another model and a view."
CONDITION QT_FEATURE_proxymodel
CONDITION QT_FEATURE_proxymodel AND QT_FEATURE_regularexpression
)
qt_feature_definition("sortfilterproxymodel" "QT_NO_SORTFILTERPROXYMODEL" NEGATE VALUE "1")
qt_feature("identityproxymodel" PUBLIC

View File

@ -898,7 +898,7 @@
"label": "QSortFilterProxyModel",
"purpose": "Supports sorting and filtering of data passed between another model and a view.",
"section": "ItemViews",
"condition": "features.proxymodel",
"condition": "features.proxymodel && features.regularexpression",
"output": [ "publicFeature", "feature" ]
},
"identityproxymodel": {

View File

@ -66,8 +66,6 @@
#define QT_NO_USING_NAMESPACE
#define QT_NO_DEPRECATED
#define QT_NO_REGEXP
// Keep feature-test macros in alphabetic order by feature name:
#define QT_FEATURE_alloca 1
#define QT_FEATURE_alloca_h -1

View File

@ -69,7 +69,9 @@
#include <qlist.h>
#include <qvariant.h> /* All moc genereated code has this include */
#include <qobject.h>
#include <qregularexpression.h>
#if QT_CONFIG(regularexpression)
# include <qregularexpression.h>
#endif
#include <qscopedpointer.h>
#include <qshareddata.h>
#include <qstring.h>

View File

@ -2484,7 +2484,6 @@ Qt::SortOrder QSortFilterProxyModel::sortOrder() const
return d->sort_order;
}
#if QT_CONFIG(regularexpression)
/*!
\since 5.12
\property QSortFilterProxyModel::filterRegularExpression
@ -2512,7 +2511,6 @@ void QSortFilterProxyModel::setFilterRegularExpression(const QRegularExpression
d->filter_data = regularExpression;
d->filter_changed(QSortFilterProxyModelPrivate::Direction::Rows);
}
#endif
/*!
\property QSortFilterProxyModel::filterKeyColumn
@ -2640,7 +2638,6 @@ void QSortFilterProxyModel::setSortLocaleAware(bool on)
emit sortLocaleAwareChanged(on);
}
#if QT_CONFIG(regularexpression)
/*!
\since 5.12
@ -2661,7 +2658,6 @@ void QSortFilterProxyModel::setFilterRegularExpression(const QString &pattern)
d->filter_data.setPattern(pattern);
d->filter_changed(QSortFilterProxyModelPrivate::Direction::Rows);
}
#endif
/*!
Sets the wildcard expression used to filter the contents

View File

@ -42,9 +42,7 @@
#include <QtCore/qabstractproxymodel.h>
#if QT_CONFIG(regularexpression)
# include <QtCore/qregularexpression.h>
#endif
#include <QtCore/qregularexpression.h>
QT_REQUIRE_CONFIG(sortfilterproxymodel);
@ -61,9 +59,7 @@ class Q_CORE_EXPORT QSortFilterProxyModel : public QAbstractProxyModel
friend class QSortFilterProxyModelGreaterThan;
Q_OBJECT
#if QT_CONFIG(regularexpression)
Q_PROPERTY(QRegularExpression filterRegularExpression READ filterRegularExpression WRITE setFilterRegularExpression)
#endif
Q_PROPERTY(int filterKeyColumn READ filterKeyColumn WRITE setFilterKeyColumn)
Q_PROPERTY(bool dynamicSortFilter READ dynamicSortFilter WRITE setDynamicSortFilter)
Q_PROPERTY(Qt::CaseSensitivity filterCaseSensitivity READ filterCaseSensitivity WRITE setFilterCaseSensitivity NOTIFY filterCaseSensitivityChanged)
@ -86,9 +82,7 @@ public:
QItemSelection mapSelectionToSource(const QItemSelection &proxySelection) const override;
QItemSelection mapSelectionFromSource(const QItemSelection &sourceSelection) const override;
#if QT_CONFIG(regularexpression)
QRegularExpression filterRegularExpression() const;
#endif
int filterKeyColumn() const;
void setFilterKeyColumn(int column);
@ -121,10 +115,8 @@ public:
void setAutoAcceptChildRows(bool accept);
public Q_SLOTS:
#if QT_CONFIG(regularexpression)
void setFilterRegularExpression(const QString &pattern);
void setFilterRegularExpression(const QRegularExpression &regularExpression);
#endif
void setFilterWildcard(const QString &pattern);
void setFilterFixedString(const QString &pattern);
void invalidate();

View File

@ -4569,7 +4569,7 @@ QString QString::section(const QString &sep, qsizetype start, qsizetype end, Sec
return ret;
}
#if !(defined(QT_NO_REGEXP) && !QT_CONFIG(regularexpression))
#if QT_CONFIG(regularexpression)
class qt_section_chunk {
public:
qt_section_chunk() {}
@ -4637,9 +4637,7 @@ static QString extractSections(const QList<qt_section_chunk> &sections, qsizetyp
return ret;
}
#endif
#if QT_CONFIG(regularexpression)
/*!
\overload section()
\since 5.0