43 if ( attributeChanged )
45 if ( mRequiresFormScope )
54 return new QLabel( parent );
59 mWidget = qobject_cast<QLabel *>( editor );
65 mWidget->setOpenExternalLinks(
true );
67 const thread_local QRegularExpression sRegEx{ QStringLiteral(
"\\[%(.*?)%\\]" ), QRegularExpression::MultilineOption | QRegularExpression::DotMatchesEverythingOption };
69 mNeedsGeometry =
false;
70 QRegularExpressionMatchIterator matchIt { sRegEx.globalMatch( mText ) };
71 while ( !mNeedsGeometry && matchIt.hasNext() )
73 const QRegularExpressionMatch match { matchIt.next() };
75 mNeedsGeometry = exp.needsGeometry();
94 const thread_local QRegularExpression sRegEx( QStringLiteral(
"\\[%(.*?)%\\]" ), QRegularExpression::MultilineOption | QRegularExpression::DotMatchesEverythingOption );
95 QRegularExpressionMatchIterator matchIt = sRegEx.globalMatch( mText );
96 while ( !ok && matchIt.hasNext() )
98 const QRegularExpressionMatch match = matchIt.next();
102 mRequiresFormScope = ok;
109 return mNeedsGeometry;
112void QgsTextWidgetWrapper::updateTextContext( )
134 mFormFeature = feature;
This class contains context information for attribute editor widgets.
QString attributeFormModeString() const
Returns given attributeFormMode as string.
QgsFeature parentFormFeature() const
Returns the feature of the currently edited parent form in its actual state.
static QgsExpressionContextScope * parentFormScope(const QgsFeature &formFeature=QgsFeature(), const QString &formMode=QString())
Creates a new scope which contains functions and variables from the current parent attribute form/tab...
static QgsExpressionContextScope * formScope(const QgsFeature &formFeature=QgsFeature(), const QString &formMode=QString())
Creates a new scope which contains functions and variables from the current attribute form/table form...
void setFeature(const QgsFeature &feature)
Convenience function for setting a feature for the context.
Class for parsing and evaluation of expressions (formerly called "search strings").
static QString replaceExpressionText(const QString &action, const QgsExpressionContext *context, const QgsDistanceArea *distanceArea=nullptr)
This function replaces each expression between [% and %] in the string with the result of its evaluat...
The feature class encapsulates a single feature including its unique ID, geometry and a list of field...
Q_INVOKABLE bool setAttribute(int field, const QVariant &attr)
Sets an attribute's value by field index.
bool isValid() const
Returns the validity of this feature.
bool needsGeometry() const
Returns true if the widget needs feature geometry.
bool valid() const override
Returns true if the widget has been properly initialized.
QWidget * createWidget(QWidget *parent) override
This method should create a new widget with the provided parent.
void setText(const QString &text)
Sets the text code to htmlCode.
QgsTextWidgetWrapper(QgsVectorLayer *layer, QWidget *editor, QWidget *parent)
Create a text widget wrapper.
void reinitWidget()
Clears the content and makes new initialization.
void setFeature(const QgsFeature &feature) override
void initWidget(QWidget *editor) override
This method should initialize the editor widget with runtime data.
Represents a vector layer which manages a vector based data sets.
QgsExpressionContext createExpressionContext() const FINAL
This method needs to be reimplemented in all classes which implement this interface and return an exp...