pgLab/typeselectionitemmodel.cpp
Eelke Klein 6370050204 Introduced the MasterController as part of working on loading catalogue information.
Need a central piece to manage the catalogue data per database to prevent loading
this multiple times. MasterController is now also used to enable reopening the
connection manager from a query window after the connection manager has been closed.
2017-02-01 18:01:02 +01:00

52 lines
1.1 KiB
C++

#include "typeselectionitemmodel.h"
TypeSelectionItemModel::TypeSelectionItemModel(QObject *parent)
: QAbstractListModel(parent)
{
}
int TypeSelectionItemModel::rowCount(const QModelIndex &parent) const
{
int result = 10;
// if (!parent.isValid()) {
// }
return result;
}
int TypeSelectionItemModel::columnCount(const QModelIndex &parent) const
{
int result = 1;
// if (parent.isValid())
// result = 1;
return result;
}
QVariant TypeSelectionItemModel::data(const QModelIndex &index, int role) const
{
QVariant result;
if (index.isValid()) {
int row = index.row();
int column = index.column();
if (role == Qt::DisplayRole) {
if (column == 0) {
switch (row) {
case 0: result = "integer"; break;
case 1: result = "numeric"; break;
case 2: result = "timestamp"; break;
case 3: result = "timestamptz"; break;
case 4: result = "float"; break;
case 5: result = "double"; break;
case 6: result = "date"; break;
case 7: result = "varchar"; break;
case 8: result = "varchar"; break;
case 9: result = "varchar"; break;
}
}
}
}
return result;
}