diff options
| author | 2014-12-06 17:33:25 -0500 | |
|---|---|---|
| committer | 2014-12-06 17:33:25 -0500 | |
| commit | 7167ce41b61d2ba2cdb526777a4233eb84a3b66a (patch) | |
| tree | a35c14143716e1f2c98f808c81f89426045a946f /SQLiteStudio3/guiSQLiteStudio/constraints/tableforeignkeypanel.h | |
Imported Upstream version 2.99.6upstream/2.99.6
Diffstat (limited to 'SQLiteStudio3/guiSQLiteStudio/constraints/tableforeignkeypanel.h')
| -rw-r--r-- | SQLiteStudio3/guiSQLiteStudio/constraints/tableforeignkeypanel.h | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/SQLiteStudio3/guiSQLiteStudio/constraints/tableforeignkeypanel.h b/SQLiteStudio3/guiSQLiteStudio/constraints/tableforeignkeypanel.h new file mode 100644 index 0000000..cecc04a --- /dev/null +++ b/SQLiteStudio3/guiSQLiteStudio/constraints/tableforeignkeypanel.h @@ -0,0 +1,57 @@ +#ifndef TABLEFOREIGNKEYPANEL_H +#define TABLEFOREIGNKEYPANEL_H + +#include "constraintpanel.h" +#include "parser/ast/sqlitecreatetable.h" +#include "guiSQLiteStudio_global.h" +#include <QStringListModel> +#include <QWidget> + +namespace Ui { + class TableForeignKeyPanel; +} + +class QGridLayout; +class QSignalMapper; + +class GUI_API_EXPORT TableForeignKeyPanel : public ConstraintPanel +{ + Q_OBJECT + + public: + explicit TableForeignKeyPanel(QWidget *parent = 0); + ~TableForeignKeyPanel(); + + bool validate(); + void setDb(Db* value); + + protected: + void changeEvent(QEvent *e); + void constraintAvailable(); + void storeConfiguration(); + + private: + void init(); + void buildColumns(); + void buildColumn(SqliteCreateTable::Column* column, int row); + void readConstraint(); + void readTables(); + void readCondition(SqliteForeignKey::Condition* condition); + int getColumnIndex(const QString& colName); + void storeCondition(SqliteForeignKey::Condition::Action action, const QString& reaction); + void storeMatchCondition(const QString& reaction); + + Ui::TableForeignKeyPanel *ui = nullptr; + QGridLayout* columnsLayout = nullptr; + int totalColumns = 0; + QStringListModel fkColumnsModel; + QSignalMapper* columnSignalMapping = nullptr; + + private slots: + void updateState(); + void updateColumnState(int rowIdx, bool tableSelected); + void updateColumnState(int rowIdx); + void updateFkColumns(); +}; + +#endif // TABLEFOREIGNKEYPANEL_H |
