35#include <QRegularExpression>
37#include "moc_qgspropertyoverridebutton.cpp"
40 : QToolButton( parent )
41 , mVectorLayer( layer )
44 setFocusPolicy( Qt::StrongFocus );
46 QString ss = QStringLiteral(
"QgsPropertyOverrideButton { background: none; border: 1px solid rgba(0, 0, 0, 0%); } QgsPropertyOverrideButton:focus { border: 1px solid palette(highlight); }" );
48 ss += QLatin1String(
"QgsPropertyOverrideButton::menu-indicator { width: 5px; }" );
55 setFixedSize( 2 *
static_cast<int>( 1.25 * iconSize / 2.0 ), 2 *
static_cast<int>( iconSize * 1.1 / 2.0 ) );
57 setIconSize( QSize( iconSize, iconSize ) );
58 setPopupMode( QToolButton::InstantPopup );
62 mDefineMenu =
new QMenu(
this );
63 connect( mDefineMenu, &QMenu::aboutToShow,
this, &QgsPropertyOverrideButton::aboutToShowMenu );
64 connect( mDefineMenu, &QMenu::triggered,
this, &QgsPropertyOverrideButton::menuActionTriggered );
65 setMenu( mDefineMenu );
67 mFieldsMenu =
new QMenu(
this );
68 mActionDataTypes =
new QAction(
this );
70 mActionDataTypes->setMenu( mFieldsMenu );
72 mActionVariables =
new QAction( tr(
"Variable" ),
this );
73 mVariablesMenu =
new QMenu(
this );
74 mActionVariables->setMenu( mVariablesMenu );
76 mActionColors =
new QAction( tr(
"Color" ),
this );
77 mColorsMenu =
new QMenu(
this );
78 mActionColors->setMenu( mColorsMenu );
80 mActionActive =
new QAction(
this );
81 QFont f = mActionActive->font();
83 mActionActive->setFont( f );
85 mActionDescription =
new QAction( tr(
"Description…" ),
this );
87 mActionCreateAuxiliaryField =
new QAction( tr(
"Store Data in the Project" ),
this );
88 mActionCreateAuxiliaryField->setCheckable(
true );
90 mActionExpDialog =
new QAction( tr(
"Edit…" ),
this );
91 mActionExpression =
nullptr;
92 mActionPasteExpr =
new QAction( tr(
"Paste" ),
this );
93 mActionCopyExpr =
new QAction( tr(
"Copy" ),
this );
94 mActionClearExpr =
new QAction( tr(
"Clear" ),
this );
95 mActionAssistant =
new QAction( tr(
"Assistant…" ),
this );
96 QFont assistantFont = mActionAssistant->font();
97 assistantFont.setBold(
true );
98 mActionAssistant->setFont( assistantFont );
99 mDefineMenu->addAction( mActionAssistant );
110 mVectorLayer = layer;
111 mAuxiliaryStorageEnabled = auxiliaryStorageEnabled;
115 mDefinition = definition;
116 mDataTypes = mDefinition.
dataType();
118 mInputDescription = mDefinition.helpText();
119 mFullDescription.clear();
123 mDataTypesString.clear();
126 switch ( mDataTypes )
129 ts << tr(
"boolean" );
134 ts << tr(
"double" );
138 ts << tr(
"string" );
144 mDataTypesString = ts.join( QLatin1String(
", " ) );
145 mActionDataTypes->setText( tr(
"Field type: " ) + mDataTypesString );
161 mFieldNameList.clear();
162 mFieldDisplayNameList.clear();
168 const QgsFields fields = mVectorLayer->fields();
172 bool fieldMatch =
false;
173 switch ( mDataTypes )
180 fieldMatch = f.isNumeric() || f.type() == QMetaType::Type::QString;
184 fieldMatch = f.type() == QMetaType::Type::QString;
190 mFieldNameList << f.name();
191 mFieldDisplayNameList << f.displayNameWithAlias();
206 mVectorLayer = layer;
213 const auto constMSiblingWidgets = mSiblingWidgets;
214 for (
const SiblingWidget &sw : constMSiblingWidgets )
216 if ( widget == sw.mWidgetPointer.data() && sw.mSiblingType == SiblingCheckState )
219 mSiblingWidgets.append( SiblingWidget( QPointer<QWidget>( widget ), SiblingCheckState, natural ) );
225 const auto constMSiblingWidgets = mSiblingWidgets;
226 for (
const SiblingWidget &sw : constMSiblingWidgets )
228 if ( widget == sw.mWidgetPointer.data() && sw.mSiblingType == SiblingEnableState )
231 mSiblingWidgets.append( SiblingWidget( QPointer<QWidget>( widget ), SiblingEnableState, natural ) );
237 const auto constMSiblingWidgets = mSiblingWidgets;
238 for (
const SiblingWidget &sw : constMSiblingWidgets )
240 if ( widget == sw.mWidgetPointer.data() && sw.mSiblingType == SiblingVisibility )
243 mSiblingWidgets.append( SiblingWidget( QPointer<QWidget>( widget ), SiblingVisibility, natural ) );
249 const auto constMSiblingWidgets = mSiblingWidgets;
250 for (
const SiblingWidget &sw : constMSiblingWidgets )
252 if ( widget == sw.mWidgetPointer.data() && sw.mSiblingType == SiblingExpressionText )
255 mSiblingWidgets.append( SiblingWidget( QPointer<QWidget>( widget ), SiblingExpressionText ) );
263 if ( ( event->modifiers() & ( Qt::ControlModifier ) )
264 || event->button() == Qt::RightButton )
266 setActivePrivate( !mProperty.isActive() );
274 if ( event->button() == Qt::MiddleButton )
276 showExpressionDialog();
281 QToolButton::mousePressEvent( event );
295 mFieldName =
property.field();
300 mExpressionString =
property.expressionString();
308 mExpressionString.clear();
310 mProperty = property;
311 setActive( mProperty && mProperty.isActive() );
317void QgsPropertyOverrideButton::aboutToShowMenu()
319 mDefineMenu->clear();
323 bool hasExp = !mExpressionString.isEmpty();
324 QString ddTitle = tr(
"Data defined override" );
326 QAction *ddTitleAct = mDefineMenu->addAction( ddTitle );
327 QFont titlefont = ddTitleAct->font();
328 titlefont.setItalic(
true );
329 ddTitleAct->setFont( titlefont );
330 ddTitleAct->setEnabled(
false );
332 bool addActiveAction =
false;
337 addActiveAction = !exp.hasParserError();
342 addActiveAction = mFieldNameList.contains( mFieldName );
345 if ( addActiveAction )
347 ddTitleAct->setText( ddTitle +
" (" + ( mProperty.propertyType() ==
Qgis::PropertyType::Expression ? tr(
"expression" ) : tr(
"field" ) ) +
')' );
348 mDefineMenu->addAction( mActionActive );
349 mActionActive->setText( mProperty.isActive() ? tr(
"Deactivate" ) : tr(
"Activate" ) );
350 mActionActive->setData( QVariant( !mProperty.isActive() ) );
353 if ( !mFullDescription.isEmpty() )
355 mDefineMenu->addAction( mActionDescription );
358 mDefineMenu->addSeparator();
361 if ( mAuxiliaryStorageEnabled && mVectorLayer )
363 mDefineMenu->addAction( mActionCreateAuxiliaryField );
365 const QgsAuxiliaryLayer *alayer = mVectorLayer->auxiliaryLayer();
367 mActionCreateAuxiliaryField->setEnabled(
true );
368 mActionCreateAuxiliaryField->setChecked(
false );
370 int index = mVectorLayer->fields().indexFromName( mFieldName );
372 if ( index >= 0 && alayer && mVectorLayer->isAuxiliaryField( index, srcIndex ) )
374 mActionCreateAuxiliaryField->setEnabled(
false );
375 mActionCreateAuxiliaryField->setChecked(
true );
379 bool fieldActive =
false;
380 if ( !mDataTypesString.isEmpty() )
382 QAction *fieldTitleAct = mDefineMenu->addAction( tr(
"Attribute Field" ) );
383 fieldTitleAct->setFont( titlefont );
384 fieldTitleAct->setEnabled(
false );
386 mDefineMenu->addAction( mActionDataTypes );
388 mFieldsMenu->clear();
390 if ( !mFieldNameList.isEmpty() )
392 for (
int j = 0; j < mFieldNameList.count(); ++j )
394 QString fldname = mFieldNameList.at( j );
395 QAction *act = mFieldsMenu->addAction( mFieldDisplayNameList.at( j ) );
396 act->setIcon( mFieldIcons.at( j ) );
397 act->setData( QVariant( fldname ) );
398 if ( mFieldName == fldname )
400 act->setCheckable(
true );
408 QAction *act = mFieldsMenu->addAction( tr(
"No matching field types found" ) );
409 act->setEnabled(
false );
412 mDefineMenu->addSeparator();
415 mFieldsMenu->menuAction()->setCheckable(
true );
416 mFieldsMenu->menuAction()->setChecked( fieldActive && mProperty.propertyType() ==
Qgis::PropertyType::Field && !mProperty.transformer() );
418 bool colorActive =
false;
419 mColorsMenu->clear();
424 QAction *colorTitleAct = mDefineMenu->addAction( tr(
"Project Color" ) );
425 colorTitleAct->setFont( titlefont );
426 colorTitleAct->setEnabled(
false );
428 QList<QgsProjectColorScheme *> projectSchemes;
430 if ( projectSchemes.length() > 0 )
432 QgsProjectColorScheme *scheme = projectSchemes.at( 0 );
434 for (
const auto &color : colors )
436 if ( color.second.isEmpty() )
440 QAction *act = mColorsMenu->addAction( color.second );
441 act->setIcon( icon );
444 act->setCheckable(
true );
445 act->setChecked(
true );
451 if ( mColorsMenu->actions().isEmpty() )
453 QAction *act = mColorsMenu->addAction( tr(
"No colors set" ) );
454 act->setEnabled(
false );
457 mDefineMenu->addAction( mActionColors );
458 mColorsMenu->menuAction()->setCheckable(
true );
459 mColorsMenu->menuAction()->setChecked( colorActive && !mProperty.transformer() );
461 mDefineMenu->addSeparator();
464 QAction *exprTitleAct = mDefineMenu->addAction( tr(
"Expression" ) );
465 exprTitleAct->setFont( titlefont );
466 exprTitleAct->setEnabled(
false );
468 mVariablesMenu->clear();
469 bool variableActive =
false;
470 if ( mExpressionContextGenerator )
472 QgsExpressionContext context = mExpressionContextGenerator->createExpressionContext();
475 const auto constVariables = variables;
476 for (
const QString &variable : constVariables )
480 if ( variable.startsWith(
'_' ) )
483 QAction *act = mVariablesMenu->addAction( variable );
484 act->setData( QVariant( variable ) );
488 act->setCheckable(
true );
489 act->setChecked(
true );
490 variableActive =
true;
495 if ( mVariablesMenu->actions().isEmpty() )
497 QAction *act = mVariablesMenu->addAction( tr(
"No variables set" ) );
498 act->setEnabled(
false );
501 mDefineMenu->addAction( mActionVariables );
502 mVariablesMenu->menuAction()->setCheckable(
true );
503 mVariablesMenu->menuAction()->setChecked( variableActive && !mProperty.transformer() );
507 QString expString = mExpressionString;
508 if ( expString.length() > 35 )
510 expString.truncate( 35 );
511 expString.append( QChar( 0x2026 ) );
514 expString.prepend( tr(
"Current: " ) );
516 if ( !mActionExpression )
518 mActionExpression =
new QAction( expString,
this );
519 mActionExpression->setCheckable(
true );
523 mActionExpression->setText( expString );
525 mDefineMenu->addAction( mActionExpression );
526 mActionExpression->setChecked( mProperty.propertyType() ==
Qgis::PropertyType::Expression && !variableActive && !colorActive && !mProperty.transformer() );
528 mDefineMenu->addAction( mActionExpDialog );
529 mDefineMenu->addAction( mActionCopyExpr );
530 mDefineMenu->addAction( mActionPasteExpr );
534 mDefineMenu->addAction( mActionExpDialog );
535 mDefineMenu->addAction( mActionPasteExpr );
538 if ( hasExp || !mFieldName.isEmpty() )
540 mDefineMenu->addSeparator();
541 mDefineMenu->addAction( mActionClearExpr );
544 if ( !mDefinition.name().isEmpty() && mDefinition.supportsAssistant() )
546 mDefineMenu->addSeparator();
547 mActionAssistant->setCheckable( mProperty.transformer() );
548 mActionAssistant->setChecked( mProperty.transformer() );
549 mDefineMenu->addAction( mActionAssistant );
553void QgsPropertyOverrideButton::menuActionTriggered( QAction *action )
555 if ( action == mActionActive )
557 setActivePrivate( mActionActive->data().toBool() );
561 else if ( action == mActionDescription )
563 showDescriptionDialog();
565 else if ( action == mActionExpDialog )
567 showExpressionDialog();
569 else if ( action == mActionExpression )
571 mProperty.setExpressionString( mExpressionString );
572 mProperty.setTransformer(
nullptr );
573 setActivePrivate(
true );
578 else if ( action == mActionCopyExpr )
580 QApplication::clipboard()->setText( mExpressionString );
582 else if ( action == mActionPasteExpr )
584 QString exprString = QApplication::clipboard()->text();
585 if ( !exprString.isEmpty() )
587 mExpressionString = exprString;
588 mProperty.setExpressionString( mExpressionString );
589 mProperty.setTransformer(
nullptr );
590 setActivePrivate(
true );
596 else if ( action == mActionClearExpr )
598 setActivePrivate(
false );
599 mProperty.setStaticValue( QVariant() );
600 mProperty.setTransformer(
nullptr );
601 mExpressionString.clear();
607 else if ( action == mActionAssistant )
611 else if ( action == mActionCreateAuxiliaryField )
615 else if ( mFieldsMenu->actions().contains( action ) )
617 if ( action->isEnabled() )
619 if ( mFieldName != action->text() )
621 mFieldName = action->data().toString();
623 mProperty.setField( mFieldName );
624 mProperty.setTransformer(
nullptr );
625 setActivePrivate(
true );
631 else if ( mVariablesMenu->actions().contains( action ) )
633 if ( mExpressionString != action->text().prepend(
"@" ) )
635 mExpressionString = action->data().toString().prepend(
"@" );
637 mProperty.setExpressionString( mExpressionString );
638 mProperty.setTransformer(
nullptr );
639 setActivePrivate(
true );
644 else if ( mColorsMenu->actions().contains( action ) )
646 if ( getColor() != action->text() )
648 mExpressionString = QStringLiteral(
"project_color_object('%1')" ).arg( action->text() );
650 mProperty.setExpressionString( mExpressionString );
651 mProperty.setTransformer(
nullptr );
652 setActivePrivate(
true );
660void QgsPropertyOverrideButton::showDescriptionDialog()
662 QgsMessageViewer *mv =
new QgsMessageViewer(
this );
663 mv->setWindowTitle( tr(
"Data Definition Description" ) );
669void QgsPropertyOverrideButton::showExpressionDialog()
671 QgsExpressionContext context = mExpressionContextGenerator ? mExpressionContextGenerator->createExpressionContext() : QgsExpressionContext();
674 QString currentExpression = ( mProperty.propertyType() ==
Qgis::PropertyType::Static && !mProperty.staticValue().isValid() ) ? QString()
675 : mProperty.asExpression();
677 QgsExpressionBuilderDialog d(
const_cast<QgsVectorLayer *
>( mVectorLayer ), currentExpression,
this, QStringLiteral(
"generic" ), context );
678 d.setExpectedOutputFormat( mInputDescription );
679 if ( d.exec() == QDialog::Accepted )
681 mExpressionString = d.expressionText().trimmed();
682 bool active = mProperty.isActive();
683 mProperty.setExpressionString( mExpressionString );
684 mProperty.setTransformer(
nullptr );
685 mProperty.setActive( !mExpressionString.isEmpty() );
686 if ( mProperty.isActive() !=
active )
695void QgsPropertyOverrideButton::showAssistant()
699 if ( !mProperty.transformer() )
701 ( void ) mProperty.convertToTransformer();
705 QgsPropertyAssistantWidget *widget =
new QgsPropertyAssistantWidget( panel, mDefinition, mProperty, mVectorLayer );
713 mExpressionString = this->mProperty.asExpression();
714 mFieldName = this->mProperty.field();
727 QDialog *dlg =
new QDialog(
this );
728 QString key = QStringLiteral(
"/UI/paneldialog/%1" ).arg( widget->
panelTitle() );
729 QgsSettings settings;
730 dlg->restoreGeometry( settings.
value( key ).toByteArray() );
732 dlg->setLayout(
new QVBoxLayout() );
733 dlg->layout()->addWidget( widget );
734 QDialogButtonBox *buttonBox =
new QDialogButtonBox( QDialogButtonBox::Cancel | QDialogButtonBox::Help | QDialogButtonBox::Ok );
735 connect( buttonBox, &QDialogButtonBox::accepted, dlg, &QDialog::accept );
736 connect( buttonBox, &QDialogButtonBox::rejected, dlg, &QDialog::reject );
737 connect( buttonBox, &QDialogButtonBox::helpRequested,
this, &QgsPropertyOverrideButton::showHelp );
738 dlg->layout()->addWidget( buttonBox );
740 if ( dlg->exec() == QDialog::Accepted )
743 mExpressionString = mProperty.asExpression();
744 mFieldName = mProperty.field();
751 settings.
setValue( key, dlg->saveGeometry() );
755void QgsPropertyOverrideButton::updateGui()
757 bool hasExp = !mExpressionString.isEmpty();
758 bool hasField = !mFieldName.isEmpty();
761 QString deftip = tr(
"undefined" );
765 icon = mProperty.isActive() ?
QgsApplication::getThemeIcon( QStringLiteral(
"/mIconDataDefineExpressionOn.svg" ) ) : QgsApplication::getThemeIcon( QStringLiteral(
"/mIconDataDefineExpression.svg" ) );
767 const QString colorName = getColor();
768 if ( !colorName.isEmpty() )
770 icon = mProperty.isActive() ?
QgsApplication::getThemeIcon( QStringLiteral(
"/mIconDataDefineColorOn.svg" ) ) : QgsApplication::getThemeIcon( QStringLiteral(
"/mIconDataDefineColor.svg" ) );
772 deftype = tr(
"project color" );
776 QgsExpression exp( mExpressionString );
777 if ( exp.hasParserError() )
780 deftip = tr(
"Parse error: %1" ).arg( exp.parserErrorString() );
784 deftip = mExpressionString;
790 icon = mProperty.isActive() ?
QgsApplication::getThemeIcon( QStringLiteral(
"/mIconDataDefineOn.svg" ) ) : QgsApplication::getThemeIcon( QStringLiteral(
"/mIconDataDefine.svg" ) );
792 if ( !mFieldNameList.contains( mFieldName ) && !mProperty.transformer() )
794 icon = QgsApplication::getThemeIcon( QStringLiteral(
"/mIconDataDefineError.svg" ) );
795 deftip = tr(
"'%1' field missing" ).arg( mFieldName );
806 mFullDescription.clear();
807 if ( !mDefinition.description().isEmpty() )
809 mFullDescription += QStringLiteral(
"<b><u>%1</b></u>" ).arg( mDefinition.description() );
811 if ( !mDefinition.comment().isEmpty() )
813 mFullDescription += QStringLiteral(
"<p><i>%1</i></p>" ).arg( mDefinition.comment() );
815 else if ( !mFullDescription.isEmpty() )
817 mFullDescription += QStringLiteral(
"<br>" );
820 mFullDescription += tr(
"<b>Data defined override</b><br>" );
822 mFullDescription += tr(
"<b>Active: </b>%1 <i>(ctrl|right-click toggles)</i><br>" ).arg( mProperty.isActive() ? tr(
"yes" ) : tr(
"no" ) );
824 if ( !mUsageInfo.isEmpty() )
826 mFullDescription += tr(
"<b>Usage:</b><br>%1<br>" ).arg( mUsageInfo );
829 if ( !mInputDescription.isEmpty() )
831 mFullDescription += tr(
"<b>Expected input:</b><br>%1<br>" ).arg( mInputDescription );
834 if ( !mDataTypesString.isEmpty() )
836 mFullDescription += tr(
"<b>Valid input types:</b><br>%1<br>" ).arg( mDataTypesString );
839 if ( deftype.isEmpty() && deftip != tr(
"undefined" ) )
845 if ( deftip.length() > 75 )
847 deftip.truncate( 75 );
848 deftip.append( QChar( 0x2026 ) );
851 mFullDescription += tr(
"<b>Current definition (%1):</b><br>%2" ).arg( deftype, deftip );
853 setToolTip( mFullDescription );
856void QgsPropertyOverrideButton::setActivePrivate(
bool active )
858 if ( mProperty.isActive() !=
active )
860 mProperty.setActive(
active );
865void QgsPropertyOverrideButton::updateSiblingWidgets(
bool state )
867 const auto constMSiblingWidgets = mSiblingWidgets;
868 for (
const SiblingWidget &sw : constMSiblingWidgets )
870 switch ( sw.mSiblingType )
872 case SiblingCheckState:
877 QAbstractButton *btn = qobject_cast<QAbstractButton *>( sw.mWidgetPointer.data() );
878 if ( btn && btn->isCheckable() )
880 btn->setChecked( sw.mNatural ? state : !state );
884 QGroupBox *grpbx = qobject_cast<QGroupBox *>( sw.mWidgetPointer.data() );
885 if ( grpbx && grpbx->isCheckable() )
887 grpbx->setChecked( sw.mNatural ? state : !state );
894 case SiblingEnableState:
896 QLineEdit *le = qobject_cast<QLineEdit *>( sw.mWidgetPointer.data() );
898 le->setReadOnly( sw.mNatural ? !state : state );
900 sw.mWidgetPointer.data()->setEnabled( sw.mNatural ? state : !state );
904 case SiblingVisibility:
906 sw.mWidgetPointer.data()->setVisible( sw.mNatural ? state : !state );
910 case SiblingExpressionText:
912 QLineEdit *le = qobject_cast<QLineEdit *>( sw.mWidgetPointer.data() );
915 le->setText( mProperty.asExpression() );
919 QTextEdit *te = qobject_cast<QTextEdit *>( sw.mWidgetPointer.data() );
922 te->setText( mProperty.asExpression() );
928 case SiblingLinkedWidget:
930 if ( QgsColorButton *cb = qobject_cast<QgsColorButton *>( sw.mWidgetPointer.data() ) )
932 if ( state && mProperty.isProjectColor() )
934 const QString colorName = getColor();
935 if ( !colorName.isEmpty() )
937 cb->linkToProjectColor( colorName );
942 cb->linkToProjectColor( QString() );
954 if ( mProperty.isActive() !=
active )
956 mProperty.setActive(
active );
965 mExpressionContextGenerator = generator;
970 for (
const SiblingWidget &sw : std::as_const( mSiblingWidgets ) )
972 if ( widget == sw.mWidgetPointer.data() && sw.mSiblingType == SiblingLinkedWidget )
975 mSiblingWidgets.append( SiblingWidget( QPointer<QWidget>( widget ), SiblingLinkedWidget ) );
977 if (
QgsColorButton *cb = qobject_cast<QgsColorButton *>( widget ) )
988void QgsPropertyOverrideButton::showHelp()
990 QgsHelp::openHelp( QStringLiteral(
"introduction/general_tools.html#data-defined" ) );
993QString QgsPropertyOverrideButton::getColor()
const
995 const thread_local QRegularExpression rx( QStringLiteral(
"^project_color(_object|)\\('(.*)'\\)$" ) );
996 QRegularExpressionMatch match = rx.match( mExpressionString );
997 return match.hasMatch() ? match.captured( 2 ) : QString();
@ Invalid
Invalid (not set) property.
@ Field
Field based property.
@ Expression
Expression based property.
Abstract base class for QgsPropertyCollection like objects.
virtual QgsProperty property(int key) const =0
Returns a matching property from the collection, if one exists.
static QgsColorSchemeRegistry * colorSchemeRegistry()
Returns the application's color scheme registry, used for managing color schemes.
static QIcon getThemeIcon(const QString &name, const QColor &fillColor=QColor(), const QColor &strokeColor=QColor())
Helper to get a theme icon.
QList< QgsColorScheme * > schemes() const
Returns all color schemes in the registry.
Abstract interface for generating an expression context.
bool isReadOnly(const QString &name) const
Returns whether a variable is read only, and should not be modifiable by users.
QStringList variableNames() const
Returns a list of variables names set by all scopes in the context.
Handles parsing and evaluation of expressions (formerly called "search strings").
Encapsulate a field in an attribute table or data source.
Container of fields for a vector layer.
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 void openHelp(const QString &key)
Opens help topic for the given help key using default system web browser.
void setMessageAsHtml(const QString &msg)
QgsNamedColorList fetchColors(const QString &context=QString(), const QColor &baseColor=QColor()) override
Gets a list of colors from the scheme.
Definition for a property.
DataType dataType() const
Returns the allowable field/value data type for the property.
@ ColorNoAlpha
Color with no alpha channel.
@ ColorWithAlpha
Color with alpha channel.
@ DataTypeString
Property requires a string value.
@ DataTypeBoolean
Property requires a boolean value.
@ DataTypeNumeric
Property requires a numeric value.
A store for object properties.
Qgis::PropertyType propertyType() const
Returns the property type.
QVariant value(const QgsExpressionContext &context, const QVariant &defaultValue=QVariant(), bool *ok=nullptr) const
Calculates the current value of the property, including any transforms which are set for the property...
QVariant value(const QString &key, const QVariant &defaultValue=QVariant(), Section section=NoSection) const
Returns the value for setting key.
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.
QList< QPair< QColor, QString > > QgsNamedColorList
List of colors paired with a friendly display name identifying the color.
int scaleIconSize(int standardSize)
Scales an icon size to compensate for display pixel density, making the icon size hi-dpi friendly,...
QMap< int, QgsPropertyDefinition > QgsPropertiesDefinition
Definition of available properties.