You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

87 lines
1.7 KiB

#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
#include <QtCore>
#include <QtGui>
#include <QtXml>
#include <QDebug>
QT_BEGIN_NAMESPACE
namespace Ui { class MainWindow; }
QT_END_NAMESPACE
class MainWindow : public QMainWindow
{
Q_OBJECT
enum eStateLevel: quint8
{
createRoot,
createDatabase,
createTable,
createField,
editDatabase,
editTable,
editField
};
enum eElementType:quint8
{
root,
database,
table,
field,
unknown
};
public:
MainWindow(QWidget *parent = nullptr);
~MainWindow();
private slots:
void on_actionCreate_Database_triggered();
void on_Append_btn_clicked();
void on_actionAdd_Table_triggered();
void on_actionAdd_Field_triggered();
void on_chbIsForignKey_stateChanged(int arg1);
void on_cmbTablsName_currentIndexChanged(int index);
void on_treeView_doubleClicked(const QModelIndex &index);
void on_cmbType_currentTextChanged(const QString &arg1);
void on_actionsave_triggered();
void on_actionEdit_Database_triggered();
private:
Ui::MainWindow *ui;
QStandardItemModel *_model;
QString _fileName;
int _state = 0;
QDomDocument _xmlDoc;
QString _xmlAddress;
QDomElement _root;
QVector<QString> _DBNameVector;
QVector<QDomElement> _DBElementVector;
QDomElement _lastDBElement;
QDomElement _lastTableElement;
QDomElement _lastFieldElement;
QDomElement* _lastDBPointer;
void readFile();
void readFile(QDomDocument xmlInput);
void writeFile();
void hideWidgets();
eElementType getElementType(QModelIndex indInput);
};
#endif // MAINWINDOW_H