QConcatenateTablesProxyModel Class
Die Klasse QConcatenateTablesProxyModel vertritt mehrere Quellmodelle und verkettet deren Zeilen. Mehr...
Kopfzeile: | #include <QConcatenateTablesProxyModel> |
CMake: | find_package(Qt6 REQUIRED COMPONENTS Core) target_link_libraries(mytarget PRIVATE Qt6::Core) |
qmake: | QT += core |
Vererbungen: | QAbstractItemModel |
Öffentliche Funktionen
QConcatenateTablesProxyModel(QObject *parent = nullptr) | |
virtual | ~QConcatenateTablesProxyModel() |
void | addSourceModel(QAbstractItemModel *sourceModel) |
QModelIndex | mapFromSource(const QModelIndex &sourceIndex) const |
QModelIndex | mapToSource(const QModelIndex &proxyIndex) const |
void | removeSourceModel(QAbstractItemModel *sourceModel) |
QList<QAbstractItemModel *> | sourceModels() const |
Reimplementierte öffentliche Funktionen
virtual bool | canDropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent) const override |
virtual int | columnCount(const QModelIndex &parent = QModelIndex()) const override |
virtual QVariant | data(const QModelIndex &index, int role = Qt::DisplayRole) const override |
virtual bool | dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent) override |
virtual Qt::ItemFlags | flags(const QModelIndex &index) const override |
virtual QVariant | headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override |
virtual QModelIndex | index(int row, int column, const QModelIndex &parent = QModelIndex()) const override |
virtual QMap<int, QVariant> | itemData(const QModelIndex &proxyIndex) const override |
virtual QMimeData * | mimeData(const QModelIndexList &indexes) const override |
virtual QStringList | mimeTypes() const override |
virtual QModelIndex | parent(const QModelIndex &index) const override |
virtual int | rowCount(const QModelIndex &parent = QModelIndex()) const override |
virtual bool | setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) override |
virtual bool | setItemData(const QModelIndex &proxyIndex, const QMap<int, QVariant> &roles) override |
virtual QSize | span(const QModelIndex &index) const override |
Detaillierte Beschreibung
QConcatenateTablesProxyModel nimmt mehrere Quellmodelle und verkettet deren Zeilen.
Mit anderen Worten, der Proxy enthält alle Zeilen des ersten Quellmodells, gefolgt von allen Zeilen des zweiten Quellmodells und so weiter.
Wenn die Quellmodelle nicht die gleiche Anzahl von Spalten haben, hat die Stellvertreterin nur so viele Spalten wie das Quellmodell mit der geringsten Anzahl von Spalten. Zusätzliche Spalten in anderen Quellmodellen werden einfach ignoriert.
Quellmodelle können zur Laufzeit hinzugefügt und entfernt werden, und die Spaltenanzahl wird entsprechend angepasst.
Dieser Proxy erbt nicht von QAbstractProxyModel, da er mehrere Quellmodelle und nicht nur ein einziges verwendet.
Es werden nur flache Modelle (Listen und Tabellen) unterstützt, Baummodelle werden nicht unterstützt.
Siehe auch QAbstractProxyModel, Model/View Programming, QIdentityProxyModel, und QAbstractItemModel.
Dokumentation der Mitgliedsfunktionen
[explicit]
QConcatenateTablesProxyModel::QConcatenateTablesProxyModel(QObject *parent = nullptr)
Konstruiert ein concatenate-rows-Proxy-Modell mit dem angegebenen parent.
[virtual noexcept]
QConcatenateTablesProxyModel::~QConcatenateTablesProxyModel()
Zerstört dieses Proxy-Modell.
void QConcatenateTablesProxyModel::addSourceModel(QAbstractItemModel *sourceModel)
Fügt ein Quellmodell sourceModel unterhalb aller zuvor hinzugefügten Quellmodelle hinzu.
Der Besitz von sourceModel ist davon nicht betroffen.
Dasselbe Quellmodell kann nicht mehr als einmal hinzugefügt werden.
[override virtual]
bool QConcatenateTablesProxyModel::canDropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent) const
Reimplements: QAbstractItemModel::canDropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent) const.
[override virtual]
int QConcatenateTablesProxyModel::columnCount(const QModelIndex &parent = QModelIndex()) const
Reimplements: QAbstractItemModel::columnCount(const QModelIndex &parent) const.
Diese Methode gibt die Spaltenzahl des Quellmodells mit der kleinsten Spaltenzahl zurück.
[override virtual]
QVariant QConcatenateTablesProxyModel::data(const QModelIndex &index, int role = Qt::DisplayRole) const
Reimplements: QAbstractItemModel::data(const QModelIndex &index, int role) const.
Siehe auch setData().
[override virtual]
bool QConcatenateTablesProxyModel::dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent)
Reimplements: QAbstractItemModel::dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent).
QConcatenateTablesProxyModel behandelt das Ablegen auf einem Element, zwischen Elementen und nach dem letzten Element. In allen Fällen wird der Aufruf an das zugrunde liegende Quellmodell weitergeleitet. Beim Drop auf ein Element wird das Quellmodell für dieses Element aufgerufen. Beim Ablegen zwischen Elementen wird das Quellmodell unmittelbar unter der Ablegeposition aufgerufen. Beim Fallenlassen nach dem letzten Element wird das letzte Quellmodell aufgerufen.
[override virtual]
Qt::ItemFlags QConcatenateTablesProxyModel::flags(const QModelIndex &index) const
Reimplements: QAbstractItemModel::flags(const QModelIndex &index) const.
Gibt die Flags für den angegebenen Index zurück. Wenn index gültig ist, stammen die Flags aus dem Quellmodell für dieses index. Wenn index ungültig ist (z.B. um festzustellen, ob das Fallenlassen auf einen leeren Bereich in der Ansicht erlaubt ist), werden die Flags aus dem ersten Modell zurückgegeben.
[override virtual]
QVariant QConcatenateTablesProxyModel::headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const
Reimplements: QAbstractItemModel::headerData(int section, Qt::Orientation orientation, int role) const.
Diese Methode gibt die horizontalen Kopfdaten für das erste Quellmodell und die vertikalen Kopfdaten für das jeder Zeile entsprechende Quellmodell zurück.
[override virtual]
QModelIndex QConcatenateTablesProxyModel::index(int row, int column, const QModelIndex &parent = QModelIndex()) const
Reimplements: QAbstractItemModel::index(int row, int column, const QModelIndex &parent) const.
[override virtual]
QMap<int, QVariant> QConcatenateTablesProxyModel::itemData(const QModelIndex &proxyIndex) const
Reimplements: QAbstractItemModel::itemData(const QModelIndex &index) const.
Siehe auch setItemData().
QModelIndex QConcatenateTablesProxyModel::mapFromSource(const QModelIndex &sourceIndex) const
Gibt den Proxy-Index für ein gegebenes sourceIndex zurück, das aus einem beliebigen Quellmodell stammen kann.
QModelIndex QConcatenateTablesProxyModel::mapToSource(const QModelIndex &proxyIndex) const
Gibt den Quellindex für eine gegebene proxyIndex zurück.
[override virtual]
QMimeData *QConcatenateTablesProxyModel::mimeData(const QModelIndexList &indexes) const
Reimplements: QAbstractItemModel::mimeData(const QModelIndexList &indexes) const.
Der Aufruf wird an das Quellmodell des ersten Index in der Liste von indexes weitergeleitet.
Wichtig: Bitte beachten Sie, dass dieser Proxy nur das Ziehen einer einzelnen Zeile unterstützt. Der Aufruf mit Indizes aus mehreren Zeilen führt zu einem Fehler, da das Ziehen von Zeilen, die aus verschiedenen Quellmodellen stammen könnten, von diesem Proxy-Modell nicht generisch implementiert werden kann. Jedes Datenelement in der QMimeData muss zusammengeführt werden, was datentypspezifisch ist. Reimplementieren Sie diese Methode in einer Unterklasse, wenn Sie das Ziehen mehrerer Zeilen unterstützen wollen.
[override virtual]
QStringList QConcatenateTablesProxyModel::mimeTypes() const
Reimplements: QAbstractItemModel::mimeTypes() const.
Diese Methode gibt die Mime-Typen für das erste Quellmodell zurück.
[override virtual]
QModelIndex QConcatenateTablesProxyModel::parent(const QModelIndex &index) const
Reimplements: QAbstractItemModel::parent(const QModelIndex &index) const.
void QConcatenateTablesProxyModel::removeSourceModel(QAbstractItemModel *sourceModel)
Entfernt das Quellmodell sourceModel, das zuvor zu diesem Proxy hinzugefügt wurde.
Der Besitz von sourceModel ist davon nicht betroffen.
[override virtual]
int QConcatenateTablesProxyModel::rowCount(const QModelIndex &parent = QModelIndex()) const
Reimplements: QAbstractItemModel::rowCount(const QModelIndex &parent) const.
[override virtual]
bool QConcatenateTablesProxyModel::setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole)
Reimplements: QAbstractItemModel::setData(const QModelIndex &index, const QVariant &value, int role).
Siehe auch data().
[override virtual]
bool QConcatenateTablesProxyModel::setItemData(const QModelIndex &proxyIndex, const QMap<int, QVariant> &roles)
Reimplements: QAbstractItemModel::setItemData(const QModelIndex &index, const QMap<int, QVariant> &roles).
Siehe auch itemData().
QList<QAbstractItemModel *> QConcatenateTablesProxyModel::sourceModels() const
Gibt eine Liste der Modelle zurück, die als Quellmodelle für dieses Proxy-Modell hinzugefügt wurden.
[override virtual]
QSize QConcatenateTablesProxyModel::span(const QModelIndex &index) const
Reimplements: QAbstractItemModel::span(const QModelIndex &index) const.
© 2025 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.