diff --git a/pglab/CMakeLists.txt b/pglab/CMakeLists.txt index 8fd2b22..46ace2b 100644 --- a/pglab/CMakeLists.txt +++ b/pglab/CMakeLists.txt @@ -72,8 +72,6 @@ set(PGLAB_SOURCES EditTableWidget.cpp EditColumnTableModel.cpp DatabaseWindow.cpp - widgets/SingleRecordModel.cpp - widgets/SingleRecordWidget.cpp ) set(PGLAB_FORMS @@ -85,7 +83,6 @@ set(PGLAB_FORMS ProcessStdioWidget.ui crud/CrudTab.ui CodeGenerator.ui - widgets/SingleRecordWidget.ui ) add_executable(pglab diff --git a/pglab/widgets/SingleRecordModel.cpp b/pglab/widgets/SingleRecordModel.cpp deleted file mode 100644 index 18128e4..0000000 --- a/pglab/widgets/SingleRecordModel.cpp +++ /dev/null @@ -1,61 +0,0 @@ -#include "SingleRecordModel.h" -#include "CustomDataRole.h" - -SingleRecordModel::SingleRecordModel(QObject *parent) - : QAbstractTableModel(parent) -{ -} - -QVariant SingleRecordModel::headerData(int section, Qt::Orientation orientation, int role) const -{ - return {}; -} - -int SingleRecordModel::rowCount(const QModelIndex &parent) const -{ - if (parent.isValid()) - return 0; - - return elems.size(); -} - -int SingleRecordModel::columnCount(const QModelIndex &parent) const -{ - if (parent.isValid()) - return 0; - - return ColCount; -} - -QVariant SingleRecordModel::data(const QModelIndex &index, int role) const -{ - if (!index.isValid()) - return QVariant(); - - const int row = index.row(); - if (role == Qt::DisplayRole) - { - switch (index.column()) - { - case NameCol: - return elems[row].name; - case ValueCol: - return elems[row].value; - } - } - else if (role == CustomDataTypeRole) - { - switch (index.column()) - { - case NameCol: - return Pgsql::text_oid; - case ValueCol: - return elems[row].oid; - } - } - else if (role == CustomDataMeaningRole) - { - } - - return QVariant(); -} diff --git a/pglab/widgets/SingleRecordModel.h b/pglab/widgets/SingleRecordModel.h deleted file mode 100644 index 8107508..0000000 --- a/pglab/widgets/SingleRecordModel.h +++ /dev/null @@ -1,39 +0,0 @@ -#pragma once - -#include -#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; - Elems elems; -}; - diff --git a/pglab/widgets/SingleRecordWidget.cpp b/pglab/widgets/SingleRecordWidget.cpp deleted file mode 100644 index e617918..0000000 --- a/pglab/widgets/SingleRecordWidget.cpp +++ /dev/null @@ -1,14 +0,0 @@ -#include "SingleRecordWidget.h" -#include "ui_SingleRecordWidget.h" - -SingleRecordWidget::SingleRecordWidget(QWidget *parent) : - QWidget(parent), - ui(new Ui::SingleRecordWidget) -{ - ui->setupUi(this); -} - -SingleRecordWidget::~SingleRecordWidget() -{ - delete ui; -} diff --git a/pglab/widgets/SingleRecordWidget.h b/pglab/widgets/SingleRecordWidget.h deleted file mode 100644 index 29e4033..0000000 --- a/pglab/widgets/SingleRecordWidget.h +++ /dev/null @@ -1,20 +0,0 @@ -#pragma once - -#include - -namespace Ui { - class SingleRecordWidget; -} - -class SingleRecordWidget : public QWidget -{ - Q_OBJECT - -public: - explicit SingleRecordWidget(QWidget *parent = nullptr); - ~SingleRecordWidget(); - -private: - Ui::SingleRecordWidget *ui; -}; - diff --git a/pglab/widgets/SingleRecordWidget.ui b/pglab/widgets/SingleRecordWidget.ui deleted file mode 100644 index bfc73fd..0000000 --- a/pglab/widgets/SingleRecordWidget.ui +++ /dev/null @@ -1,31 +0,0 @@ - - - SingleRecordWidget - - - - 0 - 0 - 500 - 679 - - - - Form - - - - - - - - - - PgLabTableView - QTableView -
util/PgLabTableView.h
-
-
- - -