12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- #pragma once
- #if !defined(Q_MOC_RUN)
- #include <QtCore/QItemSelectionModel>
- #include <AzCore/std/containers/vector.h>
- #endif
- QT_FORWARD_DECLARE_CLASS(QAbstractProxyModel)
- namespace EMotionFX
- {
-
-
-
-
-
-
-
- class SelectionProxyModel
- : public QItemSelectionModel
- {
- Q_OBJECT
- public:
- SelectionProxyModel(QItemSelectionModel* sourceSelectionModel, QAbstractProxyModel* proxyModel, QObject* parent = nullptr);
- void setCurrentIndex(const QModelIndex &index, QItemSelectionModel::SelectionFlags command) override;
- void select(const QModelIndex &index, QItemSelectionModel::SelectionFlags command) override;
- void select(const QItemSelection &selection, QItemSelectionModel::SelectionFlags command) override;
- void clear() override;
- void reset() override;
- void clearCurrentIndex() override;
- private slots:
- void OnSourceSelectionChanged(const QItemSelection& selected, const QItemSelection& deselected);
- void OnSourceSelectionCurrentChanged(const QModelIndex& current, const QModelIndex& previous);
- void OnProxySelectionChanged(const QItemSelection& selected, const QItemSelection& deselected);
- void OnProxyModelRowsInserted(const QModelIndex& parent, int first, int last);
-
- private:
- QModelIndex mapFromSource(const QModelIndex& sourceIndex);
- QItemSelection mapFromSource(const QItemSelection& sourceSelection);
- QModelIndex mapToSource(const QModelIndex& targetIndex);
- QItemSelection mapToSource(const QItemSelection& targetSelection);
-
-
- AZStd::vector<QAbstractProxyModel*> m_proxyModels;
- QItemSelectionModel* m_sourceSelectionModel;
- };
- }
|