19 #ifndef QGSSQLCOMPOSERDIALOG_H
20 #define QGSSQLCOMPOSERDIALOG_H
22 #include "ui_qgssqlcomposerdialogbase.h"
27 #include <QStringList>
73 virtual bool isValid(
const QString &sql, QString &errorReason, QString &warningMsg ) = 0;
85 Argument(
const QString &nameIn = QString(),
const QString &typeIn = QString() ) : name( nameIn ), type( typeIn ) {}
103 Function(
const QString &nameIn,
int args ) : name( nameIn ), minArgs( args ), maxArgs( args ) {}
105 Function(
const QString &nameIn,
int minArgs,
int maxArgsIn ) : name( nameIn ), minArgs( minArgs ), maxArgs( maxArgsIn ) {}
111 explicit QgsSQLComposerDialog( QWidget *parent =
nullptr, Qt::WindowFlags fl = QgsGuiUtils::ModalDialogFlags );
115 void setSql(
const QString &sql );
121 void addTableNames(
const QStringList &list );
123 void addTableNames(
const QList<PairNameTitle> &listNameTitle );
125 void addColumnNames(
const QStringList &list,
const QString &tableName );
127 void addColumnNames(
const QList<PairNameType> &list,
const QString &tableName );
129 void addOperators(
const QStringList &list );
131 void addSpatialPredicates(
const QStringList &list );
133 void addSpatialPredicates(
const QList<Function> &list );
135 void addFunctions(
const QStringList &list );
137 void addFunctions(
const QList<Function> &list );
139 void addApis(
const QStringList &list );
142 void setSupportMultipleTables(
bool bMultipleTables,
const QString &mainTypename = QString() );
158 bool eventFilter( QObject *obj, QEvent *event )
override;
161 void accept()
override;
163 void mTablesCombo_currentIndexChanged(
int );
164 void mColumnsCombo_currentIndexChanged(
int );
165 void mSpatialPredicatesCombo_currentIndexChanged(
int );
166 void mFunctionsCombo_currentIndexChanged(
int );
167 void mOperatorsCombo_currentIndexChanged(
int );
168 void mAddJoinButton_clicked();
169 void mRemoveJoinButton_clicked();
170 void mTableJoins_itemSelectionChanged();
173 void buildSQLFromFields();
174 void splitSQLIntoFields();
177 QStringList mApiList;
178 QSet<QString> mAlreadySelectedTables;
181 QObject *mFocusedObject =
nullptr;
182 bool mAlreadyModifyingFields =
false;
183 bool mDistinct =
false;
185 QMap<QString, QString> mapTableEntryTextToName;
186 QMap<QString, QString> mapColumnEntryTextToName;
187 QMap<QString, QString> mapSpatialPredicateEntryTextToName;
188 QMap<QString, QString> mapFunctionEntryTextToName;
189 QString lastSearchedText;
192 void loadTableColumns(
const QString &table );
193 void functionCurrentIndexChanged( QComboBox *combo,
194 const QMap<QString, QString> &mapEntryTextToName );
195 void getFunctionList(
const QList<Function> &list,
196 QStringList &listApi,
197 QStringList &listCombo,
198 QMap<QString, QString> &mapEntryTextToName );