-
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathCreateIndexDialog.h
More file actions
42 lines (34 loc) · 1.14 KB
/
Copy pathCreateIndexDialog.h
File metadata and controls
42 lines (34 loc) · 1.14 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
#pragma once
#include <QDialog>
#include <QString>
#include <QStringList>
class QCheckBox;
class QComboBox;
class QLineEdit;
class QListWidget;
class Schema;
// Modal dialog for defining a new index: pick a table, an index name,
// which of that table's columns to include, and whether it's UNIQUE.
// Like CreateTableDialog, this only collects and validates input -
// MainWindow turns the result into a CREATE INDEX statement.
class CreateIndexDialog : public QDialog
{
Q_OBJECT
public:
// schema must outlive the dialog - MainWindow only ever constructs
// this on the stack right before calling exec(), so that's always true.
CreateIndexDialog(const Schema& schema, const QString& initialTable, QWidget* parent = nullptr);
QString indexName() const;
QString tableName() const;
QStringList selectedColumns() const;
bool isUnique() const;
private slots:
void onTableChanged(const QString& table);
private:
void accept() override;
const Schema& m_schema;
QLineEdit* m_nameEdit = nullptr;
QComboBox* m_tableCombo = nullptr;
QListWidget* m_columnsList = nullptr;
QCheckBox* m_uniqueCheck = nullptr;
};