16 #ifndef QGSEXPRESSIONBUILDER_H
17 #define QGSEXPRESSIONBUILDER_H
20 #include "ui_qgsexpressionbuilder.h"
25 #include "QStandardItemModel"
26 #include "QStandardItem"
27 #include "QSortFilterProxyModel"
38 bool filterAcceptsRow(
int source_row,
const QModelIndex &source_parent )
const override
40 if ( source_parent == qobject_cast<QStandardItemModel*>( sourceModel() )->invisibleRootItem()->
index() )
60 QString expressionText,
63 : QStandardItem( label )
65 mExpressionText = expressionText;
71 QString expressionText,
73 : QStandardItem( label )
75 mExpressionText = expressionText;
90 void setHelpText( QString helpText ) { mHelpText = helpText; }
99 QString mExpressionText;
122 void loadFieldNames();
124 void loadFieldNames(
const QgsFields& fields );
131 QString expressionText();
134 void setExpressionText(
const QString& expression );
143 void registerItem( QString group, QString label, QString expressionText,
144 QString helpText =
"",
147 bool isExpressionValid();
149 void saveToRecent( QString key );
151 void loadRecent( QString key );
155 void newFunctionFile( QString fileName =
"scratch" );
159 void saveFunctionFile( QString fileName );
163 void loadCodeFromFile( QString path );
167 void loadFunctionCode( QString code );
171 void updateFunctionFileList( QString path );
174 void currentChanged(
const QModelIndex &
index,
const QModelIndex & );
175 void on_btnRun_pressed();
176 void on_btnNewFile_pressed();
177 void on_cmbFileNames_currentIndexChanged(
int index );
178 void on_btnSaveFile_pressed();
179 void on_expressionTree_doubleClicked(
const QModelIndex &index );
180 void on_txtExpressionString_textChanged();
181 void on_txtSearchEdit_textChanged();
182 void on_lblPreview_linkActivated( QString link );
183 void on_mValueListWidget_itemDoubleClicked( QListWidgetItem* item );
184 void operatorButtonClicked();
185 void showContextMenu(
const QPoint & );
186 void loadSampleValues();
187 void loadAllValues();
190 void setExpressionState(
bool state );
198 void expressionParsed(
bool isValid );
201 void runPythonCode( QString code );
202 void updateFunctionTree();
203 void fillFieldValues(
int fieldIndex,
int countLimit );
206 QString mFunctionsPath;
208 QStandardItemModel *mModel;
210 QMap<QString, QgsExpressionItem*> mExpressionGroups;
213 bool mExpressionValid;
217 #endif // QGSEXPRESSIONBUILDER_H