16 #ifndef QGSEXPRESSIONTREEVIEW_H
17 #define QGSEXPRESSIONTREEVIEW_H
20 #include <QStandardItemModel>
21 #include <QSortFilterProxyModel>
49 const QString &expressionText,
50 const QString &helpText,
52 : QStandardItem( label )
54 mExpressionText = expressionText;
57 setData( itemType, ITEM_TYPE_ROLE );
61 const QString &expressionText,
63 : QStandardItem( label )
65 mExpressionText = expressionText;
67 setData( itemType, ITEM_TYPE_ROLE );
84 void setHelpText(
const QString &helpText ) { mHelpText = helpText; }
94 static const int CUSTOM_SORT_ROLE = Qt::UserRole + 1;
96 static const int ITEM_TYPE_ROLE = Qt::UserRole + 2;
98 static const int SEARCH_TAGS_ROLE = Qt::UserRole + 3;
100 static const int ITEM_NAME_ROLE = Qt::UserRole + 4;
103 QString mExpressionText;
122 bool filterAcceptsRow(
int source_row,
const QModelIndex &source_parent )
const override;
129 void setFilterString(
const QString &
string );
133 bool lessThan(
const QModelIndex &left,
const QModelIndex &right )
const override;
137 QString mFilterString;
182 void loadFieldNames(
const QgsFields &fields );
216 void setMenuProvider( MenuProvider *provider );
234 Q_DECL_DEPRECATED QStandardItemModel *model()
SIP_SKIP;
240 void loadRecent( const QString &collection = QStringLiteral( "generic" ) );
246 void saveToRecent( const QString &expressionText, const QString &collection = "generic" );
251 void saveToUserExpressions( const QString &label, const QString &expression, const QString &helpText );
256 void removeFromUserExpressions( const QString &label );
262 void loadUserExpressions( );
272 QStringList userExpressionLabels() const
SIP_SKIP;
278 QJsonDocument exportUserExpressions();
284 void loadExpressionsFromJson( const QJsonDocument &expressionsDocument );
288 void expressionItemDoubleClicked( const QString &text );
295 void setSearchText( const QString &text );
299 void onDoubleClicked( const QModelIndex &index );
301 void showContextMenu( QPoint pt );
303 void currentItemChanged( const QModelIndex &index, const QModelIndex & );
306 void updateFunctionTree();
321 void registerItem( const QString &group, const QString &label, const QString &expressionText,
322 const QString &helpText = QString(),
324 bool highlightedItem = false,
int sortOrder = 1,
325 const QIcon &icon = QIcon(),
326 const QStringList &tags = QStringList(),
327 const QString &name = QString() );
340 void registerItemForAllGroups( const QStringList &groups, const QString &label, const QString &expressionText,
341 const QString &helpText = QString(),
343 bool highlightedItem = false,
int sortOrder = 1, const QStringList &tags = QStringList() );
345 void loadExpressionContext();
346 void loadRelations();
348 void loadFieldNames();
361 void showMessageBoxConfirmExpressionOverwrite(
bool &isApplyToAll,
bool &isOkToOverwrite, const QString &label, const QString &oldExpression, const QString &newExpression );
375 QStringList mUserExpressionLabels;
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
Search proxy used to filter the QgsExpressionBuilderWidget tree.
An expression item that can be used in the QgsExpressionBuilderWidget tree.
void setHelpText(const QString &helpText)
Set the help text for the current item.
QString getExpressionText() const
QgsExpressionItem(const QString &label, const QString &expressionText, const QString &helpText, QgsExpressionItem::ItemType itemType=ExpressionNode)
QgsExpressionItem::ItemType getItemType() const
Gets the type of expression item, e.g., header, field, ExpressionNode.
QString getHelpText() const
Gets the help text that is associated with this expression item.
QgsExpressionItem(const QString &label, const QString &expressionText, QgsExpressionItem::ItemType itemType=ExpressionNode)
QgsExpressionTreeView is a tree view to list all expressions functions, variables and fields that can...
QgsExpressionContext expressionContext() const
Returns the expression context for the widget.
Container of fields for a vector layer.
Encapsulates a QGIS project, including sets of map layers and their styles, layouts,...
Represents a vector layer which manages a vector based data sets.
std::unique_ptr< GEOSGeometry, GeosDeleter > unique_ptr
Scoped GEOS pointer.