41 #ifndef QABSTRACTITEMMODEL_H
42 #define QABSTRACTITEMMODEL_H
44 #include <QtCore/qhash.h>
45 #include <QtCore/qlist.h>
46 #include <QtCore/qobject.h>
47 #include <QtCore/qvariant.h>
63 constexpr
int role()
const noexcept {
return m_role; }
79 template <
typename T,
typename Enable =
void>
85 std::is_convertible<decltype( std::data(std::declval<T &>()) ), QModelRoleData *>,
87 std::is_convertible<decltype( std::size(std::declval<T &>()) ), qsizetype>,
90 typename std::iterator_traits<decltype( std::begin(std::declval<T &>()) )>::value_type,
94 decltype( std::begin(std::declval<T &>()) != std::end(std::declval<T &>()) ),
97 std::negation<std::is_same<std::decay_t<T>, QModelRoleDataSpan>>
98 >>> : std::true_type {};
106 template <
typename T>
113 : m_modelRoleData(&modelRoleData),
118 : m_modelRoleData(modelRoleData),
122 template <
typename Container, if_compatible_container<Container> = true>
137 #ifdef __cpp_lib_constexpr_algorithms
143 const auto e =
end();
145 if (
result->role() == role)
176 inline Qt::ItemFlags
flags()
const;
178 constexpr
inline bool isValid()
const noexcept {
return (
r >= 0) && (
c >= 0) && (
m !=
nullptr); }
182 {
return !(*
this ==
other); }
188 || (
i ==
other.i && std::less<const QAbstractItemModel *>()(
m,
other.m))))));
192 :
r(arow),
c(acolumn),
i(
reinterpret_cast<quintptr>(ptr)),
m(amodel) {}
194 :
r(arow),
c(acolumn),
i(
id),
m(amodel) {}
201 #ifndef QT_NO_DEBUG_STREAM
223 :
d(qExchange(
other.d,
nullptr)) {}
232 void *internalPointer()
const;
233 const void *constInternalPointer()
const;
239 Qt::ItemFlags
flags()
const;
241 bool isValid()
const;
246 {
return a.d ==
b.d; }
247 #ifndef QT_NO_DEBUG_STREAM
257 #ifndef QT_NO_DEBUG_STREAM
266 template <
class Key,
class T>
class QMap;
317 const QModelIndex &destinationParent,
int destinationChild);
319 const QModelIndex &destinationParent,
int destinationChild);
326 const QModelIndex &destinationParent,
int destinationChild);
328 const QModelIndex &destinationParent,
int destinationChild);
337 Qt::MatchFlags
flags =
355 IndexIsValid = 0x0001,
356 DoNotUseParent = 0x0002,
357 ParentIsInvalid = 0x0004,
451 const QModelIndex &destinationParent,
int destinationChild)
452 {
return moveRows(sourceParent, sourceRow, 1, destinationParent, destinationChild); }
454 const QModelIndex &destinationParent,
int destinationChild)
455 {
return moveColumns(sourceParent, sourceColumn, 1, destinationParent, destinationChild); }
457 {
return QModelIndex(arow, acolumn, adata,
this); }
532 {
if (
m)
m->multiData(*
this, roleDataSpan); }
535 {
return m ?
m->flags(*
this) : Qt::ItemFlags(); }
538 {
return size_t((
size_t(
index.row()) << 4) +
size_t(
index.column()) +
index.internalId()) ^ seed; }
small capitals from c petite p scientific i
[1]
The QAbstractItemModel class provides the abstract interface for item model classes.
virtual ~QAbstractItemModel()
void rowsMoved(const QModelIndex &parent, int start, int end, const QModelIndex &destination, int row, QPrivateSignal)
virtual Q_INVOKABLE QModelIndex parent(const QModelIndex &child) const =0
void modelAboutToBeReset(QPrivateSignal)
virtual Q_INVOKABLE QModelIndexList match(const QModelIndex &start, int role, const QVariant &value, int hits=1, Qt::MatchFlags flags=Qt::MatchFlags(Qt::MatchStartsWith|Qt::MatchWrap)) const
virtual bool insertColumns(int column, int count, const QModelIndex &parent=QModelIndex())
void columnsRemoved(const QModelIndex &parent, int first, int last, QPrivateSignal)
void rowsAboutToBeInserted(const QModelIndex &parent, int first, int last, QPrivateSignal)
void columnsAboutToBeInserted(const QModelIndex &parent, int first, int last, QPrivateSignal)
Q_INVOKABLE bool hasIndex(int row, int column, const QModelIndex &parent=QModelIndex()) const
void modelReset(QPrivateSignal)
QModelIndexList persistentIndexList() const
virtual void resetInternalData()
bool removeRow(int row, const QModelIndex &parent=QModelIndex())
void changePersistentIndex(const QModelIndex &from, const QModelIndex &to)
void changePersistentIndexList(const QModelIndexList &from, const QModelIndexList &to)
void layoutAboutToBeChanged(const QList< QPersistentModelIndex > &parents=QList< QPersistentModelIndex >(), QAbstractItemModel::LayoutChangeHint hint=QAbstractItemModel::NoLayoutChangeHint)
void dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight, const QList< int > &roles=QList< int >())
virtual Q_INVOKABLE int rowCount(const QModelIndex &parent=QModelIndex()) const =0
void columnsAboutToBeMoved(const QModelIndex &sourceParent, int sourceStart, int sourceEnd, const QModelIndex &destinationParent, int destinationColumn, QPrivateSignal)
bool moveColumn(const QModelIndex &sourceParent, int sourceColumn, const QModelIndex &destinationParent, int destinationChild)
virtual bool moveColumns(const QModelIndex &sourceParent, int sourceColumn, int count, const QModelIndex &destinationParent, int destinationChild)
virtual bool removeRows(int row, int count, const QModelIndex &parent=QModelIndex())
void columnsAboutToBeRemoved(const QModelIndex &parent, int first, int last, QPrivateSignal)
bool removeColumn(int column, const QModelIndex &parent=QModelIndex())
void layoutChanged(const QList< QPersistentModelIndex > &parents=QList< QPersistentModelIndex >(), QAbstractItemModel::LayoutChangeHint hint=QAbstractItemModel::NoLayoutChangeHint)
bool insertColumn(int column, const QModelIndex &parent=QModelIndex())
bool moveRow(const QModelIndex &sourceParent, int sourceRow, const QModelIndex &destinationParent, int destinationChild)
bool checkIndex(const QModelIndex &index, CheckIndexOptions options=CheckIndexOption::NoOption) const
void columnsMoved(const QModelIndex &parent, int start, int end, const QModelIndex &destination, int column, QPrivateSignal)
void headerDataChanged(Qt::Orientation orientation, int first, int last)
virtual bool removeColumns(int column, int count, const QModelIndex &parent=QModelIndex())
void rowsAboutToBeRemoved(const QModelIndex &parent, int first, int last, QPrivateSignal)
bool beginMoveColumns(const QModelIndex &sourceParent, int sourceFirst, int sourceLast, const QModelIndex &destinationParent, int destinationColumn)
void encodeData(const QModelIndexList &indexes, QDataStream &stream) const
virtual bool insertRows(int row, int count, const QModelIndex &parent=QModelIndex())
virtual bool moveRows(const QModelIndex &sourceParent, int sourceRow, int count, const QModelIndex &destinationParent, int destinationChild)
void rowsAboutToBeMoved(const QModelIndex &sourceParent, int sourceStart, int sourceEnd, const QModelIndex &destinationParent, int destinationRow, QPrivateSignal)
virtual Q_INVOKABLE int columnCount(const QModelIndex &parent=QModelIndex()) const =0
void rowsInserted(const QModelIndex &parent, int first, int last, QPrivateSignal)
bool decodeData(int row, int column, const QModelIndex &parent, QDataStream &stream)
QAbstractItemModel(QObject *parent=nullptr)
QModelIndex createIndex(int row, int column, const void *data=nullptr) const
void columnsInserted(const QModelIndex &parent, int first, int last, QPrivateSignal)
virtual Q_INVOKABLE QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const =0
virtual Q_INVOKABLE QModelIndex index(int row, int column, const QModelIndex &parent=QModelIndex()) const =0
void rowsRemoved(const QModelIndex &parent, int first, int last, QPrivateSignal)
The QAbstractListModel class provides an abstract model that can be subclassed to create one-dimensio...
The QAbstractProxyModel class provides a base class for proxy item models that can do sorting,...
QModelIndex buddy(const QModelIndex &index) const override
void fetchMore(const QModelIndex &parent) override
Qt::DropActions supportedDragActions() const override
QModelIndex sibling(int row, int column, const QModelIndex &idx) const override
QHash< int, QByteArray > roleNames() const override
bool dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent) override
bool setItemData(const QModelIndex &index, const QMap< int, QVariant > &roles) override
bool hasChildren(const QModelIndex &parent=QModelIndex()) const override
bool canFetchMore(const QModelIndex &parent) const override
bool clearItemData(const QModelIndex &index) override
QMap< int, QVariant > itemData(const QModelIndex &index) const override
void sort(int column, Qt::SortOrder order=Qt::AscendingOrder) override
QVariant headerData(int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const override
bool canDropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent) const override
Qt::DropActions supportedDropActions() const override
QStringList mimeTypes() const override
The QAbstractTableModel class provides an abstract model that can be subclassed to create table model...
The QDataStream class provides serialization of binary data to a QIODevice.
operator<<(QDataStream &ds, qfloat16 f)
The QDebug class provides an output stream for debugging information.
bool operator<(const QElapsedTimer &lhs, const QElapsedTimer &rhs) noexcept
template< typename Enum > bool operator!=(Enum lhs, QFlags< Enum > rhs)
template< typename Enum > size_t qHash(QFlags< Enum > flags, size_t seed=0) noexcept
template< typename Enum > bool operator==(Enum lhs, QFlags< Enum > rhs)
The QMimeData class provides a container for data that records information about its MIME type.
The QModelIndex class is used to locate data in a data model.
QModelIndex siblingAtColumn(int column) const
constexpr bool operator==(const QModelIndex &other) const noexcept
QVariant data(int role=Qt::DisplayRole) const
QModelIndex siblingAtRow(int row) const
constexpr int row() const noexcept
QModelIndex parent() const
constexpr const QAbstractItemModel * model() const noexcept
constexpr bool operator<(const QModelIndex &other) const noexcept
Qt::ItemFlags flags() const
constexpr QModelIndex() noexcept
constexpr int column() const noexcept
void * internalPointer() const noexcept
constexpr bool isValid() const noexcept
void multiData(QModelRoleDataSpan roleDataSpan) const
QModelIndex sibling(int row, int column) const
const void * constInternalPointer() const noexcept
constexpr bool operator!=(const QModelIndex &other) const noexcept
constexpr quintptr internalId() const noexcept
The QModelRoleData class holds a role and the data associated to that role.
constexpr const QVariant & data() const noexcept
void clearData() noexcept
constexpr QVariant & data() noexcept
constexpr int role() const noexcept
constexpr void setData(T &&value) noexcept(noexcept(m_data.setValue(std::forward< T >(value))))
QModelRoleData(int role) noexcept
The QModelRoleDataSpan class provides a span over QModelRoleData objects.
constexpr QModelRoleData & operator[](qsizetype index) const
constexpr qsizetype length() const noexcept
constexpr qsizetype size() const noexcept
constexpr QModelRoleDataSpan(QModelRoleData &modelRoleData) noexcept
constexpr QVariant * dataForRole(int role) const
constexpr QModelRoleDataSpan(Container &c) noexcept(noexcept(std::data(c)) &&noexcept(std::size(c)))
constexpr QModelRoleData * begin() const noexcept
constexpr QModelRoleData * end() const noexcept
constexpr QModelRoleDataSpan(QModelRoleData *modelRoleData, qsizetype len)
constexpr QModelRoleDataSpan() noexcept
constexpr QModelRoleData * data() const noexcept
The QObject class is the base class of all Qt objects.
The QPersistentModelIndex class is used to locate data in a data model.
bool operator!=(const QPersistentModelIndex &other) const
friend bool qHashEquals(const QPersistentModelIndex &a, const QPersistentModelIndex &b) noexcept
QPersistentModelIndex(QPersistentModelIndex &&other) noexcept
The QSize class defines the size of a two-dimensional object using integer point precision.
The QStringList class provides a list of strings.
The QVariant class acts like a union for the most common Qt data types.
void setValue(T &&avalue)
auto it unsigned count const
QT_REQUIRE_CONFIG(itemmodel)
Q_DECLARE_TYPEINFO(QModelRoleData, Q_RELOCATABLE_TYPE)
DBusConnection const char DBusError DBusBusType DBusError return DBusConnection DBusHandleMessageFunction void DBusFreeFunction return DBusConnection return DBusConnection return const char DBusError return DBusConnection DBusMessage dbus_uint32_t return DBusConnection dbus_bool_t DBusConnection DBusAddWatchFunction DBusRemoveWatchFunction DBusWatchToggledFunction void DBusFreeFunction return DBusConnection DBusDispatchStatusFunction void DBusFreeFunction DBusTimeout return DBusTimeout return DBusWatch return DBusWatch unsigned int return DBusError const DBusError return const DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessageIter int const void return DBusMessageIter DBusMessageIter return DBusMessageIter void DBusMessageIter void int return DBusMessage DBusMessageIter return DBusMessageIter return DBusMessageIter DBusMessageIter const char const char const char const char return DBusMessage return DBusMessage const char * destination
EGLOutputLayerEXT EGLint EGLAttrib value
#define Q_DECLARE_FLAGS(Flags, Enum)
#define Q_DECLARE_OPERATORS_FOR_FLAGS(Flags)
#define Q_DISABLE_COPY(Class)
#define QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(Class)
GLboolean GLboolean GLboolean b
GLboolean GLboolean GLboolean GLboolean a
[7]
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLenum GLenum GLsizei count
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
GLenum GLenum GLsizei void GLsizei void * column
GLenum GLenum GLsizei void * row
GLenum GLenum GLsizei void GLsizei void void * span
GLfixed GLfixed GLint GLint order
#define Q_DECLARE_SHARED(TYPE)
model setHeaderData(0, Qt::Horizontal, tr("Name"))
QSqlQueryModel * model
[16]
beginInsertRows(parent, 2, 4)
[0]
beginMoveRows(sourceParent, 2, 4, destinationParent, 2)
[5]
std::array< QModelRoleData, 3 > roleData
[13]
beginInsertColumns(parent, 4, 6)
[2]
beginRemoveColumns(parent, 4, 6)
[4]
beginRemoveRows(parent, 2, 3)
[1]
model multiData(index, span)
mimeData setData("text/csv", csvData)
IUIAutomationTreeWalker __RPC__deref_out_opt IUIAutomationElement ** parent