29#include <QVersionNumber>
31#include "moc_qgsexpressiontreeview.cpp"
33using namespace Qt::StringLiterals;
38 QString text = u
"<h3>%1</h3>\n<div class=\"description\"><p>%2</p></div>"_s
39 .arg( QCoreApplication::translate(
"relation_help",
"relation %1" ).arg( relation.
name() ), QObject::tr(
"Inserts the relation ID for the relation named '%1'." ).arg( relation.
name() ) );
41 text += u
"<h4>%1</h4><div class=\"description\"><pre>%2</pre></div>"_s.arg( QObject::tr(
"Current value" ), relation.
id() );
50 QString text = u
"<h3>%1</h3>\n<div class=\"description\"><p>%2</p></div>"_s
51 .arg( QCoreApplication::translate(
"layer_help",
"map layer %1" ).arg( layer->
name() ), QObject::tr(
"Inserts the layer ID for the layer named '%1'." ).arg( layer->
name() ) );
53 text += u
"<h4>%1</h4><div class=\"description\"><pre>%2</pre></div>"_s.arg( QObject::tr(
"Current value" ), layer->
id() );
61 QString text = u
"<h3>%1</h3>\n<div class=\"description\"><p>%2</p></div>"_s
62 .arg( QCoreApplication::translate(
"recent_expression_help",
"expression %1" ).arg( label ), QCoreApplication::translate(
"recent_expression_help",
"Recently used expression." ) );
64 text += u
"<h4>%1</h4><div class=\"description\"><pre>%2</pre></div>"_s.arg( QObject::tr(
"Expression" ), expression );
72 QString text = u
"<h3>%1</h3>\n<div class=\"description\"><p>%2</p></div>"_s.arg( QCoreApplication::translate(
"user_expression_help",
"expression %1" ).arg( label ), description );
74 text += u
"<h4>%1</h4><div class=\"description\"><pre>%2</pre></div>"_s.arg( QObject::tr(
"Expression" ), expression );
80QString
formatVariableHelp(
const QString &variable,
const QString &description,
bool showValue,
const QVariant &value )
82 QString text = u
"<h3>%1</h3>\n<div class=\"description\"><p>%2</p></div>"_s.arg( QCoreApplication::translate(
"variable_help",
"variable %1" ).arg( variable ), description );
86 QString valueString = !value.isValid() ? QCoreApplication::translate(
"variable_help",
"not set" ) : u
"<pre>%1</pre>"_s.arg(
QgsExpression::formatPreviewString( value ) );
88 text += u
"<h4>%1</h4><div class=\"description\"><p>%2</p></div>"_s.arg( QObject::tr(
"Current value" ), valueString );
102 : QTreeView( parent )
105 connect(
this, &QTreeView::doubleClicked,
this, &QgsExpressionTreeView::onDoubleClicked );
107 mModel = std::make_unique<QStandardItemModel>();
108 mProxyModel = std::make_unique<QgsExpressionItemSearchProxy>();
109 mProxyModel->setDynamicSortFilter(
true );
110 mProxyModel->setSourceModel( mModel.get() );
111 setModel( mProxyModel.get() );
112 setSortingEnabled(
true );
113 sortByColumn( 0, Qt::AscendingOrder );
115 setSelectionMode( QAbstractItemView::SelectionMode::SingleSelection );
117 setContextMenuPolicy( Qt::CustomContextMenu );
118 connect(
this, &QWidget::customContextMenuRequested,
this, &QgsExpressionTreeView::showContextMenu );
119 connect( selectionModel(), &QItemSelectionModel::currentChanged,
this, &QgsExpressionTreeView::currentItemChanged );
121 updateFunctionTree();
126 QModelIndex firstItem = mProxyModel->index( 0, 0, QModelIndex() );
127 setCurrentIndex( firstItem );
144 mExpressionContext = context;
145 updateFunctionTree();
153 mMenuProvider = provider;
158 updateFunctionTree();
166 QModelIndex idx = mProxyModel->mapToSource( currentIndex() );
184 updateFunctionTree();
190 mProxyModel->setFilterString( text );
191 if ( text.isEmpty() )
198 QModelIndex index = mProxyModel->index( 0, 0 );
199 if ( mProxyModel->hasChildren( index ) )
201 QModelIndex child = mProxyModel->index( 0, 0, index );
202 selectionModel()->setCurrentIndex( child, QItemSelectionModel::ClearAndSelect );
207void QgsExpressionTreeView::onDoubleClicked(
const QModelIndex &index )
209 QModelIndex idx = mProxyModel->mapToSource( index );
221void QgsExpressionTreeView::showContextMenu( QPoint pt )
223 QModelIndex idx = indexAt( pt );
224 idx = mProxyModel->mapToSource( idx );
225 QgsExpressionItem *item =
static_cast<QgsExpressionItem *
>( mModel->itemFromIndex( idx ) );
229 if ( !mMenuProvider )
232 QMenu *menu = mMenuProvider->createContextMenu( item );
235 menu->popup( mapToGlobal( pt ) );
238void QgsExpressionTreeView::currentItemChanged(
const QModelIndex &index,
const QModelIndex & )
241 QModelIndex idx = mProxyModel->mapToSource( index );
242 QgsExpressionItem *item =
static_cast<QgsExpressionItem *
>( mModel->itemFromIndex( idx ) );
249void QgsExpressionTreeView::updateFunctionTree()
252 mExpressionGroups.clear();
255 static const QList<QPair<QString, QString>> operators = QList<QPair<QString, QString>>()
256 << QPair<QString, QString>( u
"+"_s, u
" + "_s )
257 << QPair<QString, QString>( u
"-"_s, u
" - "_s )
258 << QPair<QString, QString>( u
"*"_s, u
" * "_s )
259 << QPair<QString, QString>( u
"/"_s, u
" / "_s )
260 << QPair<QString, QString>( u
"//"_s, u
" // "_s )
261 << QPair<QString, QString>( u
"%"_s, u
" % "_s )
262 << QPair<QString, QString>( u
"^"_s, u
" ^ "_s )
263 << QPair<QString, QString>( u
"="_s, u
" = "_s )
264 << QPair<QString, QString>( u
"~"_s, u
" ~ "_s )
265 << QPair<QString, QString>( u
">"_s, u
" > "_s )
266 << QPair<QString, QString>( u
"<"_s, u
" < "_s )
267 << QPair<QString, QString>( u
"<>"_s, u
" <> "_s )
268 << QPair<QString, QString>( u
"<="_s, u
" <= "_s )
269 << QPair<QString, QString>( u
">="_s, u
" >= "_s )
270 << QPair<QString, QString>( u
"[]"_s, u
"[]"_s )
271 << QPair<QString, QString>( u
"||"_s, u
" || "_s )
272 << QPair<QString, QString>( u
"BETWEEN"_s, u
" BETWEEN "_s )
273 << QPair<QString, QString>( u
"NOT BETWEEN"_s, u
" NOT BETWEEN "_s )
274 << QPair<QString, QString>( u
"IN"_s, u
" IN "_s )
275 << QPair<QString, QString>( u
"LIKE"_s, u
" LIKE "_s )
276 << QPair<QString, QString>( u
"ILIKE"_s, u
" ILIKE "_s )
277 << QPair<QString, QString>( u
"IS"_s, u
" IS "_s )
278 << QPair<QString, QString>( u
"IS NOT"_s, u
" IS NOT "_s )
279 << QPair<QString, QString>( u
"OR"_s, u
" OR "_s )
280 << QPair<QString, QString>( u
"AND"_s, u
" AND "_s )
281 << QPair<QString, QString>( u
"NOT"_s, u
" NOT "_s );
282 for (
const auto &name : operators )
287 QString casestring = u
"CASE WHEN condition THEN result END"_s;
300 for (
int i = 0; i < count; i++ )
303 QString name = func->
name();
304 if ( name.startsWith(
'_' ) )
314 if ( func->
params() != 0 )
316 else if ( !name.startsWith(
'$' ) )
319 registerItemForAllGroups(
330 loadExpressionContext();
334 const QString &group,
335 const QString &label,
336 const QString &expressionText,
337 const QString &helpText,
339 bool highlightedItem,
342 const QStringList &tags,
346 QgsExpressionItem *item =
new QgsExpressionItem( label, expressionText, helpText, type );
347 item->setData( label, Qt::UserRole );
351 item->setIcon( icon );
354 if ( mExpressionGroups.contains( group ) )
356 QgsExpressionItem *groupNode = mExpressionGroups.value( group );
357 groupNode->appendRow( item );
363 newgroupNode->setData( group, Qt::UserRole );
366 newgroupNode->appendRow( item );
367 newgroupNode->setBackground( QBrush( QColor( 150, 150, 150, 150 ) ) );
368 mModel->appendRow( newgroupNode );
369 mExpressionGroups.insert( group, newgroupNode );
372 if ( highlightedItem )
375 QgsExpressionItem *topLevelItem =
new QgsExpressionItem( label, expressionText, helpText, type );
376 topLevelItem->setData( label, Qt::UserRole );
378 QFont font = topLevelItem->font();
379 font.setBold(
true );
380 topLevelItem->setFont( font );
381 mModel->appendRow( topLevelItem );
386void QgsExpressionTreeView::registerItemForAllGroups(
387 const QStringList &groups,
const QString &label,
const QString &expressionText,
const QString &helpText,
QgsExpressionItem::ItemType type,
bool highlightedItem,
int sortOrder,
const QStringList &tags
390 const auto constGroups = groups;
391 for (
const QString &group : constGroups )
393 registerItem( group, label, expressionText, helpText, type, highlightedItem, sortOrder, QIcon(), tags );
397void QgsExpressionTreeView::loadExpressionContext()
399 QStringList variableNames = mExpressionContext.filteredVariableNames();
400 const auto constVariableNames = variableNames;
401 for (
const QString &variable : constVariableNames )
406 " @" + variable +
' ',
407 formatVariableHelp( variable, mExpressionContext.description( variable ),
true, mExpressionContext.variable( variable ) ),
409 mExpressionContext.isHighlightedVariable( variable )
414 QStringList contextFunctions = mExpressionContext.functionNames();
415 const auto constContextFunctions = contextFunctions;
416 for (
const QString &functionName : constContextFunctions )
418 QgsExpressionFunction *func = mExpressionContext.function( functionName );
419 QString name = func->
name();
420 if ( name.startsWith(
'_' ) )
422 if ( func->
params() != 0 )
424 registerItemForAllGroups(
430void QgsExpressionTreeView::loadLayers()
435 QMap<QString, QgsMapLayer *> layers = mProject->mapLayers();
436 QMap<QString, QgsMapLayer *>::const_iterator layerIt = layers.constBegin();
437 for ( ; layerIt != layers.constEnd(); ++layerIt )
440 QgsExpressionItem *parentItem
442 loadLayerFields( qobject_cast<QgsVectorLayer *>( layerIt.value() ), parentItem );
451 const QgsFields fields = layer->
fields();
452 for (
int fieldIdx = 0; fieldIdx < fields.
count(); ++fieldIdx )
454 const QgsField field = fields.
at( fieldIdx );
458 item->setData( label, Qt::UserRole );
463 item->setIcon( icon );
464 parentItem->appendRow( item );
470 for (
int i = 0; i < fields.
count(); ++i )
481 if ( mExpressionGroups.contains( u
"Fields and Values"_s ) )
484 node->removeRows( 0, node->rowCount() );
515 const QgsFields &fields = mLayer->fields();
520void QgsExpressionTreeView::loadRelations()
525 QMap<QString, QgsRelation> relations = mProject->relationManager()->relations();
526 QMap<QString, QgsRelation>::const_iterator relIt = relations.constBegin();
527 for ( ; relIt != relations.constEnd(); ++relIt )
529 registerItemForAllGroups( QStringList() << tr(
"Relations" ), relIt->name(), u
"'%1'"_s.arg( relIt->id() ),
formatRelationHelp( relIt.value() ) );
535 mRecentKey = collection;
536 QString name = tr(
"Recent (%1)" ).arg( collection );
537 if ( mExpressionGroups.contains( name ) )
540 node->removeRows( 0, node->rowCount() );
544 const QString location = u
"/expressions/recent/%1"_s.arg( collection );
545 const QStringList expressions = settings.
value( location ).toStringList();
547 for (
const QString &expression : expressions )
550 QString label = expression;
551 label.replace(
'\n',
' ' );
560 QString location = u
"/expressions/recent/%1"_s.arg( collection );
561 QStringList expressions = settings.
value( location ).toStringList();
562 expressions.removeAll( expressionText );
564 expressions.prepend( expressionText );
566 while ( expressions.count() > 20 )
568 expressions.pop_back();
571 settings.
setValue( location, expressions );
578 const QString location = u
"user"_s;
581 settings.
setValue( u
"expression"_s, expression );
582 settings.
setValue( u
"helpText"_s, helpText );
585 const QModelIndexList idxs { mModel->match( mModel->index( 0, 0 ), Qt::DisplayRole, label, 1, Qt::MatchFlag::MatchRecursive ) };
586 if ( !idxs.isEmpty() )
588 scrollTo( idxs.first() );
603 if ( mExpressionGroups.contains( u
"UserGroup"_s ) )
606 node->removeRows( 0, node->rowCount() );
610 const QString location = u
"user"_s;
616 for (
const auto &label : std::as_const( mUserExpressionLabels ) )
619 expression = settings.
value( u
"expression"_s ).toString();
628 return mUserExpressionLabels;
633 const QString group = u
"user"_s;
635 QJsonArray exportList;
637 exportObject { {
"qgis_version",
Qgis::version() }, {
"exported_at", QDateTime::currentDateTime().toString( Qt::ISODate ) }, {
"author",
QgsApplication::userFullName() }, {
"expressions", exportList } };
643 for (
const QString &label : std::as_const( mUserExpressionLabels ) )
647 const QString expression = settings.
value( u
"expression"_s ).toString();
648 const QString helpText = settings.
value( u
"helpText"_s ).toString();
649 const QJsonObject expressionObject { {
"name", label }, {
"type",
"expression" }, {
"expression", expression }, {
"group", group }, {
"description", helpText } };
650 exportList.push_back( expressionObject );
655 exportObject[u
"expressions"_s] = exportList;
656 QJsonDocument exportJson = QJsonDocument( exportObject );
664 if ( !expressionsDocument.isObject() )
667 QJsonObject expressionsObject = expressionsDocument.object();
670 if ( !expressionsObject[u
"qgis_version"_s].isString() || !expressionsObject[u
"exported_at"_s].isString() || !expressionsObject[u
"author"_s].isString() || !expressionsObject[u
"expressions"_s].isArray() )
674 QVersionNumber qgisJsonVersion = QVersionNumber::fromString( expressionsObject[u
"qgis_version"_s].toString() );
675 QVersionNumber qgisVersion = QVersionNumber::fromString(
Qgis::version() );
679 if ( qgisJsonVersion > qgisVersion )
681 QMessageBox::StandardButtons buttons = QMessageBox::Yes | QMessageBox::No;
682 switch ( QMessageBox::question(
684 tr(
"QGIS Version Mismatch" ),
686 "The imported expressions are from newer version of QGIS (%1) "
687 "and some of the expression might not work the current version (%2). "
688 "Are you sure you want to continue?"
690 .arg( qgisJsonVersion.toString(), qgisVersion.toString() ),
694 case QMessageBox::No:
697 case QMessageBox::Yes:
706 QStringList skippedExpressionLabels;
707 bool isApplyToAll =
false;
708 bool isOkToOverwrite =
false;
714 const QJsonArray expressions = expressionsObject[u
"expressions"_s].toArray();
715 for (
const QJsonValue &&expressionValue : expressions )
718 if ( !expressionValue.isObject() )
721 skippedExpressionLabels.append( expressionValue.toString() );
725 QJsonObject expressionObj = expressionValue.toObject();
728 if ( !expressionObj[u
"name"_s].isString()
729 || !expressionObj[u
"type"_s].isString()
730 || !expressionObj[u
"expression"_s].isString()
731 || !expressionObj[u
"group"_s].isString()
732 || !expressionObj[u
"description"_s].isString() )
735 if ( !expressionObj[u
"name"_s].toString().isEmpty() )
736 skippedExpressionLabels.append( expressionObj[u
"name"_s].toString() );
738 skippedExpressionLabels.append( expressionObj[u
"expression"_s].toString() );
744 if ( expressionObj[u
"type"_s].toString() !=
"expression"_L1 )
746 skippedExpressionLabels.append( expressionObj[u
"name"_s].toString() );
751 if ( expressionObj[u
"group"_s].toString() !=
"user"_L1 )
753 skippedExpressionLabels.append( expressionObj[u
"name"_s].toString() );
757 const QString label = expressionObj[u
"name"_s].toString();
758 const QString expression = expressionObj[u
"expression"_s].toString();
759 const QString helpText = expressionObj[u
"description"_s].toString();
762 if ( label.contains(
"\\"_L1 ) || label.contains(
'/' ) )
764 skippedExpressionLabels.append( expressionObj[u
"name"_s].toString() );
769 const QString oldExpression = settings.
value( u
"expression"_s ).toString();
773 if ( mUserExpressionLabels.contains( label ) && expression != oldExpression )
776 showMessageBoxConfirmExpressionOverwrite( isApplyToAll, isOkToOverwrite, label, oldExpression, expression );
778 if ( isOkToOverwrite )
782 skippedExpressionLabels.append( label );
794 if ( !skippedExpressionLabels.isEmpty() )
796 QStringList skippedExpressionLabelsQuoted;
797 skippedExpressionLabelsQuoted.reserve( skippedExpressionLabels.size() );
798 for (
const QString &skippedExpressionLabel : skippedExpressionLabels )
799 skippedExpressionLabelsQuoted.append( u
"'%1'"_s.arg( skippedExpressionLabel ) );
801 QMessageBox::information(
this, tr(
"Skipped Expression Imports" ), u
"%1\n%2"_s.arg( tr(
"The following expressions have been skipped:" ), skippedExpressionLabelsQuoted.join(
", "_L1 ) ) );
807 QList<QgsExpressionItem *> result;
808 const QList<QStandardItem *> found { mModel->findItems( label, Qt::MatchFlag::MatchRecursive ) };
809 result.reserve( found.size() );
810 std::transform( found.begin(), found.end(), std::back_inserter( result ), []( QStandardItem *item ) ->
QgsExpressionItem * { return static_cast<QgsExpressionItem *>( item ); } );
814void QgsExpressionTreeView::showMessageBoxConfirmExpressionOverwrite(
bool &isApplyToAll,
bool &isOkToOverwrite,
const QString &label,
const QString &oldExpression,
const QString &newExpression )
816 QMessageBox::StandardButtons buttons = QMessageBox::Yes | QMessageBox::YesToAll | QMessageBox::No | QMessageBox::NoToAll;
817 switch ( QMessageBox::question(
819 tr(
"Expression Overwrite" ),
821 "The expression with label '%1' was already defined."
822 "The old expression \"%2\" will be overwritten by \"%3\"."
823 "Are you sure you want to overwrite the expression?"
825 .arg( label, oldExpression, newExpression ),
829 case QMessageBox::NoToAll:
831 isOkToOverwrite =
false;
834 case QMessageBox::No:
835 isApplyToAll =
false;
836 isOkToOverwrite =
false;
839 case QMessageBox::YesToAll:
841 isOkToOverwrite =
true;
844 case QMessageBox::Yes:
845 isApplyToAll =
false;
846 isOkToOverwrite =
true;
863 setFilterCaseSensitivity( Qt::CaseInsensitive );
868 QModelIndex index = sourceModel()->index( source_row, 0, source_parent );
874 int count = sourceModel()->rowCount( index );
875 bool matchchild =
false;
876 for (
int i = 0; i < count; ++i )
888 const QString name = sourceModel()->data( index, Qt::DisplayRole ).toString();
889 if ( name.contains( mFilterString, Qt::CaseInsensitive ) )
895 return std::any_of( tags.begin(), tags.end(), [
this](
const QString &tag ) { return tag.contains( mFilterString, Qt::CaseInsensitive ); } );
900 mFilterString = string;
908 if ( leftSort != rightSort )
909 return leftSort < rightSort;
911 QString leftString = sourceModel()->data( left, Qt::DisplayRole ).toString();
912 QString rightString = sourceModel()->data( right, Qt::DisplayRole ).toString();
915 if ( leftString.startsWith(
'$' ) )
916 leftString = leftString.mid( 1 );
917 if ( rightString.startsWith(
'$' ) )
918 rightString = rightString.mid( 1 );
920 return QString::localeAwareCompare( leftString, rightString ) < 0;
static QString version()
Version string.
static QString userFullName()
Returns the user's operating system login account full display name.
static QgsExpressionContextScope * layerScope(const QgsMapLayer *layer)
Creates a new scope which contains variables and functions relating to a QgsMapLayer.
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
bool isContextual() const
Returns whether the function is only available if provided by a QgsExpressionContext object.
int params() const
The number of parameters this function takes.
QStringList groups() const
Returns a list of the groups the function belongs to.
virtual bool isDeprecated() const
Returns true if the function is deprecated and should not be presented as a valid option to users in ...
QString name() const
The name of the function.
const QString helpText() const
The help text for the function.
bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const override
void setFilterString(const QString &string)
Sets the search filter string.
bool lessThan(const QModelIndex &left, const QModelIndex &right) const override
QgsExpressionItemSearchProxy()
An expression item that can be used in the QgsExpressionBuilderWidget tree.
static const int LAYER_ID_ROLE
Layer ID role.
QString getExpressionText() const
static const int SEARCH_TAGS_ROLE
Search tags role.
static const int ITEM_TYPE_ROLE
Item type role.
static const int CUSTOM_SORT_ROLE
Custom sort order role.
QgsExpressionItem::ItemType getItemType() const
Gets the type of expression item, e.g., header, field, ExpressionNode.
static const int ITEM_NAME_ROLE
Item name role.
QgsProject * project()
Returns the project currently associated with the widget.
void refresh()
Refreshes the content of the tree.
void setProject(QgsProject *project)
Sets the project currently associated with the widget.
void saveToUserExpressions(const QString &label, const QString &expression, const QString &helpText)
Stores the user expression with given label and helpText.
QgsExpressionItem * currentItem() const
Returns the current item or a nullptr.
void setLayer(QgsVectorLayer *layer)
Sets layer in order to get the fields and values.
void setMenuProvider(MenuProvider *provider)
Sets the menu provider.
QStringList userExpressionLabels() const
Returns the user expression labels.
void expressionItemDoubleClicked(const QString &text)
Emitted when a expression item is double clicked.
void loadRecent(const QString &collection=u"generic"_s)
Loads the recent expressions from the given collection.
void currentExpressionItemChanged(QgsExpressionItem *item)
Emitter when the current expression item changed.
QJsonDocument exportUserExpressions()
Create the expressions JSON document storing all the user expressions to be exported.
QgsExpressionTreeView(QWidget *parent=nullptr)
Constructor.
void loadExpressionsFromJson(const QJsonDocument &expressionsDocument)
Load and permanently store the expressions from the expressions JSON document.
void saveToRecent(const QString &expressionText, const QString &collection="generic")
Adds the current expression to the given collection.
void setSearchText(const QString &text)
Sets the text to filter the expression tree.
void setExpressionContext(const QgsExpressionContext &context)
Sets the expression context for the tree view.
const QList< QgsExpressionItem * > findExpressions(const QString &label)
Returns the list of expression items matching a label.
void removeFromUserExpressions(const QString &label)
Removes the expression label from the user stored expressions.
void loadUserExpressions()
Loads the user expressions.
Q_DECL_DEPRECATED QStandardItemModel * model()
Returns a pointer to the dialog's function item model.
void loadFieldNames(const QgsFields &fields)
This allows loading fields without specifying a layer.
static const QList< QgsExpressionFunction * > & Functions()
static int functionCount()
Returns the number of functions defined in the parser.
static QString variableHelpText(const QString &variableName)
Returns the help text for a specified variable.
static QString formatPreviewString(const QVariant &value, bool htmlOutput=true, int maximumPreviewLength=60)
Formats an expression result for friendly display to the user.
static QStringList tags(const QString &name)
Returns a string list of search tags for a specified function.
static QString group(const QString &group)
Returns the translated name for a function group.
Encapsulate a field in an attribute table or data source.
QString displayNameWithAlias() const
Returns the name to use when displaying this field and adds the alias in parenthesis if it is defined...
Container of fields for a vector layer.
QgsField at(int i) const
Returns the field at particular index (must be in range 0..N-1).
QIcon iconForField(int fieldIdx, bool considerOrigin=false) const
Returns an icon corresponding to a field index, based on the field's type and source.
static QIcon iconForLayer(const QgsMapLayer *layer)
Returns the icon corresponding to a specified map layer.
Base class for all map layer types.
Encapsulates a QGIS project, including sets of map layers and their styles, layouts,...
Represents a relationship between two vector layers.
Stores settings for use within QGIS.
QStringList childGroups(Qgis::SettingsOrigin origin=Qgis::SettingsOrigin::Any) const
Returns a list of all key top-level groups that contain keys that can be read using the QSettings obj...
void endGroup()
Resets the group to what it was before the corresponding beginGroup() call.
QVariant value(const QString &key, const QVariant &defaultValue=QVariant(), Section section=NoSection) const
Returns the value for setting key.
void beginGroup(const QString &prefix, QgsSettings::Section section=QgsSettings::NoSection)
Appends prefix to the current group.
void remove(const QString &key, QgsSettings::Section section=QgsSettings::NoSection)
Removes the setting key and any sub-settings of key in a section.
void setValue(const QString &key, const QVariant &value, QgsSettings::Section section=QgsSettings::NoSection)
Sets the value of setting key to value.
Represents a vector layer which manages a vector based dataset.
QString formatLayerHelp(const QgsMapLayer *layer)
Returns a HTML formatted string for use as a layer item help.
QString formatUserExpressionHelp(const QString &label, const QString &expression, const QString &description)
Returns a HTML formatted string for use as a user expression item help.
QString formatVariableHelp(const QString &variable, const QString &description, bool showValue, const QVariant &value)
Returns a HTML formatted string for use as a variable item help.
QString formatRecentExpressionHelp(const QString &label, const QString &expression)
Returns a HTML formatted string for use as a recent expression item help.
QString formatRelationHelp(const QgsRelation &relation)
Returns a HTML formatted string for use as a relation item help.