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:
eelke 2018-08-26 07:59:15 +02:00
parent c6faafec59
commit ad4c6fd442
3 changed files with 92 additions and 22 deletions

View file

@ -53,9 +53,19 @@ TablesPage::TablesPage(MainWindow *parent)
ui->indexesTable->setItemDelegate(new PgLabItemDelegate(ui->indexesTable));
ui->indexesTable->setItemDelegateForColumn(0, delegate);
PropertyProxyModel* proxy_model = new PropertyProxyModel(this);
proxy_model->setSourceModel(m_tablesModel);
ui->tablePropertiesTable->setModel(proxy_model);
PropertyProxyModel* property_model = new PropertyProxyModel(this);
property_model->setSourceModel(m_tablesModel);
ui->tablePropertiesTable->setModel(property_model);
connect(ui->tableListTable->selectionModel(), &QItemSelectionModel::currentChanged,
[property_model](const QModelIndex &current, const QModelIndex &) {
int row = -1;
if (current.isValid())
row = current.row();
property_model->setActiveRow(row);
});
//m_namespaceFilterWidget = new NamespaceFilterWidget(this);
//ui->verticalLayoutTableView->addWidget(m_namespaceFilterWidget);