First step in using HorizontalProxyModel to show selected row in properties table.

HorizontalProxyModel now inherits from QIdentityProxyModel which provides a more complete base implementation (maybe to much?)
for now it seems to do what we want, forward relevant signals which the abstract base didn't.
Issues: Properties table needs formatting and shows all rows as columns instead of values of a single row.
This commit is contained in:
eelke 2018-08-26 07:11:46 +02:00
parent 49f009bdf9
commit 3080523b0d
4 changed files with 16 additions and 7 deletions

View file

@ -5,7 +5,7 @@
HorizontalProxyModel::HorizontalProxyModel(QObject *parent)
: QAbstractProxyModel(parent)
: QIdentityProxyModel(parent)
{
}

View file

@ -1,9 +1,9 @@
#ifndef HORIZONTALPROXYMODEL_H
#define HORIZONTALPROXYMODEL_H
#include <QAbstractProxyModel>
#include <QIdentityProxyModel>
class HorizontalProxyModel : public QAbstractProxyModel {
class HorizontalProxyModel : public QIdentityProxyModel {
public:
HorizontalProxyModel(QObject * parent = nullptr);
QModelIndex mapToSource(const QModelIndex &proxyIndex) const;

View file

@ -7,7 +7,7 @@
#include "ResultTableModelUtil.h"
#include "ColumnTableModel.h"
#include "ConstraintModel.h"
//#include "NamespaceFilterWidget.h"
#include "HorizontalProxyModel.h"
#include "IconColumnDelegate.h"
#include "IndexModel.h"
#include "SqlFormattingUtils.h"
@ -53,6 +53,10 @@ TablesPage::TablesPage(MainWindow *parent)
ui->indexesTable->setItemDelegate(new PgLabItemDelegate(ui->indexesTable));
ui->indexesTable->setItemDelegateForColumn(0, delegate);
HorizontalProxyModel* proxy_model = new HorizontalProxyModel(this);
proxy_model->setSourceModel(m_tablesModel);
ui->tablePropertiesTable->setModel(proxy_model);
//m_namespaceFilterWidget = new NamespaceFilterWidget(this);
//ui->verticalLayoutTableView->addWidget(m_namespaceFilterWidget);

View file

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>TablesPage</class>
<widget class="QWidget" name="TablesPage">
@ -13,7 +13,7 @@
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QSplitter" name="splitter">
<property name="orientation">
@ -38,7 +38,7 @@
</widget>
<widget class="QTabWidget" name="tabWidget">
<property name="currentIndex">
<number>0</number>
<number>3</number>
</property>
<widget class="QWidget" name="columnsTab">
<attribute name="title">
@ -90,6 +90,11 @@
<attribute name="title">
<string>Properties</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayoutProperties">
<item>
<widget class="QTableView" name="tablePropertiesTable"/>
</item>
</layout>
</widget>
<widget class="QWidget" name="statisticsTab">
<attribute name="title">