Basic version of ConnectionTreeModel is working.
This commit is contained in:
parent
3721808df4
commit
8840d3bcbb
8 changed files with 348 additions and 3 deletions
|
|
@ -10,6 +10,48 @@
|
|||
#include "Expected.h"
|
||||
#include <QVector>
|
||||
|
||||
//#include <QSqlDatabase>
|
||||
class QSqlDatabase;
|
||||
|
||||
class ConnectionTreeModel : public QAbstractItemModel {
|
||||
Q_OBJECT
|
||||
public:
|
||||
enum Columns {
|
||||
Name,
|
||||
Host,
|
||||
Port,
|
||||
User,
|
||||
DbName,
|
||||
|
||||
ColCount
|
||||
};
|
||||
|
||||
ConnectionTreeModel(QObject *parent, QSqlDatabase &db);
|
||||
|
||||
void load();
|
||||
|
||||
QVariant data(const QModelIndex &index, int role) const override;
|
||||
|
||||
// Qt::ItemFlags flags(const QModelIndex &index) const override;
|
||||
|
||||
QVariant headerData(int section, Qt::Orientation orientation,
|
||||
int role = Qt::DisplayRole) const override;
|
||||
|
||||
QModelIndex index(int row, int column,
|
||||
const QModelIndex &parent = QModelIndex()) const override;
|
||||
|
||||
QModelIndex parent(const QModelIndex &index) const override;
|
||||
|
||||
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
|
||||
|
||||
int columnCount(const QModelIndex &parent = QModelIndex()) const override;
|
||||
|
||||
private:
|
||||
using Groups = QVector<std::shared_ptr<ConnectionGroup>>;
|
||||
|
||||
QSqlDatabase &m_db;
|
||||
Groups m_groups;
|
||||
};
|
||||
|
||||
/** \brief Model class for the list of connections.
|
||||
*
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue