start on view the show single record as list of label + value
This commit is contained in:
parent
c71fdc4af7
commit
4ac87f285b
4 changed files with 119 additions and 7 deletions
39
pglab/widgets/SingleRecordModel.h
Normal file
39
pglab/widgets/SingleRecordModel.h
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
#pragma once
|
||||
|
||||
#include <QAbstractTableModel>
|
||||
#include "Pgsql_oids.h"
|
||||
|
||||
class SingleRecordModel : public QAbstractTableModel
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit SingleRecordModel(QObject *parent = nullptr);
|
||||
|
||||
// Header:
|
||||
QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
|
||||
|
||||
// Basic functionality:
|
||||
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
|
||||
int columnCount(const QModelIndex &parent = QModelIndex()) const override;
|
||||
|
||||
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
|
||||
|
||||
private:
|
||||
enum Columns {
|
||||
NameCol,
|
||||
ValueCol,
|
||||
|
||||
ColCount
|
||||
};
|
||||
|
||||
class Elem {
|
||||
public:
|
||||
QString name;
|
||||
QString value;
|
||||
Oid oid;
|
||||
};
|
||||
using Elems = std::vector<Elem>;
|
||||
Elems elems;
|
||||
};
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue