diff --git a/pglab/HorizontalProxyModel.cpp b/pglab/PropertyProxyModel.cpp similarity index 58% rename from pglab/HorizontalProxyModel.cpp rename to pglab/PropertyProxyModel.cpp index f50f6f1..df4598c 100644 --- a/pglab/HorizontalProxyModel.cpp +++ b/pglab/PropertyProxyModel.cpp @@ -1,15 +1,15 @@ -#include "HorizontalProxyModel.h" +#include "PropertyProxyModel.h" /* * Code borrowed from: https://stackoverflow.com/questions/21653253/how-to-change-orientation-of-qt-tableview */ -HorizontalProxyModel::HorizontalProxyModel(QObject *parent) +PropertyProxyModel::PropertyProxyModel(QObject *parent) : QIdentityProxyModel(parent) { } -QModelIndex HorizontalProxyModel::mapToSource(const QModelIndex &proxyIndex) const +QModelIndex PropertyProxyModel::mapToSource(const QModelIndex &proxyIndex) const { if (sourceModel()) { return sourceModel()->index(proxyIndex.column(), proxyIndex.row()); @@ -19,32 +19,32 @@ QModelIndex HorizontalProxyModel::mapToSource(const QModelIndex &proxyIndex) con } } -QModelIndex HorizontalProxyModel::mapFromSource(const QModelIndex &sourceIndex) const +QModelIndex PropertyProxyModel::mapFromSource(const QModelIndex &sourceIndex) const { return index(sourceIndex.column(), sourceIndex.row()); } -QModelIndex HorizontalProxyModel::index(int row, int column, const QModelIndex &) const +QModelIndex PropertyProxyModel::index(int row, int column, const QModelIndex &) const { return createIndex(row, column, nullptr); } -QModelIndex HorizontalProxyModel::parent(const QModelIndex &) const +QModelIndex PropertyProxyModel::parent(const QModelIndex &) const { return QModelIndex(); } -int HorizontalProxyModel::rowCount(const QModelIndex &) const +int PropertyProxyModel::rowCount(const QModelIndex &) const { return sourceModel() ? sourceModel()->columnCount() : 0; } -int HorizontalProxyModel::columnCount(const QModelIndex &) const +int PropertyProxyModel::columnCount(const QModelIndex &) const { return sourceModel() ? sourceModel()->rowCount() : 0; } -QVariant HorizontalProxyModel::headerData( +QVariant PropertyProxyModel::headerData( int section, Qt::Orientation orientation, int role) const { if (!sourceModel()) { diff --git a/pglab/HorizontalProxyModel.h b/pglab/PropertyProxyModel.h similarity index 84% rename from pglab/HorizontalProxyModel.h rename to pglab/PropertyProxyModel.h index 5646a03..8587e50 100644 --- a/pglab/HorizontalProxyModel.h +++ b/pglab/PropertyProxyModel.h @@ -3,9 +3,9 @@ #include -class HorizontalProxyModel : public QIdentityProxyModel { +class PropertyProxyModel : public QIdentityProxyModel { public: - HorizontalProxyModel(QObject * parent = nullptr); + 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; diff --git a/pglab/TablesPage.cpp b/pglab/TablesPage.cpp index fe99126..1e31cf3 100644 --- a/pglab/TablesPage.cpp +++ b/pglab/TablesPage.cpp @@ -7,7 +7,7 @@ #include "ResultTableModelUtil.h" #include "ColumnTableModel.h" #include "ConstraintModel.h" -#include "HorizontalProxyModel.h" +#include "PropertyProxyModel.h" #include "IconColumnDelegate.h" #include "IndexModel.h" #include "SqlFormattingUtils.h" @@ -53,7 +53,7 @@ TablesPage::TablesPage(MainWindow *parent) ui->indexesTable->setItemDelegate(new PgLabItemDelegate(ui->indexesTable)); ui->indexesTable->setItemDelegateForColumn(0, delegate); - HorizontalProxyModel* proxy_model = new HorizontalProxyModel(this); + PropertyProxyModel* proxy_model = new PropertyProxyModel(this); proxy_model->setSourceModel(m_tablesModel); ui->tablePropertiesTable->setModel(proxy_model); diff --git a/pglab/pglab.pro b/pglab/pglab.pro index 52a6b07..c2d13f3 100644 --- a/pglab/pglab.pro +++ b/pglab/pglab.pro @@ -74,7 +74,7 @@ SOURCES += main.cpp\ EditorGutter.cpp \ CodeEditor.cpp \ PlgPage.cpp \ - HorizontalProxyModel.cpp + PropertyProxyModel.cpp HEADERS += \ QueryResultModel.h \ @@ -121,7 +121,7 @@ HEADERS += \ CodeEditor.h \ PlgPage.h \ AbstractCommand.h \ - HorizontalProxyModel.h + PropertyProxyModel.h FORMS += mainwindow.ui \ ConnectionManagerWindow.ui \