Make sure we can build with -no-feature-itemmodel

Various pieces of code have to be disabled in this case.

Change-Id: I83b133f17e9f024016a79c9103293627185449d2
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
This commit is contained in:
Ulf Hermann 2018-02-09 15:22:03 +01:00
parent a47cb14680
commit 6e8e9979d0
20 changed files with 114 additions and 83 deletions

View File

@ -87,6 +87,7 @@
#define QT_FEATURE_journald -1
#define QT_FEATURE_futimens -1
#define QT_FEATURE_futimes -1
#define QT_FEATURE_itemmodel -1
#define QT_FEATURE_library -1
#ifdef __linux__
# define QT_FEATURE_linkat 1

View File

@ -1,20 +1,46 @@
# Qt itemmodels core module
!qtConfig(itemmodel): return()
HEADERS += \
itemmodels/qabstractitemmodel.h \
itemmodels/qabstractitemmodel_p.h \
itemmodels/qabstractproxymodel.h \
itemmodels/qabstractproxymodel_p.h \
itemmodels/qitemselectionmodel.h \
itemmodels/qitemselectionmodel_p.h \
itemmodels/qidentityproxymodel.h \
itemmodels/qsortfilterproxymodel.h \
itemmodels/qstringlistmodel.h
itemmodels/qitemselectionmodel_p.h
SOURCES += \
itemmodels/qabstractitemmodel.cpp \
itemmodels/qabstractproxymodel.cpp \
itemmodels/qitemselectionmodel.cpp \
itemmodels/qidentityproxymodel.cpp \
itemmodels/qsortfilterproxymodel.cpp \
itemmodels/qstringlistmodel.cpp
itemmodels/qitemselectionmodel.cpp
qtConfig(proxymodel) {
HEADERS += \
itemmodels/qabstractproxymodel.h \
itemmodels/qabstractproxymodel_p.h
SOURCES += \
itemmodels/qabstractproxymodel.cpp
qtConfig(identityproxymodel) {
HEADERS += \
itemmodels/qidentityproxymodel.h
SOURCES += \
itemmodels/qidentityproxymodel.cpp
}
qtConfig(sortfilterproxymodel) {
HEADERS += \
itemmodels/qsortfilterproxymodel.h
SOURCES += \
itemmodels/qsortfilterproxymodel.cpp
}
}
qtConfig(stringlistmodel) {
HEADERS += \
itemmodels/qstringlistmodel.h
SOURCES += \
itemmodels/qstringlistmodel.cpp
}

View File

@ -45,6 +45,8 @@
#include <QtCore/qhash.h>
#include <QtCore/qvector.h>
QT_REQUIRE_CONFIG(itemmodel);
QT_BEGIN_NAMESPACE

View File

@ -60,6 +60,8 @@
QT_BEGIN_NAMESPACE
QT_REQUIRE_CONFIG(itemmodel);
class QPersistentModelIndexData
{
public:

View File

@ -38,9 +38,6 @@
****************************************************************************/
#include "qabstractproxymodel.h"
#ifndef QT_NO_PROXYMODEL
#include "qitemselectionmodel.h"
#include <private/qabstractproxymodel_p.h>
#include <QtCore/QSize>
@ -471,5 +468,3 @@ Qt::DropActions QAbstractProxyModel::supportedDropActions() const
QT_END_NAMESPACE
#include "moc_qabstractproxymodel.cpp"
#endif // QT_NO_PROXYMODEL

View File

@ -42,11 +42,10 @@
#include <QtCore/qabstractitemmodel.h>
QT_REQUIRE_CONFIG(proxymodel);
QT_BEGIN_NAMESPACE
#ifndef QT_NO_PROXYMODEL
class QAbstractProxyModelPrivate;
class QItemSelection;
@ -112,8 +111,6 @@ private:
Q_PRIVATE_SLOT(d_func(), void _q_sourceModelDestroyed())
};
#endif // QT_NO_PROXYMODEL
QT_END_NAMESPACE
#endif // QABSTRACTPROXYMODEL_H

View File

@ -54,7 +54,7 @@
#include "private/qabstractitemmodel_p.h"
#ifndef QT_NO_PROXYMODEL
QT_REQUIRE_CONFIG(proxymodel);
QT_BEGIN_NAMESPACE
@ -71,6 +71,4 @@ public:
QT_END_NAMESPACE
#endif // QT_NO_PROXYMODEL
#endif // QABSTRACTPROXYMODEL_P_H

View File

@ -38,9 +38,6 @@
****************************************************************************/
#include "qidentityproxymodel.h"
#ifndef QT_NO_IDENTITYPROXYMODEL
#include "qitemselectionmodel.h"
#include <private/qabstractproxymodel_p.h>
@ -616,5 +613,3 @@ void QIdentityProxyModelPrivate::_q_sourceRowsRemoved(const QModelIndex &parent,
QT_END_NAMESPACE
#include "moc_qidentityproxymodel.cpp"
#endif // QT_NO_IDENTITYPROXYMODEL

View File

@ -43,7 +43,7 @@
#include <QtCore/qabstractproxymodel.h>
#ifndef QT_NO_IDENTITYPROXYMODEL
QT_REQUIRE_CONFIG(identityproxymodel);
QT_BEGIN_NAMESPACE
@ -110,7 +110,5 @@ private:
QT_END_NAMESPACE
#endif // QT_NO_IDENTITYPROXYMODEL
#endif // QIDENTITYPROXYMODEL_H

View File

@ -47,6 +47,8 @@
#include <QtCore/qlist.h>
#include <QtCore/qabstractitemmodel.h>
QT_REQUIRE_CONFIG(itemmodel);
QT_BEGIN_NAMESPACE
class Q_CORE_EXPORT QItemSelectionRange

View File

@ -53,6 +53,8 @@
#include "private/qobject_p.h"
QT_REQUIRE_CONFIG(itemmodel);
QT_BEGIN_NAMESPACE
class QItemSelectionModelPrivate: public QObjectPrivate

View File

@ -38,9 +38,6 @@
****************************************************************************/
#include "qsortfilterproxymodel.h"
#ifndef QT_NO_SORTFILTERPROXYMODEL
#include "qitemselectionmodel.h"
#include <qsize.h>
#include <qdebug.h>
@ -2883,5 +2880,3 @@ QItemSelection QSortFilterProxyModel::mapSelectionFromSource(const QItemSelectio
QT_END_NAMESPACE
#include "moc_qsortfilterproxymodel.cpp"
#endif // QT_NO_SORTFILTERPROXYMODEL

View File

@ -41,11 +41,10 @@
#define QSORTFILTERPROXYMODEL_H
#include <QtCore/qabstractproxymodel.h>
#ifndef QT_NO_SORTFILTERPROXYMODEL
#include <QtCore/qregexp.h>
QT_REQUIRE_CONFIG(sortfilterproxymodel);
QT_BEGIN_NAMESPACE
@ -198,6 +197,4 @@ private:
QT_END_NAMESPACE
#endif // QT_NO_SORTFILTERPROXYMODEL
#endif // QSORTFILTERPROXYMODEL_H

View File

@ -47,8 +47,6 @@
#include <algorithm>
#ifndef QT_NO_STRINGLISTMODEL
QT_BEGIN_NAMESPACE
/*!
@ -329,5 +327,3 @@ Qt::DropActions QStringListModel::supportedDropActions() const
QT_END_NAMESPACE
#include "moc_qstringlistmodel.cpp"
#endif // QT_NO_STRINGLISTMODEL

View File

@ -43,11 +43,10 @@
#include <QtCore/qabstractitemmodel.h>
#include <QtCore/qstringlist.h>
QT_REQUIRE_CONFIG(stringlistmodel);
QT_BEGIN_NAMESPACE
#ifndef QT_NO_STRINGLISTMODEL
class Q_CORE_EXPORT QStringListModel : public QAbstractListModel
{
Q_OBJECT
@ -78,8 +77,6 @@ private:
QStringList lst;
};
#endif // QT_NO_STRINGLISTMODEL
QT_END_NAMESPACE
#endif // QSTRINGLISTMODEL_H

View File

@ -61,7 +61,6 @@
# include "qbitarray.h"
# include "qurl.h"
# include "qvariant.h"
# include "qabstractitemmodel.h"
# include "qjsonvalue.h"
# include "qjsonobject.h"
# include "qjsonarray.h"
@ -69,6 +68,10 @@
# include "qbytearraylist.h"
#endif
#if QT_CONFIG(itemmodel)
# include "qabstractitemmodel.h"
#endif
#ifndef QT_NO_GEOM_VARIANT
# include "qsize.h"
# include "qpoint.h"
@ -1349,8 +1352,10 @@ bool QMetaType::save(QDataStream &stream, int type, const void *data)
case QMetaType::Void:
case QMetaType::VoidStar:
case QMetaType::QObjectStar:
#if QT_CONFIG(itemmodel)
case QMetaType::QModelIndex:
case QMetaType::QPersistentModelIndex:
#endif
case QMetaType::QJsonValue:
case QMetaType::QJsonObject:
case QMetaType::QJsonArray:
@ -1573,8 +1578,10 @@ bool QMetaType::load(QDataStream &stream, int type, void *data)
case QMetaType::Void:
case QMetaType::VoidStar:
case QMetaType::QObjectStar:
#if QT_CONFIG(itemmodel)
case QMetaType::QModelIndex:
case QMetaType::QPersistentModelIndex:
#endif
case QMetaType::QJsonValue:
case QMetaType::QJsonObject:
case QMetaType::QJsonArray:

View File

@ -89,6 +89,14 @@ inline Q_DECL_CONSTEXPR int qMetaTypeId();
#define QT_FOR_EACH_STATIC_PRIMITIVE_POINTER(F)\
F(VoidStar, 31, void*) \
#if QT_CONFIG(itemmodel)
#define QT_FOR_EACH_STATIC_ITEMMODEL_CLASS(F)\
F(QModelIndex, 42, QModelIndex) \
F(QPersistentModelIndex, 50, QPersistentModelIndex)
#else
#define QT_FOR_EACH_STATIC_ITEMMODEL_CLASS(F)
#endif
#define QT_FOR_EACH_STATIC_CORE_CLASS(F)\
F(QChar, 7, QChar) \
F(QString, 10, QString) \
@ -112,13 +120,12 @@ inline Q_DECL_CONSTEXPR int qMetaTypeId();
F(QEasingCurve, 29, QEasingCurve) \
F(QUuid, 30, QUuid) \
F(QVariant, 41, QVariant) \
F(QModelIndex, 42, QModelIndex) \
F(QRegularExpression, 44, QRegularExpression) \
F(QJsonValue, 45, QJsonValue) \
F(QJsonObject, 46, QJsonObject) \
F(QJsonArray, 47, QJsonArray) \
F(QJsonDocument, 48, QJsonDocument) \
F(QPersistentModelIndex, 50, QPersistentModelIndex) \
QT_FOR_EACH_STATIC_ITEMMODEL_CLASS(F)
#define QT_FOR_EACH_STATIC_CORE_POINTER(F)\
F(QObjectStar, 39, QObject*)

View File

@ -201,8 +201,6 @@ template<> struct TypeDefinition<QJsonArray> { static const bool IsAvailable = f
template<> struct TypeDefinition<QJsonDocument> { static const bool IsAvailable = false; };
template<> struct TypeDefinition<QJsonObject> { static const bool IsAvailable = false; };
template<> struct TypeDefinition<QJsonValue> { static const bool IsAvailable = false; };
template<> struct TypeDefinition<QModelIndex> { static const bool IsAvailable = false; };
template<> struct TypeDefinition<QPersistentModelIndex> { static const bool IsAvailable = false; };
template<> struct TypeDefinition<QUrl> { static const bool IsAvailable = false; };
template<> struct TypeDefinition<QByteArrayList> { static const bool IsAvailable = false; };
#endif

View File

@ -56,8 +56,10 @@
#include "qurl.h"
#include "qlocale.h"
#include "quuid.h"
#ifndef QT_BOOTSTRAPPED
#if QT_CONFIG(itemmodel)
#include "qabstractitemmodel.h"
#endif
#ifndef QT_BOOTSTRAPPED
#include "qjsonvalue.h"
#include "qjsonobject.h"
#include "qjsonarray.h"
@ -393,6 +395,8 @@ static bool convert(const QVariant::Private *d, int t, void *result, bool *ok)
return false;
}
break;
#endif // QT_BOOTSTRAPPED
#if QT_CONFIG(itemmodel)
case QVariant::ModelIndex:
switch (d->type) {
case QVariant::PersistentModelIndex:
@ -411,7 +415,7 @@ static bool convert(const QVariant::Private *d, int t, void *result, bool *ok)
return false;
}
break;
#endif // QT_BOOTSTRAPPED
#endif // QT_CONFIG(itemmodel)
case QVariant::String: {
QString *str = static_cast<QString *>(result);
switch (d->type) {
@ -1952,12 +1956,6 @@ QVariant::QVariant(const QRegularExpression &re)
QVariant::QVariant(const QUuid &uuid)
: d(Uuid)
{ v_construct<QUuid>(&d, uuid); }
QVariant::QVariant(const QModelIndex &modelIndex)
: d(ModelIndex)
{ v_construct<QModelIndex>(&d, modelIndex); }
QVariant::QVariant(const QPersistentModelIndex &modelIndex)
: d(PersistentModelIndex)
{ v_construct<QPersistentModelIndex>(&d, modelIndex); }
QVariant::QVariant(const QJsonValue &jsonValue)
: d(QMetaType::QJsonValue)
{ v_construct<QJsonValue>(&d, jsonValue); }
@ -1971,6 +1969,14 @@ QVariant::QVariant(const QJsonDocument &jsonDocument)
: d(QMetaType::QJsonDocument)
{ v_construct<QJsonDocument>(&d, jsonDocument); }
#endif // QT_BOOTSTRAPPED
#if QT_CONFIG(itemmodel)
QVariant::QVariant(const QModelIndex &modelIndex)
: d(ModelIndex)
{ v_construct<QModelIndex>(&d, modelIndex); }
QVariant::QVariant(const QPersistentModelIndex &modelIndex)
: d(PersistentModelIndex)
{ v_construct<QPersistentModelIndex>(&d, modelIndex); }
#endif
/*!
Returns the storage type of the value stored in the variant.
@ -2668,21 +2674,7 @@ QRegularExpression QVariant::toRegularExpression() const
}
#endif // QT_CONFIG(regularexpression)
#ifndef QT_BOOTSTRAPPED
/*!
\since 5.0
Returns the variant as a QUuid if the variant has type()
\l QMetaType::QUuid, \l QMetaType::QByteArray or \l QMetaType::QString;
otherwise returns a default-constructed QUuid.
\sa canConvert(), convert()
*/
QUuid QVariant::toUuid() const
{
return qVariantToHelper<QUuid>(d, handlerManager);
}
#if QT_CONFIG(itemmodel)
/*!
\since 5.0
@ -2708,6 +2700,22 @@ QPersistentModelIndex QVariant::toPersistentModelIndex() const
{
return qVariantToHelper<QPersistentModelIndex>(d, handlerManager);
}
#endif // QT_CONFIG(itemmodel)
#ifndef QT_BOOTSTRAPPED
/*!
\since 5.0
Returns the variant as a QUuid if the variant has type()
\l QMetaType::QUuid, \l QMetaType::QByteArray or \l QMetaType::QString;
otherwise returns a default-constructed QUuid.
\sa canConvert(), convert()
*/
QUuid QVariant::toUuid() const
{
return qVariantToHelper<QUuid>(d, handlerManager);
}
/*!
\since 5.0
@ -3182,9 +3190,11 @@ bool QVariant::canConvert(int targetTypeId) const
if (d.type == targetTypeId)
return true;
#if QT_CONFIG(itemmodel)
if ((targetTypeId == QMetaType::QModelIndex && d.type == QMetaType::QPersistentModelIndex)
|| (targetTypeId == QMetaType::QPersistentModelIndex && d.type == QMetaType::QModelIndex))
return true;
#endif
if (targetTypeId == QMetaType::QVariantList
&& (d.type == QMetaType::QVariantList

View File

@ -165,8 +165,10 @@ class Q_CORE_EXPORT QVariant
Hash = QMetaType::QVariantHash,
EasingCurve = QMetaType::QEasingCurve,
Uuid = QMetaType::QUuid,
#if QT_CONFIG(itemmodel)
ModelIndex = QMetaType::QModelIndex,
PersistentModelIndex = QMetaType::QPersistentModelIndex,
#endif
LastCoreType = QMetaType::LastCoreType,
Font = QMetaType::QFont,
@ -255,13 +257,15 @@ class Q_CORE_EXPORT QVariant
QVariant(const QUrl &url);
QVariant(const QEasingCurve &easing);
QVariant(const QUuid &uuid);
QVariant(const QModelIndex &modelIndex);
QVariant(const QPersistentModelIndex &modelIndex);
QVariant(const QJsonValue &jsonValue);
QVariant(const QJsonObject &jsonObject);
QVariant(const QJsonArray &jsonArray);
QVariant(const QJsonDocument &jsonDocument);
#endif // QT_BOOTSTRAPPED
#if QT_CONFIG(itemmodel)
QVariant(const QModelIndex &modelIndex);
QVariant(const QPersistentModelIndex &modelIndex);
#endif
QVariant& operator=(const QVariant &other);
#ifdef Q_COMPILER_RVALUE_REFS
@ -329,13 +333,15 @@ class Q_CORE_EXPORT QVariant
QUrl toUrl() const;
QEasingCurve toEasingCurve() const;
QUuid toUuid() const;
QModelIndex toModelIndex() const;
QPersistentModelIndex toPersistentModelIndex() const;
QJsonValue toJsonValue() const;
QJsonObject toJsonObject() const;
QJsonArray toJsonArray() const;
QJsonDocument toJsonDocument() const;
#endif // QT_BOOTSTRAPPED
#if QT_CONFIG(itemmodel)
QModelIndex toModelIndex() const;
QPersistentModelIndex toPersistentModelIndex() const;
#endif
#ifndef QT_NO_DATASTREAM
void load(QDataStream &ds);