Introduced global enum to keep track of custom roles we want to use in our datamodels.
This commit is contained in:
parent
ad4c6fd442
commit
a4054ed789
4 changed files with 15 additions and 2 deletions
10
pglab/CustomDataRole.h
Normal file
10
pglab/CustomDataRole.h
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
#ifndef CUSTOMDATAROLE_H
|
||||||
|
#define CUSTOMDATAROLE_H
|
||||||
|
|
||||||
|
#include <Qt>
|
||||||
|
|
||||||
|
enum CustomDataRole {
|
||||||
|
CustomDataTypeRole = Qt::UserRole,
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // CUSTOMDATAROLE_H
|
||||||
|
|
@ -3,6 +3,7 @@
|
||||||
#include "PgIndexContainer.h"
|
#include "PgIndexContainer.h"
|
||||||
#include "Pgsql_oids.h"
|
#include "Pgsql_oids.h"
|
||||||
#include "ScopeGuard.h"
|
#include "ScopeGuard.h"
|
||||||
|
#include "CustomDataRole.h"
|
||||||
|
|
||||||
void IndexModel::setData(std::shared_ptr<const PgDatabaseCatalog> cat, const PgClass &table)
|
void IndexModel::setData(std::shared_ptr<const PgDatabaseCatalog> cat, const PgClass &table)
|
||||||
{
|
{
|
||||||
|
|
@ -96,7 +97,7 @@ QVariant IndexModel::data(const QModelIndex &index, int role) const
|
||||||
QVariant v;
|
QVariant v;
|
||||||
if (role == Qt::DisplayRole)
|
if (role == Qt::DisplayRole)
|
||||||
v = getData(index);
|
v = getData(index);
|
||||||
else if (role == Qt::UserRole)
|
else if (role == CustomDataTypeRole)
|
||||||
v = getType(index.column());
|
v = getType(index.column());
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -55,6 +55,7 @@ TablesPage::TablesPage(MainWindow *parent)
|
||||||
|
|
||||||
PropertyProxyModel* property_model = new PropertyProxyModel(this);
|
PropertyProxyModel* property_model = new PropertyProxyModel(this);
|
||||||
property_model->setSourceModel(m_tablesModel);
|
property_model->setSourceModel(m_tablesModel);
|
||||||
|
SetTableViewDefault(ui->tablePropertiesTable);
|
||||||
ui->tablePropertiesTable->setModel(property_model);
|
ui->tablePropertiesTable->setModel(property_model);
|
||||||
|
|
||||||
connect(ui->tableListTable->selectionModel(), &QItemSelectionModel::currentChanged,
|
connect(ui->tableListTable->selectionModel(), &QItemSelectionModel::currentChanged,
|
||||||
|
|
|
||||||
|
|
@ -121,7 +121,8 @@ HEADERS += \
|
||||||
CodeEditor.h \
|
CodeEditor.h \
|
||||||
PlgPage.h \
|
PlgPage.h \
|
||||||
AbstractCommand.h \
|
AbstractCommand.h \
|
||||||
PropertyProxyModel.h
|
PropertyProxyModel.h \
|
||||||
|
CustomDataRole.h
|
||||||
|
|
||||||
FORMS += mainwindow.ui \
|
FORMS += mainwindow.ui \
|
||||||
ConnectionManagerWindow.ui \
|
ConnectionManagerWindow.ui \
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue