forked from sqlitebrowser/sqlitebrowser
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEditTableDialog.h
More file actions
91 lines (75 loc) · 2.09 KB
/
EditTableDialog.h
File metadata and controls
91 lines (75 loc) · 2.09 KB
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
#ifndef EDITTABLEDIALOG_H
#define EDITTABLEDIALOG_H
#include "sql/ObjectIdentifier.h"
#include "sql/sqlitetypes.h"
#include <map>
#include <QDialog>
class DBBrowserDB;
class ForeignKeyEditorDelegate;
class QTableWidgetItem;
class QTreeWidgetItem;
namespace Ui {
class EditTableDialog;
}
class EditTableDialog : public QDialog
{
Q_OBJECT
public:
explicit EditTableDialog(DBBrowserDB& pdb, const sqlb::ObjectIdentifier& tableName, bool createTable, QWidget* parent = nullptr);
~EditTableDialog() override;
protected:
void keyPressEvent(QKeyEvent *evt) override;
private:
enum Columns {
kName = 0,
kType = 1,
kNotNull = 2,
kPrimaryKey = 3,
kAutoIncrement = 4,
kUnique = 5,
kDefault = 6,
kCheck = 7,
kCollation = 8,
kForeignKey = 9
};
enum ConstraintColumns {
kConstraintColumns = 0,
kConstraintType = 1,
kConstraintName = 2,
kConstraintSql = 3
};
void updateColumnWidth();
void updateSqlText();
void moveCurrentField(bool down);
private slots:
void populateFields();
void populateConstraints();
void addField();
void removeField();
void fieldSelectionChanged();
void accept() override;
void reject() override;
void checkInput();
void fieldItemChanged(QTreeWidgetItem* item, int column);
void constraintItemChanged(QTableWidgetItem* item);
void updateTypeAndCollation(QObject *object);
bool eventFilter(QObject *object, QEvent *event) override;
void updateTypeAndCollation();
void moveUp();
void moveDown();
void setWithoutRowid(bool without_rowid);
void changeSchema(const QString& schema);
void removeConstraint();
void addConstraint(sqlb::Constraint::ConstraintTypes type);
private:
Ui::EditTableDialog* ui;
DBBrowserDB& pdb;
ForeignKeyEditorDelegate* m_fkEditorDelegate;
sqlb::ObjectIdentifier curTable;
std::map<QString, QString> trackColumns;
sqlb::Table m_table;
bool m_bNewTable;
QString m_sRestorePointName;
QStringList m_collationList;
};
#endif