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;
126 bool lessThan(
const QModelIndex &left,
const QModelIndex &right )
const override;
171 void loadFieldNames(
const QgsFields &fields );
205 void setMenuProvider( MenuProvider *provider );
223 Q_DECL_DEPRECATED QStandardItemModel *model()
SIP_SKIP;
229 void loadRecent( const QString &collection = QStringLiteral( "generic" ) );
235 void saveToRecent( const QString &expressionText, const QString &collection = "generic" );
240 void saveToUserExpressions( const QString &label, const QString expression, const QString &helpText );
245 void removeFromUserExpressions( const QString &label );
251 void loadUserExpressions( );
261 QStringList userExpressionLabels() const
SIP_SKIP;
267 QJsonDocument exportUserExpressions();
273 void loadExpressionsFromJson( const QJsonDocument &expressionsDocument );
277 void expressionItemDoubleClicked( const QString &text );
284 void setSearchText( const QString &text );
288 void onDoubleClicked( const QModelIndex &index );
290 void showContextMenu( QPoint pt );
292 void currentItemChanged( const QModelIndex &index, const QModelIndex & );
295 void updateFunctionTree();
310 void registerItem( const QString &group, const QString &label, const QString &expressionText,
311 const QString &helpText = QString(),
313 bool highlightedItem = false,
int sortOrder = 1,
314 QIcon icon = QIcon(),
315 const QStringList &tags = QStringList(),
316 const QString &name = QString() );
329 void registerItemForAllGroups( const QStringList &groups, const QString &label, const QString &expressionText,
330 const QString &helpText = QString(),
332 bool highlightedItem = false,
int sortOrder = 1, const QStringList &tags = QStringList() );
334 void loadExpressionContext();
335 void loadRelations();
337 void loadFieldNames();
350 void showMessageBoxConfirmExpressionOverwrite(
bool &isApplyToAll,
bool &isOkToOverwrite, const QString &label, const QString &oldExpression, const QString &newExpression );
364 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.