Compiles, links and runs (functionality not tested)
This commit is contained in:
parent
04723a289b
commit
6a97c0447a
48 changed files with 224 additions and 149 deletions
|
|
@ -1,72 +0,0 @@
|
|||
#include "typeselectionitemmodel.h"
|
||||
#include "PgTypeContainer.h"
|
||||
#include <algorithm>
|
||||
|
||||
TypeSelectionItemModel::TypeSelectionItemModel(QObject *parent)
|
||||
: QAbstractListModel(parent)
|
||||
{
|
||||
}
|
||||
|
||||
int TypeSelectionItemModel::rowCount(const QModelIndex &parent) const
|
||||
{
|
||||
int result = m_types.size();
|
||||
// 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) {
|
||||
//const PgType &tp = m_types->getByIdx(row);
|
||||
if (column == 0) {
|
||||
result = m_types[row]; //tp.typname;
|
||||
|
||||
// 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;
|
||||
}
|
||||
|
||||
void TypeSelectionItemModel::setTypeList(const PgTypeContainer* types)
|
||||
{
|
||||
beginResetModel();
|
||||
m_types.clear();
|
||||
for (const auto &e : *types) {
|
||||
if (e.typcategory != 'A'
|
||||
&& e.typtype != 'c') {
|
||||
m_types.push_back(e.typname);
|
||||
}
|
||||
}
|
||||
std::sort(m_types.begin(), m_types.end());
|
||||
//emit dataChanged(this->createIndex(0, 0), this->createIndex(types->count(), 0), QVector<int>() << Qt::DisplayRole);
|
||||
endResetModel();
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue