00001
00002
00003
00004
00005
00006
00007
00008 #ifndef QUERYEDITORDIALOG_H
00009 #define QUERYEDITORDIALOG_H
00010
00011 #include <QStringListModel>
00012
00013 #include "database.h"
00014 #include "ui_queryeditordialog.h"
00015
00016
00021 class TermEditor : public QWidget
00022 {
00023 Q_OBJECT
00024
00025 public:
00026 TermEditor(const FieldList & fieldList, QWidget * parent = 0);
00027
00028 QString selectedField();
00029 int selectedRelation();
00030 QString selectedValue();
00031
00032 private:
00033 QComboBox * fields;
00034 QComboBox * relations;
00035 QLineEdit * value;
00036 };
00037
00038
00044 class QueryStringModel : public QStringListModel
00045 {
00046 Q_OBJECT
00047
00048 public:
00049 QueryStringModel(QObject * parent = 0);
00051 Qt::ItemFlags flags (const QModelIndex & index) const;
00053 void clear();
00055 void append(const QString & value);
00056 };
00057
00058
00064 class QueryEditorDialog : public QDialog, public Ui::QueryEditorDialog
00065 {
00066 Q_OBJECT
00067
00068 public:
00073 QueryEditorDialog(QWidget * parent = 0);
00074 ~QueryEditorDialog();
00076 QString statement();
00077
00078 private:
00079 QString m_schema;
00080 QueryStringModel * columnModel;
00081 QueryStringModel * selectModel;
00082
00083 private slots:
00084 void tableSelected(const QString & table);
00085
00086 void moreTerms();
00087 void lessTerms();
00088
00089 void addAllSelect();
00090 void addSelect();
00091 void removeAllSelect();
00092 void removeSelect();
00093
00094 private:
00095 QString curTable;
00097 QVBoxLayout * termsLayout;
00098 };
00099
00100 #endif //QUERYEDITORDIALOG_H