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;
304 for (
int i = 0; i < count; i++ )
307 QString name = func->
name();
308 if ( name.startsWith(
'_' ) )
318 if ( func->
params() != 0 )
320 else if ( !name.startsWith(
'$' ) )
332 loadExpressionContext();
335QgsExpressionItem *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 )
337 QgsExpressionItem *item =
new QgsExpressionItem( label, expressionText, helpText, type );
338 item->setData( label, Qt::UserRole );
342 item->setIcon( icon );
345 if ( mExpressionGroups.contains( group ) )
347 QgsExpressionItem *groupNode = mExpressionGroups.value( group );
348 groupNode->appendRow( item );
354 newgroupNode->setData( group, Qt::UserRole );
357 newgroupNode->appendRow( item );
358 newgroupNode->setBackground( QBrush( QColor( 150, 150, 150, 150 ) ) );
359 mModel->appendRow( newgroupNode );
360 mExpressionGroups.insert( group, newgroupNode );
363 if ( highlightedItem )
366 QgsExpressionItem *topLevelItem =
new QgsExpressionItem( label, expressionText, helpText, type );
367 topLevelItem->setData( label, Qt::UserRole );
369 QFont font = topLevelItem->font();
370 font.setBold(
true );
371 topLevelItem->setFont( font );
372 mModel->appendRow( topLevelItem );
377void QgsExpressionTreeView::registerItemForAllGroups(
const QStringList &groups,
const QString &label,
const QString &expressionText,
const QString &helpText,
QgsExpressionItem::ItemType type,
bool highlightedItem,
int sortOrder,
const QStringList &tags )
379 const auto constGroups = groups;
380 for (
const QString &group : constGroups )
382 registerItem( group, label, expressionText, helpText, type, highlightedItem, sortOrder, QIcon(), tags );
386void QgsExpressionTreeView::loadExpressionContext()
388 QStringList variableNames = mExpressionContext.filteredVariableNames();
389 const auto constVariableNames = variableNames;
390 for (
const QString &variable : constVariableNames )
392 registerItem( u
"Variables"_s, variable,
" @" + variable +
' ',
formatVariableHelp( variable, mExpressionContext.description( variable ),
true, mExpressionContext.variable( variable ) ),
QgsExpressionItem::ExpressionNode, mExpressionContext.isHighlightedVariable( variable ) );
396 QStringList contextFunctions = mExpressionContext.functionNames();
397 const auto constContextFunctions = contextFunctions;
398 for (
const QString &functionName : constContextFunctions )
400 QgsExpressionFunction *func = mExpressionContext.function( functionName );
401 QString name = func->
name();
402 if ( name.startsWith(
'_' ) )
404 if ( func->
params() != 0 )
410void QgsExpressionTreeView::loadLayers()
415 QMap<QString, QgsMapLayer *> layers = mProject->mapLayers();
416 QMap<QString, QgsMapLayer *>::const_iterator layerIt = layers.constBegin();
417 for ( ; layerIt != layers.constEnd(); ++layerIt )
421 loadLayerFields( qobject_cast<QgsVectorLayer *>( layerIt.value() ), parentItem );
430 const QgsFields fields = layer->
fields();
431 for (
int fieldIdx = 0; fieldIdx < fields.
count(); ++fieldIdx )
433 const QgsField field = fields.
at( fieldIdx );
437 item->setData( label, Qt::UserRole );
442 item->setIcon( icon );
443 parentItem->appendRow( item );
449 for (
int i = 0; i < fields.
count(); ++i )
460 if ( mExpressionGroups.contains( u
"Fields and Values"_s ) )
463 node->removeRows( 0, node->rowCount() );
494 const QgsFields &fields = mLayer->fields();
499void QgsExpressionTreeView::loadRelations()
504 QMap<QString, QgsRelation> relations = mProject->relationManager()->relations();
505 QMap<QString, QgsRelation>::const_iterator relIt = relations.constBegin();
506 for ( ; relIt != relations.constEnd(); ++relIt )
508 registerItemForAllGroups( QStringList() << tr(
"Relations" ), relIt->name(), u
"'%1'"_s.arg( relIt->id() ),
formatRelationHelp( relIt.value() ) );
514 mRecentKey = collection;
515 QString name = tr(
"Recent (%1)" ).arg( collection );
516 if ( mExpressionGroups.contains( name ) )
519 node->removeRows( 0, node->rowCount() );
523 const QString location = u
"/expressions/recent/%1"_s.arg( collection );
524 const QStringList expressions = settings.
value( location ).toStringList();
526 for (
const QString &expression : expressions )
529 QString label = expression;
530 label.replace(
'\n',
' ' );
539 QString location = u
"/expressions/recent/%1"_s.arg( collection );
540 QStringList expressions = settings.
value( location ).toStringList();
541 expressions.removeAll( expressionText );
543 expressions.prepend( expressionText );
545 while ( expressions.count() > 20 )
547 expressions.pop_back();
550 settings.
setValue( location, expressions );
557 const QString location = u
"user"_s;
560 settings.
setValue( u
"expression"_s, expression );
561 settings.
setValue( u
"helpText"_s, helpText );
564 const QModelIndexList idxs { mModel->match( mModel->index( 0, 0 ), Qt::DisplayRole, label, 1, Qt::MatchFlag::MatchRecursive ) };
565 if ( !idxs.isEmpty() )
567 scrollTo( idxs.first() );
582 if ( mExpressionGroups.contains( u
"UserGroup"_s ) )
585 node->removeRows( 0, node->rowCount() );
589 const QString location = u
"user"_s;
595 for (
const auto &label : std::as_const( mUserExpressionLabels ) )
598 expression = settings.
value( u
"expression"_s ).toString();
607 return mUserExpressionLabels;
612 const QString group = u
"user"_s;
614 QJsonArray exportList;
615 QJsonObject exportObject {
617 {
"exported_at", QDateTime::currentDateTime().toString( Qt::ISODate ) },
619 {
"expressions", exportList }
626 for (
const QString &label : std::as_const( mUserExpressionLabels ) )
630 const QString expression = settings.
value( u
"expression"_s ).toString();
631 const QString helpText = settings.
value( u
"helpText"_s ).toString();
632 const QJsonObject expressionObject {
634 {
"type",
"expression" },
635 {
"expression", expression },
637 {
"description", helpText }
639 exportList.push_back( expressionObject );
644 exportObject[u
"expressions"_s] = exportList;
645 QJsonDocument exportJson = QJsonDocument( exportObject );
653 if ( !expressionsDocument.isObject() )
656 QJsonObject expressionsObject = expressionsDocument.object();
659 if ( !expressionsObject[u
"qgis_version"_s].isString()
660 || !expressionsObject[u
"exported_at"_s].isString()
661 || !expressionsObject[u
"author"_s].isString()
662 || !expressionsObject[u
"expressions"_s].isArray() )
666 QVersionNumber qgisJsonVersion = QVersionNumber::fromString( expressionsObject[u
"qgis_version"_s].toString() );
667 QVersionNumber qgisVersion = QVersionNumber::fromString(
Qgis::version() );
671 if ( qgisJsonVersion > qgisVersion )
673 QMessageBox::StandardButtons buttons = QMessageBox::Yes | QMessageBox::No;
674 switch ( QMessageBox::question(
this, tr(
"QGIS Version Mismatch" ), tr(
"The imported expressions are from newer version of QGIS (%1) "
675 "and some of the expression might not work the current version (%2). "
676 "Are you sure you want to continue?" )
677 .arg( qgisJsonVersion.toString(), qgisVersion.toString() ),
680 case QMessageBox::No:
683 case QMessageBox::Yes:
692 QStringList skippedExpressionLabels;
693 bool isApplyToAll =
false;
694 bool isOkToOverwrite =
false;
700 const QJsonArray expressions = expressionsObject[u
"expressions"_s].toArray();
701 for (
const QJsonValue &&expressionValue : expressions )
704 if ( !expressionValue.isObject() )
707 skippedExpressionLabels.append( expressionValue.toString() );
711 QJsonObject expressionObj = expressionValue.toObject();
714 if ( !expressionObj[u
"name"_s].isString()
715 || !expressionObj[u
"type"_s].isString()
716 || !expressionObj[u
"expression"_s].isString()
717 || !expressionObj[u
"group"_s].isString()
718 || !expressionObj[u
"description"_s].isString() )
721 if ( !expressionObj[u
"name"_s].toString().isEmpty() )
722 skippedExpressionLabels.append( expressionObj[u
"name"_s].toString() );
724 skippedExpressionLabels.append( expressionObj[u
"expression"_s].toString() );
730 if ( expressionObj[u
"type"_s].toString() !=
"expression"_L1 )
732 skippedExpressionLabels.append( expressionObj[u
"name"_s].toString() );
737 if ( expressionObj[u
"group"_s].toString() !=
"user"_L1 )
739 skippedExpressionLabels.append( expressionObj[u
"name"_s].toString() );
743 const QString label = expressionObj[u
"name"_s].toString();
744 const QString expression = expressionObj[u
"expression"_s].toString();
745 const QString helpText = expressionObj[u
"description"_s].toString();
748 if ( label.contains(
"\\"_L1 ) || label.contains(
'/' ) )
750 skippedExpressionLabels.append( expressionObj[u
"name"_s].toString() );
755 const QString oldExpression = settings.
value( u
"expression"_s ).toString();
759 if ( mUserExpressionLabels.contains( label ) && expression != oldExpression )
762 showMessageBoxConfirmExpressionOverwrite( isApplyToAll, isOkToOverwrite, label, oldExpression, expression );
764 if ( isOkToOverwrite )
768 skippedExpressionLabels.append( label );
780 if ( !skippedExpressionLabels.isEmpty() )
782 QStringList skippedExpressionLabelsQuoted;
783 skippedExpressionLabelsQuoted.reserve( skippedExpressionLabels.size() );
784 for (
const QString &skippedExpressionLabel : skippedExpressionLabels )
785 skippedExpressionLabelsQuoted.append( u
"'%1'"_s.arg( skippedExpressionLabel ) );
787 QMessageBox::information(
this, tr(
"Skipped Expression Imports" ), u
"%1\n%2"_s.arg( tr(
"The following expressions have been skipped:" ), skippedExpressionLabelsQuoted.join(
", "_L1 ) ) );
793 QList<QgsExpressionItem *> result;
794 const QList<QStandardItem *> found { mModel->findItems( label, Qt::MatchFlag::MatchRecursive ) };
795 result.reserve( found.size() );
796 std::transform( found.begin(), found.end(), std::back_inserter( result ), []( QStandardItem *item ) ->
QgsExpressionItem * { return static_cast<QgsExpressionItem *>( item ); } );
800void QgsExpressionTreeView::showMessageBoxConfirmExpressionOverwrite(
802 bool &isOkToOverwrite,
803 const QString &label,
804 const QString &oldExpression,
805 const QString &newExpression
808 QMessageBox::StandardButtons buttons = QMessageBox::Yes | QMessageBox::YesToAll | QMessageBox::No | QMessageBox::NoToAll;
809 switch ( QMessageBox::question(
this, tr(
"Expression Overwrite" ), tr(
"The expression with label '%1' was already defined."
810 "The old expression \"%2\" will be overwritten by \"%3\"."
811 "Are you sure you want to overwrite the expression?" )
812 .arg( label, oldExpression, newExpression ),
815 case QMessageBox::NoToAll:
817 isOkToOverwrite =
false;
820 case QMessageBox::No:
821 isApplyToAll =
false;
822 isOkToOverwrite =
false;
825 case QMessageBox::YesToAll:
827 isOkToOverwrite =
true;
830 case QMessageBox::Yes:
831 isApplyToAll =
false;
832 isOkToOverwrite =
true;
849 setFilterCaseSensitivity( Qt::CaseInsensitive );
854 QModelIndex index = sourceModel()->index( source_row, 0, source_parent );
860 int count = sourceModel()->rowCount( index );
861 bool matchchild =
false;
862 for (
int i = 0; i < count; ++i )
874 const QString name = sourceModel()->data( index, Qt::DisplayRole ).toString();
875 if ( name.contains( mFilterString, Qt::CaseInsensitive ) )
881 return std::any_of( tags.begin(), tags.end(), [
this](
const QString &tag ) {
882 return tag.contains( mFilterString, Qt::CaseInsensitive );
888 mFilterString = string;
896 if ( leftSort != rightSort )
897 return leftSort < rightSort;
899 QString leftString = sourceModel()->data( left, Qt::DisplayRole ).toString();
900 QString rightString = sourceModel()->data( right, Qt::DisplayRole ).toString();
903 if ( leftString.startsWith(
'$' ) )
904 leftString = leftString.mid( 1 );
905 if ( rightString.startsWith(
'$' ) )
906 rightString = rightString.mid( 1 );
908 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.