1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281
|
/************************************************************************
* This file has been generated automatically from *
* *
* src/gui/qgsexpressiontreeview.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.py again *
************************************************************************/
class QgsExpressionItem : QStandardItem
{
%Docstring(signature="appended")
An expression item that can be used in the
:py:class:`QgsExpressionBuilderWidget` tree.
%End
%TypeHeaderCode
#include "qgsexpressiontreeview.h"
%End
public:
enum ItemType /BaseType=IntEnum/
{
Header,
Field,
ExpressionNode
};
QgsExpressionItem( const QString &label, const QString &expressionText, const QString &helpText, QgsExpressionItem::ItemType itemType = ExpressionNode );
QgsExpressionItem( const QString &label, const QString &expressionText, QgsExpressionItem::ItemType itemType = ExpressionNode );
QString getExpressionText() const;
QString getHelpText() const;
%Docstring
Gets the help text that is associated with this expression item.
:return: The help text.
%End
void setHelpText( const QString &helpText );
%Docstring
Set the help text for the current item
.. note::
The help text can be set as a html string.
%End
QgsExpressionItem::ItemType getItemType() const;
%Docstring
Gets the type of expression item, e.g., header, field, ExpressionNode.
:return: The QgsExpressionItem.ItemType
%End
static const int CUSTOM_SORT_ROLE;
static const int ITEM_TYPE_ROLE;
static const int SEARCH_TAGS_ROLE;
static const int ITEM_NAME_ROLE;
static const int LAYER_ID_ROLE;
};
class QgsExpressionItemSearchProxy : QSortFilterProxyModel
{
%Docstring(signature="appended")
Search proxy used to filter the :py:class:`QgsExpressionBuilderWidget`
tree. The default search for a tree model only searches top level this
will handle one level down
%End
%TypeHeaderCode
#include "qgsexpressiontreeview.h"
%End
public:
QgsExpressionItemSearchProxy();
virtual bool filterAcceptsRow( int source_row, const QModelIndex &source_parent ) const;
void setFilterString( const QString &string );
%Docstring
Sets the search filter ``string``.
.. versionadded:: 3.22
%End
protected:
virtual bool lessThan( const QModelIndex &left, const QModelIndex &right ) const;
};
class QgsExpressionTreeView : QTreeView
{
%Docstring(signature="appended")
:py:class:`QgsExpressionTreeView` is a tree view to list all expressions
functions, variables and fields that can be used in an expression.
.. seealso:: :py:class:`QgsExpressionBuilderWidget`
.. versionadded:: 3.14
%End
%TypeHeaderCode
#include "qgsexpressiontreeview.h"
%End
public:
class MenuProvider
{
%Docstring(signature="appended")
Implementation of this interface can be implemented to allow
QgsExpressionTreeView instance to provide custom context menus (opened
upon right-click).
.. versionadded:: 3.14
%End
%TypeHeaderCode
#include "qgsexpressiontreeview.h"
%End
public:
explicit MenuProvider();
virtual ~MenuProvider();
virtual QMenu *createContextMenu( QgsExpressionItem *item ) /Factory/;
%Docstring
Returns a newly created menu instance
%End
};
QgsExpressionTreeView( QWidget *parent = 0 );
%Docstring
Constructor
%End
void setLayer( QgsVectorLayer *layer );
%Docstring
Sets layer in order to get the fields and values
%End
void loadFieldNames( const QgsFields &fields );
%Docstring
This allows loading fields without specifying a layer
%End
void setExpressionContext( const QgsExpressionContext &context );
%Docstring
Sets the expression context for the tree view. The context is used to
populate the list of available functions and variables.
:param context: expression context
.. seealso:: :py:func:`expressionContext`
%End
QgsExpressionContext expressionContext() const;
%Docstring
Returns the expression context for the widget. The context is used for
the expression preview result and for populating the list of available
functions and variables.
.. seealso:: :py:func:`setExpressionContext`
%End
QgsProject *project();
%Docstring
Returns the project currently associated with the widget.
.. seealso:: :py:func:`setProject`
%End
void setProject( QgsProject *project );
%Docstring
Sets the ``project`` currently associated with the widget. This controls
which layers and relations and other project-specific items are shown in
the widget.
.. seealso:: :py:func:`project`
%End
void setMenuProvider( MenuProvider *provider );
%Docstring
Sets the menu provider. This does not take ownership of the provider
%End
void refresh();
%Docstring
Refreshes the content of the tree
%End
QgsExpressionItem *currentItem() const;
%Docstring
Returns the current item or a None
%End
void loadRecent( const QString &collection = QStringLiteral( "generic" ) );
%Docstring
Loads the recent expressions from the given ``collection``. By default
it is loaded from the collection "generic".
%End
void saveToRecent( const QString &expressionText, const QString &collection = "generic" );
%Docstring
Adds the current expression to the given ``collection``. By default it
is saved to the collection "generic".
%End
void saveToUserExpressions( const QString &label, const QString &expression, const QString &helpText );
%Docstring
Stores the user ``expression`` with given ``label`` and ``helpText``.
%End
void removeFromUserExpressions( const QString &label );
%Docstring
Removes the expression ``label`` from the user stored expressions.
%End
void loadUserExpressions();
%Docstring
Loads the user expressions. This is done on request since it can be very
slow if there are thousands of user expressions
%End
const QList<QgsExpressionItem *> findExpressions( const QString &label );
%Docstring
Returns the list of expression items matching a ``label``.
%End
QJsonDocument exportUserExpressions();
%Docstring
Create the expressions JSON document storing all the user expressions to
be exported.
:return: the created expressions JSON file
%End
void loadExpressionsFromJson( const QJsonDocument &expressionsDocument );
%Docstring
Load and permanently store the expressions from the expressions JSON
document.
:param expressionsDocument: the parsed expressions JSON file
%End
signals:
void expressionItemDoubleClicked( const QString &text );
%Docstring
Emitted when a expression item is double clicked
%End
void currentExpressionItemChanged( QgsExpressionItem *item );
%Docstring
Emitter when the current expression item changed
%End
public slots:
void setSearchText( const QString &text );
%Docstring
Sets the text to filter the expression tree
%End
};
/************************************************************************
* This file has been generated automatically from *
* *
* src/gui/qgsexpressiontreeview.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.py again *
************************************************************************/
|