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;
301 int count = functions->count();
302 for (
int i = 0; i < count; i++ )
305 QString name = func->name();
306 if ( name.startsWith(
'_' ) )
308 if ( func->isDeprecated() )
310 if ( func->isContextual() )
316 if ( func->params() != 0 )
318 else if ( !name.startsWith(
'$' ) )
321 registerItemForAllGroups(
332 loadExpressionContext();
336 const QString &group,
337 const QString &label,
338 const QString &expressionText,
339 const QString &helpText,
341 bool highlightedItem,
344 const QStringList &tags,
348 QgsExpressionItem *item =
new QgsExpressionItem( label, expressionText, helpText, type );
349 item->setData( label, Qt::UserRole );
353 item->setIcon( icon );
356 if ( mExpressionGroups.contains( group ) )
358 QgsExpressionItem *groupNode = mExpressionGroups.value( group );
359 groupNode->appendRow( item );
365 newgroupNode->setData( group, Qt::UserRole );
368 newgroupNode->appendRow( item );
369 newgroupNode->setBackground( QBrush( QColor( 150, 150, 150, 150 ) ) );
370 mModel->appendRow( newgroupNode );
371 mExpressionGroups.insert( group, newgroupNode );
374 if ( highlightedItem )
377 QgsExpressionItem *topLevelItem =
new QgsExpressionItem( label, expressionText, helpText, type );
378 topLevelItem->setData( label, Qt::UserRole );
380 QFont font = topLevelItem->font();
381 font.setBold(
true );
382 topLevelItem->setFont( font );
383 mModel->appendRow( topLevelItem );
388void QgsExpressionTreeView::registerItemForAllGroups(
389 const QStringList &groups,
const QString &label,
const QString &expressionText,
const QString &helpText,
QgsExpressionItem::ItemType type,
bool highlightedItem,
int sortOrder,
const QStringList &tags
392 const auto constGroups = groups;
393 for (
const QString &group : constGroups )
395 registerItem( group, label, expressionText, helpText, type, highlightedItem, sortOrder, QIcon(), tags );
399void QgsExpressionTreeView::loadExpressionContext()
401 QStringList variableNames = mExpressionContext.filteredVariableNames();
402 const auto constVariableNames = variableNames;
403 for (
const QString &variable : constVariableNames )
408 " @" + variable +
' ',
409 formatVariableHelp( variable, mExpressionContext.description( variable ),
true, mExpressionContext.variable( variable ) ),
411 mExpressionContext.isHighlightedVariable( variable )
416 QStringList contextFunctions = mExpressionContext.functionNames();
417 const auto constContextFunctions = contextFunctions;
418 for (
const QString &functionName : constContextFunctions )
420 QgsExpressionFunction *func = mExpressionContext.function( functionName );
421 QString name = func->
name();
422 if ( name.startsWith(
'_' ) )
424 if ( func->
params() != 0 )
426 registerItemForAllGroups(
432void QgsExpressionTreeView::loadLayers()
437 QMap<QString, QgsMapLayer *> layers = mProject->mapLayers();
438 QMap<QString, QgsMapLayer *>::const_iterator layerIt = layers.constBegin();
439 for ( ; layerIt != layers.constEnd(); ++layerIt )
442 QgsExpressionItem *parentItem
444 loadLayerFields( qobject_cast<QgsVectorLayer *>( layerIt.value() ), parentItem );
453 const QgsFields fields = layer->
fields();
454 for (
int fieldIdx = 0; fieldIdx < fields.
count(); ++fieldIdx )
456 const QgsField field = fields.
at( fieldIdx );
460 item->setData( label, Qt::UserRole );
465 item->setIcon( icon );
466 parentItem->appendRow( item );
472 for (
int i = 0; i < fields.
count(); ++i )
483 if ( mExpressionGroups.contains( u
"Fields and Values"_s ) )
486 node->removeRows( 0, node->rowCount() );
517 const QgsFields &fields = mLayer->fields();
522void QgsExpressionTreeView::loadRelations()
527 QMap<QString, QgsRelation> relations = mProject->relationManager()->relations();
528 QMap<QString, QgsRelation>::const_iterator relIt = relations.constBegin();
529 for ( ; relIt != relations.constEnd(); ++relIt )
531 registerItemForAllGroups( QStringList() << tr(
"Relations" ), relIt->name(), u
"'%1'"_s.arg( relIt->id() ),
formatRelationHelp( relIt.value() ) );
537 mRecentKey = collection;
538 QString name = tr(
"Recent (%1)" ).arg( collection );
539 if ( mExpressionGroups.contains( name ) )
542 node->removeRows( 0, node->rowCount() );
546 const QString location = u
"/expressions/recent/%1"_s.arg( collection );
547 const QStringList expressions = settings.
value( location ).toStringList();
549 for (
const QString &expression : expressions )
552 QString label = expression;
553 label.replace(
'\n',
' ' );
562 QString location = u
"/expressions/recent/%1"_s.arg( collection );
563 QStringList expressions = settings.
value( location ).toStringList();
564 expressions.removeAll( expressionText );
566 expressions.prepend( expressionText );
568 while ( expressions.count() > 20 )
570 expressions.pop_back();
573 settings.
setValue( location, expressions );
580 const QString location = u
"user"_s;
583 settings.
setValue( u
"expression"_s, expression );
584 settings.
setValue( u
"helpText"_s, helpText );
587 const QModelIndexList idxs { mModel->match( mModel->index( 0, 0 ), Qt::DisplayRole, label, 1, Qt::MatchFlag::MatchRecursive ) };
588 if ( !idxs.isEmpty() )
590 scrollTo( idxs.first() );
605 if ( mExpressionGroups.contains( u
"UserGroup"_s ) )
608 node->removeRows( 0, node->rowCount() );
612 const QString location = u
"user"_s;
618 for (
const auto &label : std::as_const( mUserExpressionLabels ) )
621 expression = settings.
value( u
"expression"_s ).toString();
630 return mUserExpressionLabels;
635 const QString group = u
"user"_s;
637 QJsonArray exportList;
639 exportObject { {
"qgis_version",
Qgis::version() }, {
"exported_at", QDateTime::currentDateTime().toString( Qt::ISODate ) }, {
"author",
QgsApplication::userFullName() }, {
"expressions", exportList } };
645 for (
const QString &label : std::as_const( mUserExpressionLabels ) )
649 const QString expression = settings.
value( u
"expression"_s ).toString();
650 const QString helpText = settings.
value( u
"helpText"_s ).toString();
651 const QJsonObject expressionObject { {
"name", label }, {
"type",
"expression" }, {
"expression", expression }, {
"group", group }, {
"description", helpText } };
652 exportList.push_back( expressionObject );
657 exportObject[u
"expressions"_s] = exportList;
658 QJsonDocument exportJson = QJsonDocument( exportObject );
666 if ( !expressionsDocument.isObject() )
669 QJsonObject expressionsObject = expressionsDocument.object();
672 if ( !expressionsObject[u
"qgis_version"_s].isString() || !expressionsObject[u
"exported_at"_s].isString() || !expressionsObject[u
"author"_s].isString() || !expressionsObject[u
"expressions"_s].isArray() )
676 QVersionNumber qgisJsonVersion = QVersionNumber::fromString( expressionsObject[u
"qgis_version"_s].toString() );
677 QVersionNumber qgisVersion = QVersionNumber::fromString(
Qgis::version() );
681 if ( qgisJsonVersion > qgisVersion )
683 QMessageBox::StandardButtons buttons = QMessageBox::Yes | QMessageBox::No;
684 switch ( QMessageBox::question(
686 tr(
"QGIS Version Mismatch" ),
688 "The imported expressions are from newer version of QGIS (%1) "
689 "and some of the expression might not work the current version (%2). "
690 "Are you sure you want to continue?"
692 .arg( qgisJsonVersion.toString(), qgisVersion.toString() ),
696 case QMessageBox::No:
699 case QMessageBox::Yes:
708 QStringList skippedExpressionLabels;
709 bool isApplyToAll =
false;
710 bool isOkToOverwrite =
false;
716 const QJsonArray expressions = expressionsObject[u
"expressions"_s].toArray();
717 for (
const QJsonValue &&expressionValue : expressions )
720 if ( !expressionValue.isObject() )
723 skippedExpressionLabels.append( expressionValue.toString() );
727 QJsonObject expressionObj = expressionValue.toObject();
730 if ( !expressionObj[u
"name"_s].isString()
731 || !expressionObj[u
"type"_s].isString()
732 || !expressionObj[u
"expression"_s].isString()
733 || !expressionObj[u
"group"_s].isString()
734 || !expressionObj[u
"description"_s].isString() )
737 if ( !expressionObj[u
"name"_s].toString().isEmpty() )
738 skippedExpressionLabels.append( expressionObj[u
"name"_s].toString() );
740 skippedExpressionLabels.append( expressionObj[u
"expression"_s].toString() );
746 if ( expressionObj[u
"type"_s].toString() !=
"expression"_L1 )
748 skippedExpressionLabels.append( expressionObj[u
"name"_s].toString() );
753 if ( expressionObj[u
"group"_s].toString() !=
"user"_L1 )
755 skippedExpressionLabels.append( expressionObj[u
"name"_s].toString() );
759 const QString label = expressionObj[u
"name"_s].toString();
760 const QString expression = expressionObj[u
"expression"_s].toString();
761 const QString helpText = expressionObj[u
"description"_s].toString();
764 if ( label.contains(
"\\"_L1 ) || label.contains(
'/' ) )
766 skippedExpressionLabels.append( expressionObj[u
"name"_s].toString() );
771 const QString oldExpression = settings.
value( u
"expression"_s ).toString();
775 if ( mUserExpressionLabels.contains( label ) && expression != oldExpression )
778 showMessageBoxConfirmExpressionOverwrite( isApplyToAll, isOkToOverwrite, label, oldExpression, expression );
780 if ( isOkToOverwrite )
784 skippedExpressionLabels.append( label );
796 if ( !skippedExpressionLabels.isEmpty() )
798 QStringList skippedExpressionLabelsQuoted;
799 skippedExpressionLabelsQuoted.reserve( skippedExpressionLabels.size() );
800 for (
const QString &skippedExpressionLabel : skippedExpressionLabels )
801 skippedExpressionLabelsQuoted.append( u
"'%1'"_s.arg( skippedExpressionLabel ) );
803 QMessageBox::information(
this, tr(
"Skipped Expression Imports" ), u
"%1\n%2"_s.arg( tr(
"The following expressions have been skipped:" ), skippedExpressionLabelsQuoted.join(
", "_L1 ) ) );
809 QList<QgsExpressionItem *> result;
810 const QList<QStandardItem *> found { mModel->findItems( label, Qt::MatchFlag::MatchRecursive ) };
811 result.reserve( found.size() );
812 std::transform( found.begin(), found.end(), std::back_inserter( result ), []( QStandardItem *item ) ->
QgsExpressionItem * { return static_cast<QgsExpressionItem *>( item ); } );
816void QgsExpressionTreeView::showMessageBoxConfirmExpressionOverwrite(
bool &isApplyToAll,
bool &isOkToOverwrite,
const QString &label,
const QString &oldExpression,
const QString &newExpression )
818 QMessageBox::StandardButtons buttons = QMessageBox::Yes | QMessageBox::YesToAll | QMessageBox::No | QMessageBox::NoToAll;
819 switch ( QMessageBox::question(
821 tr(
"Expression Overwrite" ),
823 "The expression with label '%1' was already defined."
824 "The old expression \"%2\" will be overwritten by \"%3\"."
825 "Are you sure you want to overwrite the expression?"
827 .arg( label, oldExpression, newExpression ),
831 case QMessageBox::NoToAll:
833 isOkToOverwrite =
false;
836 case QMessageBox::No:
837 isApplyToAll =
false;
838 isOkToOverwrite =
false;
841 case QMessageBox::YesToAll:
843 isOkToOverwrite =
true;
846 case QMessageBox::Yes:
847 isApplyToAll =
false;
848 isOkToOverwrite =
true;
865 setFilterCaseSensitivity( Qt::CaseInsensitive );
870 QModelIndex index = sourceModel()->index( source_row, 0, source_parent );
876 int count = sourceModel()->rowCount( index );
877 bool matchchild =
false;
878 for (
int i = 0; i < count; ++i )
890 const QString name = sourceModel()->data( index, Qt::DisplayRole ).toString();
891 if ( name.contains( mFilterString, Qt::CaseInsensitive ) )
897 return std::any_of( tags.begin(), tags.end(), [
this](
const QString &tag ) { return tag.contains( mFilterString, Qt::CaseInsensitive ); } );
902 mFilterString = string;
910 if ( leftSort != rightSort )
911 return leftSort < rightSort;
913 QString leftString = sourceModel()->data( left, Qt::DisplayRole ).toString();
914 QString rightString = sourceModel()->data( right, Qt::DisplayRole ).toString();
917 if ( leftString.startsWith(
'$' ) )
918 leftString = leftString.mid( 1 );
919 if ( rightString.startsWith(
'$' ) )
920 rightString = rightString.mid( 1 );
922 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...
int params() const
The number of parameters this function takes.
QStringList groups() const
Returns a list of the groups the function belongs to.
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.
std::shared_ptr< const SharedFunctionPtrList > FunctionListSnapshot
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 const FunctionListSnapshot getFunctionsSnapshot()
Returns a thread-safe snapshot of all registered functions.
static QString group(const QString &group)
Returns the translated name for a function group.
std::shared_ptr< QgsExpressionFunction > SharedFunctionPtr
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.