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
42 .arg( QObject::tr(
"Current value" ), relation.
id() );
51 QString text = u
"<h3>%1</h3>\n<div class=\"description\"><p>%2</p></div>"_s
52 .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() ) );
54 text += u
"<h4>%1</h4><div class=\"description\"><pre>%2</pre></div>"_s
55 .arg( QObject::tr(
"Current value" ), layer->
id() );
63 QString text = u
"<h3>%1</h3>\n<div class=\"description\"><p>%2</p></div>"_s
64 .arg( QCoreApplication::translate(
"recent_expression_help",
"expression %1" ).arg( label ), QCoreApplication::translate(
"recent_expression_help",
"Recently used expression." ) );
66 text += u
"<h4>%1</h4><div class=\"description\"><pre>%2</pre></div>"_s
67 .arg( QObject::tr(
"Expression" ), expression );
75 QString text = u
"<h3>%1</h3>\n<div class=\"description\"><p>%2</p></div>"_s
76 .arg( QCoreApplication::translate(
"user_expression_help",
"expression %1" ).arg( label ), description );
78 text += u
"<h4>%1</h4><div class=\"description\"><pre>%2</pre></div>"_s
79 .arg( QObject::tr(
"Expression" ), expression );
85QString
formatVariableHelp(
const QString &variable,
const QString &description,
bool showValue,
const QVariant &value )
87 QString text = u
"<h3>%1</h3>\n<div class=\"description\"><p>%2</p></div>"_s
88 .arg( QCoreApplication::translate(
"variable_help",
"variable %1" ).arg( variable ), description );
92 QString valueString = !value.isValid()
93 ? QCoreApplication::translate(
"variable_help",
"not set" )
96 text += u
"<h4>%1</h4><div class=\"description\"><p>%2</p></div>"_s
97 .arg( QObject::tr(
"Current value" ), valueString );
111 : QTreeView( parent )
114 connect(
this, &QTreeView::doubleClicked,
this, &QgsExpressionTreeView::onDoubleClicked );
116 mModel = std::make_unique<QStandardItemModel>();
117 mProxyModel = std::make_unique<QgsExpressionItemSearchProxy>();
118 mProxyModel->setDynamicSortFilter(
true );
119 mProxyModel->setSourceModel( mModel.get() );
120 setModel( mProxyModel.get() );
121 setSortingEnabled(
true );
122 sortByColumn( 0, Qt::AscendingOrder );
124 setSelectionMode( QAbstractItemView::SelectionMode::SingleSelection );
126 setContextMenuPolicy( Qt::CustomContextMenu );
127 connect(
this, &QWidget::customContextMenuRequested,
this, &QgsExpressionTreeView::showContextMenu );
128 connect( selectionModel(), &QItemSelectionModel::currentChanged,
this, &QgsExpressionTreeView::currentItemChanged );
130 updateFunctionTree();
135 QModelIndex firstItem = mProxyModel->index( 0, 0, QModelIndex() );
136 setCurrentIndex( firstItem );
153 mExpressionContext = context;
154 updateFunctionTree();
162 mMenuProvider = provider;
167 updateFunctionTree();
175 QModelIndex idx = mProxyModel->mapToSource( currentIndex() );
193 updateFunctionTree();
199 mProxyModel->setFilterString( text );
200 if ( text.isEmpty() )
207 QModelIndex index = mProxyModel->index( 0, 0 );
208 if ( mProxyModel->hasChildren( index ) )
210 QModelIndex child = mProxyModel->index( 0, 0, index );
211 selectionModel()->setCurrentIndex( child, QItemSelectionModel::ClearAndSelect );
216void QgsExpressionTreeView::onDoubleClicked(
const QModelIndex &index )
218 QModelIndex idx = mProxyModel->mapToSource( index );
230void QgsExpressionTreeView::showContextMenu( QPoint pt )
232 QModelIndex idx = indexAt( pt );
233 idx = mProxyModel->mapToSource( idx );
234 QgsExpressionItem *item =
static_cast<QgsExpressionItem *
>( mModel->itemFromIndex( idx ) );
238 if ( !mMenuProvider )
241 QMenu *menu = mMenuProvider->createContextMenu( item );
244 menu->popup( mapToGlobal( pt ) );
247void QgsExpressionTreeView::currentItemChanged(
const QModelIndex &index,
const QModelIndex & )
250 QModelIndex idx = mProxyModel->mapToSource( index );
251 QgsExpressionItem *item =
static_cast<QgsExpressionItem *
>( mModel->itemFromIndex( idx ) );
258void QgsExpressionTreeView::updateFunctionTree()
261 mExpressionGroups.clear();
264 static const QList<QPair<QString, QString>> operators = QList<QPair<QString, QString>>()
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
"="_s, u
" = "_s )
273 << QPair<QString, QString>( u
"~"_s, u
" ~ "_s )
274 << QPair<QString, QString>( u
">"_s, u
" > "_s )
275 << QPair<QString, QString>( u
"<"_s, u
" < "_s )
276 << QPair<QString, QString>( u
"<>"_s, u
" <> "_s )
277 << QPair<QString, QString>( u
"<="_s, u
" <= "_s )
278 << QPair<QString, QString>( u
">="_s, u
" >= "_s )
279 << QPair<QString, QString>( u
"[]"_s, u
"[]"_s )
280 << QPair<QString, QString>( u
"||"_s, u
" || "_s )
281 << QPair<QString, QString>( u
"BETWEEN"_s, u
" BETWEEN "_s )
282 << QPair<QString, QString>( u
"NOT BETWEEN"_s, u
" NOT BETWEEN "_s )
283 << QPair<QString, QString>( u
"IN"_s, u
" IN "_s )
284 << QPair<QString, QString>( u
"LIKE"_s, u
" LIKE "_s )
285 << QPair<QString, QString>( u
"ILIKE"_s, u
" ILIKE "_s )
286 << QPair<QString, QString>( u
"IS"_s, u
" IS "_s )
287 << QPair<QString, QString>( u
"IS NOT"_s, u
" IS NOT "_s )
288 << QPair<QString, QString>( u
"OR"_s, u
" OR "_s )
289 << QPair<QString, QString>( u
"AND"_s, u
" AND "_s )
290 << QPair<QString, QString>( u
"NOT"_s, u
" NOT "_s );
291 for (
const auto &name : operators )
296 QString casestring = u
"CASE WHEN condition THEN result END"_s;
309 for (
int i = 0; i < count; i++ )
312 QString name = func->
name();
313 if ( name.startsWith(
'_' ) )
323 if ( func->
params() != 0 )
325 else if ( !name.startsWith(
'$' ) )
337 loadExpressionContext();
340QgsExpressionItem *QgsExpressionTreeView::registerItem(
const QString &group,
const QString &label,
const QString &expressionText,
const QString &helpText,
QgsExpressionItem::ItemType type,
bool highlightedItem,
int sortOrder,
const QIcon &icon,
const QStringList &tags,
const QString &name )
342 QgsExpressionItem *item =
new QgsExpressionItem( label, expressionText, helpText, type );
343 item->setData( label, Qt::UserRole );
347 item->setIcon( icon );
350 if ( mExpressionGroups.contains( group ) )
352 QgsExpressionItem *groupNode = mExpressionGroups.value( group );
353 groupNode->appendRow( item );
359 newgroupNode->setData( group, Qt::UserRole );
362 newgroupNode->appendRow( item );
363 newgroupNode->setBackground( QBrush( QColor( 150, 150, 150, 150 ) ) );
364 mModel->appendRow( newgroupNode );
365 mExpressionGroups.insert( group, newgroupNode );
368 if ( highlightedItem )
371 QgsExpressionItem *topLevelItem =
new QgsExpressionItem( label, expressionText, helpText, type );
372 topLevelItem->setData( label, Qt::UserRole );
374 QFont font = topLevelItem->font();
375 font.setBold(
true );
376 topLevelItem->setFont( font );
377 mModel->appendRow( topLevelItem );
382void QgsExpressionTreeView::registerItemForAllGroups(
const QStringList &groups,
const QString &label,
const QString &expressionText,
const QString &helpText,
QgsExpressionItem::ItemType type,
bool highlightedItem,
int sortOrder,
const QStringList &tags )
384 const auto constGroups = groups;
385 for (
const QString &group : constGroups )
387 registerItem( group, label, expressionText, helpText, type, highlightedItem, sortOrder, QIcon(), tags );
391void QgsExpressionTreeView::loadExpressionContext()
393 QStringList variableNames = mExpressionContext.filteredVariableNames();
394 const auto constVariableNames = variableNames;
395 for (
const QString &variable : constVariableNames )
397 registerItem( u
"Variables"_s, variable,
" @" + variable +
' ',
formatVariableHelp( variable, mExpressionContext.description( variable ),
true, mExpressionContext.variable( variable ) ),
QgsExpressionItem::ExpressionNode, mExpressionContext.isHighlightedVariable( variable ) );
401 QStringList contextFunctions = mExpressionContext.functionNames();
402 const auto constContextFunctions = contextFunctions;
403 for (
const QString &functionName : constContextFunctions )
405 QgsExpressionFunction *func = mExpressionContext.function( functionName );
406 QString name = func->
name();
407 if ( name.startsWith(
'_' ) )
409 if ( func->
params() != 0 )
415void QgsExpressionTreeView::loadLayers()
420 QMap<QString, QgsMapLayer *> layers = mProject->mapLayers();
421 QMap<QString, QgsMapLayer *>::const_iterator layerIt = layers.constBegin();
422 for ( ; layerIt != layers.constEnd(); ++layerIt )
426 loadLayerFields( qobject_cast<QgsVectorLayer *>( layerIt.value() ), parentItem );
435 const QgsFields fields = layer->
fields();
436 for (
int fieldIdx = 0; fieldIdx < fields.
count(); ++fieldIdx )
438 const QgsField field = fields.
at( fieldIdx );
442 item->setData( label, Qt::UserRole );
447 item->setIcon( icon );
448 parentItem->appendRow( item );
454 for (
int i = 0; i < fields.
count(); ++i )
465 if ( mExpressionGroups.contains( u
"Fields and Values"_s ) )
468 node->removeRows( 0, node->rowCount() );
499 const QgsFields &fields = mLayer->fields();
504void QgsExpressionTreeView::loadRelations()
509 QMap<QString, QgsRelation> relations = mProject->relationManager()->relations();
510 QMap<QString, QgsRelation>::const_iterator relIt = relations.constBegin();
511 for ( ; relIt != relations.constEnd(); ++relIt )
513 registerItemForAllGroups( QStringList() << tr(
"Relations" ), relIt->name(), u
"'%1'"_s.arg( relIt->id() ),
formatRelationHelp( relIt.value() ) );
519 mRecentKey = collection;
520 QString name = tr(
"Recent (%1)" ).arg( collection );
521 if ( mExpressionGroups.contains( name ) )
524 node->removeRows( 0, node->rowCount() );
528 const QString location = u
"/expressions/recent/%1"_s.arg( collection );
529 const QStringList expressions = settings.
value( location ).toStringList();
531 for (
const QString &expression : expressions )
534 QString label = expression;
535 label.replace(
'\n',
' ' );
544 QString location = u
"/expressions/recent/%1"_s.arg( collection );
545 QStringList expressions = settings.
value( location ).toStringList();
546 expressions.removeAll( expressionText );
548 expressions.prepend( expressionText );
550 while ( expressions.count() > 20 )
552 expressions.pop_back();
555 settings.
setValue( location, expressions );
562 const QString location = u
"user"_s;
565 settings.
setValue( u
"expression"_s, expression );
566 settings.
setValue( u
"helpText"_s, helpText );
569 const QModelIndexList idxs { mModel->match( mModel->index( 0, 0 ), Qt::DisplayRole, label, 1, Qt::MatchFlag::MatchRecursive ) };
570 if ( !idxs.isEmpty() )
572 scrollTo( idxs.first() );
587 if ( mExpressionGroups.contains( u
"UserGroup"_s ) )
590 node->removeRows( 0, node->rowCount() );
594 const QString location = u
"user"_s;
600 for (
const auto &label : std::as_const( mUserExpressionLabels ) )
603 expression = settings.
value( u
"expression"_s ).toString();
612 return mUserExpressionLabels;
617 const QString group = u
"user"_s;
619 QJsonArray exportList;
620 QJsonObject exportObject {
622 {
"exported_at", QDateTime::currentDateTime().toString( Qt::ISODate ) },
624 {
"expressions", exportList }
631 for (
const QString &label : std::as_const( mUserExpressionLabels ) )
635 const QString expression = settings.
value( u
"expression"_s ).toString();
636 const QString helpText = settings.
value( u
"helpText"_s ).toString();
637 const QJsonObject expressionObject {
639 {
"type",
"expression" },
640 {
"expression", expression },
642 {
"description", helpText }
644 exportList.push_back( expressionObject );
649 exportObject[u
"expressions"_s] = exportList;
650 QJsonDocument exportJson = QJsonDocument( exportObject );
658 if ( !expressionsDocument.isObject() )
661 QJsonObject expressionsObject = expressionsDocument.object();
664 if ( !expressionsObject[u
"qgis_version"_s].isString()
665 || !expressionsObject[u
"exported_at"_s].isString()
666 || !expressionsObject[u
"author"_s].isString()
667 || !expressionsObject[u
"expressions"_s].isArray() )
671 QVersionNumber qgisJsonVersion = QVersionNumber::fromString( expressionsObject[u
"qgis_version"_s].toString() );
672 QVersionNumber qgisVersion = QVersionNumber::fromString(
Qgis::version() );
676 if ( qgisJsonVersion > qgisVersion )
678 QMessageBox::StandardButtons buttons = QMessageBox::Yes | QMessageBox::No;
679 switch ( QMessageBox::question(
this, tr(
"QGIS Version Mismatch" ), tr(
"The imported expressions are from newer version of QGIS (%1) "
680 "and some of the expression might not work the current version (%2). "
681 "Are you sure you want to continue?" )
682 .arg( qgisJsonVersion.toString(), qgisVersion.toString() ),
685 case QMessageBox::No:
688 case QMessageBox::Yes:
697 QStringList skippedExpressionLabels;
698 bool isApplyToAll =
false;
699 bool isOkToOverwrite =
false;
705 const QJsonArray expressions = expressionsObject[u
"expressions"_s].toArray();
706 for (
const QJsonValue &&expressionValue : expressions )
709 if ( !expressionValue.isObject() )
712 skippedExpressionLabels.append( expressionValue.toString() );
716 QJsonObject expressionObj = expressionValue.toObject();
719 if ( !expressionObj[u
"name"_s].isString()
720 || !expressionObj[u
"type"_s].isString()
721 || !expressionObj[u
"expression"_s].isString()
722 || !expressionObj[u
"group"_s].isString()
723 || !expressionObj[u
"description"_s].isString() )
726 if ( !expressionObj[u
"name"_s].toString().isEmpty() )
727 skippedExpressionLabels.append( expressionObj[u
"name"_s].toString() );
729 skippedExpressionLabels.append( expressionObj[u
"expression"_s].toString() );
735 if ( expressionObj[u
"type"_s].toString() !=
"expression"_L1 )
737 skippedExpressionLabels.append( expressionObj[u
"name"_s].toString() );
742 if ( expressionObj[u
"group"_s].toString() !=
"user"_L1 )
744 skippedExpressionLabels.append( expressionObj[u
"name"_s].toString() );
748 const QString label = expressionObj[u
"name"_s].toString();
749 const QString expression = expressionObj[u
"expression"_s].toString();
750 const QString helpText = expressionObj[u
"description"_s].toString();
753 if ( label.contains(
"\\"_L1 ) || label.contains(
'/' ) )
755 skippedExpressionLabels.append( expressionObj[u
"name"_s].toString() );
760 const QString oldExpression = settings.
value( u
"expression"_s ).toString();
764 if ( mUserExpressionLabels.contains( label ) && expression != oldExpression )
767 showMessageBoxConfirmExpressionOverwrite( isApplyToAll, isOkToOverwrite, label, oldExpression, expression );
769 if ( isOkToOverwrite )
773 skippedExpressionLabels.append( label );
785 if ( !skippedExpressionLabels.isEmpty() )
787 QStringList skippedExpressionLabelsQuoted;
788 skippedExpressionLabelsQuoted.reserve( skippedExpressionLabels.size() );
789 for (
const QString &skippedExpressionLabel : skippedExpressionLabels )
790 skippedExpressionLabelsQuoted.append( u
"'%1'"_s.arg( skippedExpressionLabel ) );
792 QMessageBox::information(
this, tr(
"Skipped Expression Imports" ), u
"%1\n%2"_s.arg( tr(
"The following expressions have been skipped:" ), skippedExpressionLabelsQuoted.join(
", "_L1 ) ) );
798 QList<QgsExpressionItem *> result;
799 const QList<QStandardItem *> found { mModel->findItems( label, Qt::MatchFlag::MatchRecursive ) };
800 result.reserve( found.size() );
801 std::transform( found.begin(), found.end(), std::back_inserter( result ), []( QStandardItem *item ) ->
QgsExpressionItem * { return static_cast<QgsExpressionItem *>( item ); } );
805void QgsExpressionTreeView::showMessageBoxConfirmExpressionOverwrite(
807 bool &isOkToOverwrite,
808 const QString &label,
809 const QString &oldExpression,
810 const QString &newExpression
813 QMessageBox::StandardButtons buttons = QMessageBox::Yes | QMessageBox::YesToAll | QMessageBox::No | QMessageBox::NoToAll;
814 switch ( QMessageBox::question(
this, tr(
"Expression Overwrite" ), tr(
"The expression with label '%1' was already defined."
815 "The old expression \"%2\" will be overwritten by \"%3\"."
816 "Are you sure you want to overwrite the expression?" )
817 .arg( label, oldExpression, newExpression ),
820 case QMessageBox::NoToAll:
822 isOkToOverwrite =
false;
825 case QMessageBox::No:
826 isApplyToAll =
false;
827 isOkToOverwrite =
false;
830 case QMessageBox::YesToAll:
832 isOkToOverwrite =
true;
835 case QMessageBox::Yes:
836 isApplyToAll =
false;
837 isOkToOverwrite =
true;
854 setFilterCaseSensitivity( Qt::CaseInsensitive );
859 QModelIndex index = sourceModel()->index( source_row, 0, source_parent );
865 int count = sourceModel()->rowCount( index );
866 bool matchchild =
false;
867 for (
int i = 0; i < count; ++i )
879 const QString name = sourceModel()->data( index, Qt::DisplayRole ).toString();
880 if ( name.contains( mFilterString, Qt::CaseInsensitive ) )
886 return std::any_of( tags.begin(), tags.end(), [
this](
const QString &tag ) {
887 return tag.contains( mFilterString, Qt::CaseInsensitive );
893 mFilterString = string;
901 if ( leftSort != rightSort )
902 return leftSort < rightSort;
904 QString leftString = sourceModel()->data( left, Qt::DisplayRole ).toString();
905 QString rightString = sourceModel()->data( right, Qt::DisplayRole ).toString();
908 if ( leftString.startsWith(
'$' ) )
909 leftString = leftString.mid( 1 );
910 if ( rightString.startsWith(
'$' ) )
911 rightString = rightString.mid( 1 );
913 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.