19 #ifndef QGSSQLCOMPOSERDIALOG_H 20 #define QGSSQLCOMPOSERDIALOG_H 22 #include "ui_qgssqlcomposerdialogbase.h" 27 #include <QStringList> 60 virtual void tableSelected(
const QString &name ) = 0;
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() );
156 bool eventFilter( QObject *obj, QEvent *event )
override;
159 void accept()
override;
161 void mTablesCombo_currentIndexChanged(
int );
162 void mColumnsCombo_currentIndexChanged(
int );
163 void mSpatialPredicatesCombo_currentIndexChanged(
int );
164 void mFunctionsCombo_currentIndexChanged(
int );
165 void mOperatorsCombo_currentIndexChanged(
int );
166 void mAddJoinButton_clicked();
167 void mRemoveJoinButton_clicked();
168 void mTableJoins_itemSelectionChanged();
171 void buildSQLFromFields();
172 void splitSQLIntoFields();
175 QStringList mApiList;
176 QSet<QString> mAlreadySelectedTables;
179 QObject *mFocusedObject =
nullptr;
180 bool mAlreadyModifyingFields =
false;
181 bool mDistinct =
false;
183 QMap<QString, QString> mapTableEntryTextToName;
184 QMap<QString, QString> mapColumnEntryTextToName;
185 QMap<QString, QString> mapSpatialPredicateEntryTextToName;
186 QMap<QString, QString> mapFunctionEntryTextToName;
187 QString lastSearchedText;
190 void loadTableColumns(
const QString &table );
191 void functionCurrentIndexChanged( QComboBox *combo,
192 const QMap<QString, QString> &mapEntryTextToName );
193 void getFunctionList(
const QList<Function> &list,
194 QStringList &listApi,
195 QStringList &listCombo,
196 QMap<QString, QString> &mapEntryTextToName );
Function(const QString &nameIn, int args)
constructor with name and fixed number of arguments
Callback to do actions on table selection.
Function(const QString &nameIn, int minArgs, int maxArgsIn)
constructor with name and min,max number of arguments
QList< Argument > argumentList
list of arguments. May be empty despite minArgs > 0
QPair< QString, QString > PairNameTitle
pair (name, title)
QPair< QString, QString > PairNameType
pair (name, type)
description of server functions
Callback to do validation check on dialog validation.
QString returnType
return type, or empty if unknown
Argument(const QString &nameIn=QString(), const QString &typeIn=QString())
constructor
QString type
type, or empty if unknown