Renamed HorizontalProxyModel to PropertyProxyModel as the original name didn't reflect

what we are going to morph it into.
This commit is contained in:
eelke 2018-08-26 07:14:25 +02:00
parent 3080523b0d
commit c6faafec59
4 changed files with 15 additions and 15 deletions

View file

@ -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 * 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) : QIdentityProxyModel(parent)
{ {
} }
QModelIndex HorizontalProxyModel::mapToSource(const QModelIndex &proxyIndex) const QModelIndex PropertyProxyModel::mapToSource(const QModelIndex &proxyIndex) const
{ {
if (sourceModel()) { if (sourceModel()) {
return sourceModel()->index(proxyIndex.column(), proxyIndex.row()); 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()); 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); return createIndex(row, column, nullptr);
} }
QModelIndex HorizontalProxyModel::parent(const QModelIndex &) const QModelIndex PropertyProxyModel::parent(const QModelIndex &) const
{ {
return QModelIndex(); return QModelIndex();
} }
int HorizontalProxyModel::rowCount(const QModelIndex &) const int PropertyProxyModel::rowCount(const QModelIndex &) const
{ {
return sourceModel() ? sourceModel()->columnCount() : 0; return sourceModel() ? sourceModel()->columnCount() : 0;
} }
int HorizontalProxyModel::columnCount(const QModelIndex &) const int PropertyProxyModel::columnCount(const QModelIndex &) const
{ {
return sourceModel() ? sourceModel()->rowCount() : 0; return sourceModel() ? sourceModel()->rowCount() : 0;
} }
QVariant HorizontalProxyModel::headerData( QVariant PropertyProxyModel::headerData(
int section, Qt::Orientation orientation, int role) const int section, Qt::Orientation orientation, int role) const
{ {
if (!sourceModel()) { if (!sourceModel()) {

View file

@ -3,9 +3,9 @@
#include <QIdentityProxyModel> #include <QIdentityProxyModel>
class HorizontalProxyModel : public QIdentityProxyModel { class PropertyProxyModel : public QIdentityProxyModel {
public: public:
HorizontalProxyModel(QObject * parent = nullptr); PropertyProxyModel(QObject * parent = nullptr);
QModelIndex mapToSource(const QModelIndex &proxyIndex) const; QModelIndex mapToSource(const QModelIndex &proxyIndex) const;
QModelIndex mapFromSource(const QModelIndex &sourceIndex) const; QModelIndex mapFromSource(const QModelIndex &sourceIndex) const;
QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const; QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const;

View file

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

View file

@ -74,7 +74,7 @@ SOURCES += main.cpp\
EditorGutter.cpp \ EditorGutter.cpp \
CodeEditor.cpp \ CodeEditor.cpp \
PlgPage.cpp \ PlgPage.cpp \
HorizontalProxyModel.cpp PropertyProxyModel.cpp
HEADERS += \ HEADERS += \
QueryResultModel.h \ QueryResultModel.h \
@ -121,7 +121,7 @@ HEADERS += \
CodeEditor.h \ CodeEditor.h \
PlgPage.h \ PlgPage.h \
AbstractCommand.h \ AbstractCommand.h \
HorizontalProxyModel.h PropertyProxyModel.h
FORMS += mainwindow.ui \ FORMS += mainwindow.ui \
ConnectionManagerWindow.ui \ ConnectionManagerWindow.ui \