The PropertyProxyModel now properly maps the second column to the active row of the source.
It has a slot to receive the activeRow. Used this in the TablesPage to let the property tab follow the currentIndex in the list of tables.
This commit is contained in:
parent
c6faafec59
commit
ad4c6fd442
3 changed files with 92 additions and 22 deletions
|
|
@ -4,15 +4,27 @@
|
|||
#include <QIdentityProxyModel>
|
||||
|
||||
class PropertyProxyModel : public QIdentityProxyModel {
|
||||
Q_OBJECT
|
||||
public:
|
||||
PropertyProxyModel(QObject * parent = nullptr);
|
||||
QModelIndex mapToSource(const QModelIndex &proxyIndex) const;
|
||||
QModelIndex mapFromSource(const QModelIndex &sourceIndex) const;
|
||||
QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const;
|
||||
QModelIndex parent(const QModelIndex &child) const;
|
||||
int rowCount(const QModelIndex &parent) const;
|
||||
int columnCount(const QModelIndex &parent) const;
|
||||
QVariant headerData(int section, Qt::Orientation orientation, int role) const;
|
||||
PropertyProxyModel(QObject * parent = nullptr);
|
||||
QModelIndex mapToSource(const QModelIndex &proxyIndex) const;
|
||||
QModelIndex mapFromSource(const QModelIndex &sourceIndex) const;
|
||||
QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const;
|
||||
QModelIndex parent(const QModelIndex &child) const;
|
||||
int rowCount(const QModelIndex &parent) const;
|
||||
int columnCount(const QModelIndex &parent) const;
|
||||
QVariant headerData(int section, Qt::Orientation orientation, int role) const;
|
||||
QVariant data(const QModelIndex &proxyIndex, int role) const;
|
||||
|
||||
public Q_SLOTS:
|
||||
void setActiveRow(int row);
|
||||
|
||||
private:
|
||||
enum Columns {
|
||||
propertyColumn = 0,
|
||||
valueColumn
|
||||
};
|
||||
int activeRow = -1;
|
||||
};
|
||||
|
||||
#endif // HORIZONTALPROXYMODEL_H
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue