-
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathCreateTableDialog.h
More file actions
41 lines (32 loc) · 923 Bytes
/
Copy pathCreateTableDialog.h
File metadata and controls
41 lines (32 loc) · 923 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#pragma once
#include <QDialog>
#include <QString>
#include <QVector>
class QLineEdit;
class QTableWidget;
// Modal dialog for defining a brand-new table: a name plus a list of
// columns (name / type / PRIMARY KEY / NOT NULL). MainWindow turns the
// result into a CREATE TABLE statement - this dialog only collects and
// validates the definition, it never touches the database itself.
class CreateTableDialog : public QDialog
{
Q_OBJECT
public:
struct ColumnDef
{
QString name;
QString type;
bool notNull = false;
bool primaryKey = false;
};
explicit CreateTableDialog(QWidget* parent = nullptr);
QString tableName() const;
QVector<ColumnDef> columns() const;
private slots:
void addColumnRow();
void removeSelectedRow();
private:
void accept() override;
QLineEdit* m_nameEdit = nullptr;
QTableWidget* m_columnsTable = nullptr;
};