35#include <QRegularExpression>
38#include "moc_qgspropertyoverridebutton.cpp"
40using namespace Qt::StringLiterals;
43 : QToolButton( parent )
44 , mVectorLayer( layer )
47 setFocusPolicy( Qt::StrongFocus );
49 QString ss = u
"QgsPropertyOverrideButton { background: none; border: 1px solid rgba(0, 0, 0, 0%); } QgsPropertyOverrideButton:focus { border: 1px solid palette(highlight); }"_s;
51 ss +=
"QgsPropertyOverrideButton::menu-indicator { width: 5px; }"_L1;
58 setFixedSize( 2 *
static_cast<int>( 1.25 * iconSize / 2.0 ), 2 *
static_cast<int>( iconSize * 1.1 / 2.0 ) );
60 setIconSize( QSize( iconSize, iconSize ) );
61 setPopupMode( QToolButton::InstantPopup );
65 mDefineMenu =
new QMenu(
this );
66 connect( mDefineMenu, &QMenu::aboutToShow,
this, &QgsPropertyOverrideButton::aboutToShowMenu );
67 connect( mDefineMenu, &QMenu::triggered,
this, &QgsPropertyOverrideButton::menuActionTriggered );
68 setMenu( mDefineMenu );
70 mFieldsMenu =
new QMenu(
this );
71 mActionDataTypes =
new QAction(
this );
73 mActionDataTypes->setMenu( mFieldsMenu );
75 mActionVariables =
new QAction( tr(
"Variable" ),
this );
76 mVariablesMenu =
new QMenu(
this );
77 mActionVariables->setMenu( mVariablesMenu );
79 mActionColors =
new QAction( tr(
"Color" ),
this );
80 mColorsMenu =
new QMenu(
this );
81 mActionColors->setMenu( mColorsMenu );
83 mActionActive =
new QAction(
this );
84 QFont f = mActionActive->font();
86 mActionActive->setFont( f );
88 mActionDescription =
new QAction( tr(
"Description…" ),
this );
90 mActionCreateAuxiliaryField =
new QAction( tr(
"Store Data in the Project" ),
this );
91 mActionCreateAuxiliaryField->setCheckable(
true );
93 mActionExpDialog =
new QAction( tr(
"Edit…" ),
this );
94 mActionExpression =
nullptr;
95 mActionPasteExpr =
new QAction( tr(
"Paste" ),
this );
96 mActionCopyExpr =
new QAction( tr(
"Copy" ),
this );
97 mActionClearExpr =
new QAction( tr(
"Clear" ),
this );
98 mActionAssistant =
new QAction( tr(
"Assistant…" ),
this );
99 QFont assistantFont = mActionAssistant->font();
100 assistantFont.setBold(
true );
101 mActionAssistant->setFont( assistantFont );
102 mDefineMenu->addAction( mActionAssistant );
113 mVectorLayer = layer;
114 mAuxiliaryStorageEnabled = auxiliaryStorageEnabled;
118 mDefinition = definition;
119 mDataTypes = mDefinition.
dataType();
121 mInputDescription = mDefinition.helpText();
122 mFullDescription.clear();
126 mDataTypesString.clear();
129 switch ( mDataTypes )
132 ts << tr(
"boolean" );
137 ts << tr(
"double" );
141 ts << tr(
"string" );
147 mDataTypesString = ts.join(
", "_L1 );
148 mActionDataTypes->setText( tr(
"Field type: " ) + mDataTypesString );
164 mFieldNameList.clear();
165 mFieldDisplayNameList.clear();
171 const QgsFields fields = mVectorLayer->fields();
175 bool fieldMatch =
false;
176 switch ( mDataTypes )
183 fieldMatch = f.isNumeric() || f.type() == QMetaType::Type::QString;
187 fieldMatch = f.type() == QMetaType::Type::QString;
193 mFieldNameList << f.name();
194 mFieldDisplayNameList << f.displayNameWithAlias();
209 mVectorLayer = layer;
216 const auto constMSiblingWidgets = mSiblingWidgets;
217 for (
const SiblingWidget &sw : constMSiblingWidgets )
219 if ( widget == sw.mWidgetPointer.data() && sw.mSiblingType == SiblingCheckState )
222 mSiblingWidgets.append( SiblingWidget( QPointer<QWidget>( widget ), SiblingCheckState, natural ) );
228 const auto constMSiblingWidgets = mSiblingWidgets;
229 for (
const SiblingWidget &sw : constMSiblingWidgets )
231 if ( widget == sw.mWidgetPointer.data() && sw.mSiblingType == SiblingEnableState )
234 mSiblingWidgets.append( SiblingWidget( QPointer<QWidget>( widget ), SiblingEnableState, natural ) );
240 const auto constMSiblingWidgets = mSiblingWidgets;
241 for (
const SiblingWidget &sw : constMSiblingWidgets )
243 if ( widget == sw.mWidgetPointer.data() && sw.mSiblingType == SiblingVisibility )
246 mSiblingWidgets.append( SiblingWidget( QPointer<QWidget>( widget ), SiblingVisibility, natural ) );
252 const auto constMSiblingWidgets = mSiblingWidgets;
253 for (
const SiblingWidget &sw : constMSiblingWidgets )
255 if ( widget == sw.mWidgetPointer.data() && sw.mSiblingType == SiblingExpressionText )
258 mSiblingWidgets.append( SiblingWidget( QPointer<QWidget>( widget ), SiblingExpressionText ) );
266 if ( ( event->modifiers() & ( Qt::ControlModifier ) )
267 || event->button() == Qt::RightButton )
269 setActivePrivate( !mProperty.isActive() );
277 if ( event->button() == Qt::MiddleButton )
279 showExpressionDialog();
284 QToolButton::mousePressEvent( event );
298 mFieldName =
property.field();
303 mExpressionString =
property.expressionString();
311 mExpressionString.clear();
313 mProperty = property;
314 setActive( mProperty && mProperty.isActive() );
320void QgsPropertyOverrideButton::aboutToShowMenu()
322 mDefineMenu->clear();
326 bool hasExp = !mExpressionString.isEmpty();
327 QString ddTitle = tr(
"Data defined override" );
329 QAction *ddTitleAct = mDefineMenu->addAction( ddTitle );
330 QFont titlefont = ddTitleAct->font();
331 titlefont.setItalic(
true );
332 ddTitleAct->setFont( titlefont );
333 ddTitleAct->setEnabled(
false );
335 bool addActiveAction =
false;
340 addActiveAction = !exp.hasParserError();
345 addActiveAction = mFieldNameList.contains( mFieldName );
348 if ( addActiveAction )
350 ddTitleAct->setText( ddTitle +
" (" + ( mProperty.propertyType() ==
Qgis::PropertyType::Expression ? tr(
"expression" ) : tr(
"field" ) ) +
')' );
351 mDefineMenu->addAction( mActionActive );
352 mActionActive->setText( mProperty.isActive() ? tr(
"Deactivate" ) : tr(
"Activate" ) );
353 mActionActive->setData( QVariant( !mProperty.isActive() ) );
356 if ( !mFullDescription.isEmpty() )
358 mDefineMenu->addAction( mActionDescription );
361 mDefineMenu->addSeparator();
364 if ( mAuxiliaryStorageEnabled && mVectorLayer )
366 mDefineMenu->addAction( mActionCreateAuxiliaryField );
368 const QgsAuxiliaryLayer *alayer = mVectorLayer->auxiliaryLayer();
370 mActionCreateAuxiliaryField->setEnabled(
true );
371 mActionCreateAuxiliaryField->setChecked(
false );
373 int index = mVectorLayer->fields().indexFromName( mFieldName );
375 if ( index >= 0 && alayer && mVectorLayer->isAuxiliaryField( index, srcIndex ) )
377 mActionCreateAuxiliaryField->setEnabled(
false );
378 mActionCreateAuxiliaryField->setChecked(
true );
382 bool fieldActive =
false;
383 if ( !mDataTypesString.isEmpty() )
385 QAction *fieldTitleAct = mDefineMenu->addAction( tr(
"Attribute Field" ) );
386 fieldTitleAct->setFont( titlefont );
387 fieldTitleAct->setEnabled(
false );
389 mDefineMenu->addAction( mActionDataTypes );
391 mFieldsMenu->clear();
393 if ( !mFieldNameList.isEmpty() )
395 for (
int j = 0; j < mFieldNameList.count(); ++j )
397 QString fldname = mFieldNameList.at( j );
398 QAction *act = mFieldsMenu->addAction( mFieldDisplayNameList.at( j ) );
399 act->setIcon( mFieldIcons.at( j ) );
400 act->setData( QVariant( fldname ) );
401 if ( mFieldName == fldname )
403 act->setCheckable(
true );
411 QAction *act = mFieldsMenu->addAction( tr(
"No matching field types found" ) );
412 act->setEnabled(
false );
415 mDefineMenu->addSeparator();
418 mFieldsMenu->menuAction()->setCheckable(
true );
419 mFieldsMenu->menuAction()->setChecked( fieldActive && mProperty.propertyType() ==
Qgis::PropertyType::Field && !mProperty.transformer() );
421 bool colorActive =
false;
422 mColorsMenu->clear();
427 QAction *colorTitleAct = mDefineMenu->addAction( tr(
"Project Color" ) );
428 colorTitleAct->setFont( titlefont );
429 colorTitleAct->setEnabled(
false );
431 QList<QgsProjectColorScheme *> projectSchemes;
433 if ( projectSchemes.length() > 0 )
435 QgsProjectColorScheme *scheme = projectSchemes.at( 0 );
437 for (
const auto &color : colors )
439 if ( color.second.isEmpty() )
443 QAction *act = mColorsMenu->addAction( color.second );
444 act->setIcon( icon );
447 act->setCheckable(
true );
448 act->setChecked(
true );
454 if ( mColorsMenu->actions().isEmpty() )
456 QAction *act = mColorsMenu->addAction( tr(
"No colors set" ) );
457 act->setEnabled(
false );
460 mDefineMenu->addAction( mActionColors );
461 mColorsMenu->menuAction()->setCheckable(
true );
462 mColorsMenu->menuAction()->setChecked( colorActive && !mProperty.transformer() );
464 mDefineMenu->addSeparator();
467 QAction *exprTitleAct = mDefineMenu->addAction( tr(
"Expression" ) );
468 exprTitleAct->setFont( titlefont );
469 exprTitleAct->setEnabled(
false );
471 mVariablesMenu->clear();
472 bool variableActive =
false;
473 if ( mExpressionContextGenerator )
475 QgsExpressionContext context = mExpressionContextGenerator->createExpressionContext();
478 const auto constVariables = variables;
479 for (
const QString &variable : constVariables )
483 if ( variable.startsWith(
'_' ) )
486 QAction *act = mVariablesMenu->addAction( variable );
487 act->setData( QVariant( variable ) );
491 act->setCheckable(
true );
492 act->setChecked(
true );
493 variableActive =
true;
498 if ( mVariablesMenu->actions().isEmpty() )
500 QAction *act = mVariablesMenu->addAction( tr(
"No variables set" ) );
501 act->setEnabled(
false );
504 mDefineMenu->addAction( mActionVariables );
505 mVariablesMenu->menuAction()->setCheckable(
true );
506 mVariablesMenu->menuAction()->setChecked( variableActive && !mProperty.transformer() );
510 QString expString = mExpressionString;
511 if ( expString.length() > 35 )
513 expString.truncate( 35 );
514 expString.append( QChar( 0x2026 ) );
517 expString.prepend( tr(
"Current: " ) );
519 if ( !mActionExpression )
521 mActionExpression =
new QAction( expString,
this );
522 mActionExpression->setCheckable(
true );
526 mActionExpression->setText( expString );
528 mDefineMenu->addAction( mActionExpression );
529 mActionExpression->setChecked( mProperty.propertyType() ==
Qgis::PropertyType::Expression && !variableActive && !colorActive && !mProperty.transformer() );
531 mDefineMenu->addAction( mActionExpDialog );
532 mDefineMenu->addAction( mActionCopyExpr );
533 mDefineMenu->addAction( mActionPasteExpr );
537 mDefineMenu->addAction( mActionExpDialog );
538 mDefineMenu->addAction( mActionPasteExpr );
541 if ( hasExp || !mFieldName.isEmpty() )
543 mDefineMenu->addSeparator();
544 mDefineMenu->addAction( mActionClearExpr );
547 if ( !mDefinition.name().isEmpty() && mDefinition.supportsAssistant() )
549 mDefineMenu->addSeparator();
550 mActionAssistant->setCheckable( mProperty.transformer() );
551 mActionAssistant->setChecked( mProperty.transformer() );
552 mDefineMenu->addAction( mActionAssistant );
556void QgsPropertyOverrideButton::menuActionTriggered( QAction *action )
558 if ( action == mActionActive )
560 setActivePrivate( mActionActive->data().toBool() );
564 else if ( action == mActionDescription )
566 showDescriptionDialog();
568 else if ( action == mActionExpDialog )
570 showExpressionDialog();
572 else if ( action == mActionExpression )
574 mProperty.setExpressionString( mExpressionString );
575 mProperty.setTransformer(
nullptr );
576 setActivePrivate(
true );
581 else if ( action == mActionCopyExpr )
583 QApplication::clipboard()->setText( mExpressionString );
585 else if ( action == mActionPasteExpr )
587 QString exprString = QApplication::clipboard()->text();
588 if ( !exprString.isEmpty() )
590 mExpressionString = exprString;
591 mProperty.setExpressionString( mExpressionString );
592 mProperty.setTransformer(
nullptr );
593 setActivePrivate(
true );
599 else if ( action == mActionClearExpr )
601 setActivePrivate(
false );
602 mProperty.setStaticValue( QVariant() );
603 mProperty.setTransformer(
nullptr );
604 mExpressionString.clear();
610 else if ( action == mActionAssistant )
614 else if ( action == mActionCreateAuxiliaryField )
618 else if ( mFieldsMenu->actions().contains( action ) )
620 if ( action->isEnabled() )
622 if ( mFieldName != action->text() )
624 mFieldName = action->data().toString();
626 mProperty.setField( mFieldName );
627 mProperty.setTransformer(
nullptr );
628 setActivePrivate(
true );
634 else if ( mVariablesMenu->actions().contains( action ) )
636 if ( mExpressionString != action->text().prepend(
"@" ) )
638 mExpressionString = action->data().toString().prepend(
"@" );
640 mProperty.setExpressionString( mExpressionString );
641 mProperty.setTransformer(
nullptr );
642 setActivePrivate(
true );
647 else if ( mColorsMenu->actions().contains( action ) )
649 if ( getColor() != action->text() )
651 mExpressionString = u
"project_color_object('%1')"_s.arg( action->text() );
653 mProperty.setExpressionString( mExpressionString );
654 mProperty.setTransformer(
nullptr );
655 setActivePrivate(
true );
663void QgsPropertyOverrideButton::showDescriptionDialog()
665 QgsMessageViewer *mv =
new QgsMessageViewer(
this );
666 mv->setWindowTitle( tr(
"Data Definition Description" ) );
672void QgsPropertyOverrideButton::showExpressionDialog()
674 QgsExpressionContext context = mExpressionContextGenerator ? mExpressionContextGenerator->createExpressionContext() : QgsExpressionContext();
677 QString currentExpression = ( mProperty.propertyType() ==
Qgis::PropertyType::Static && !mProperty.staticValue().isValid() ) ? QString()
678 : mProperty.asExpression();
680 QgsExpressionBuilderDialog d(
const_cast<QgsVectorLayer *
>( mVectorLayer ), currentExpression,
this, u
"generic"_s, context );
681 d.setExpectedOutputFormat( mInputDescription );
682 if ( d.exec() == QDialog::Accepted )
684 mExpressionString = d.expressionText().trimmed();
685 bool active = mProperty.isActive();
686 mProperty.setExpressionString( mExpressionString );
687 mProperty.setTransformer(
nullptr );
688 mProperty.setActive( !mExpressionString.isEmpty() );
689 if ( mProperty.isActive() !=
active )
698void QgsPropertyOverrideButton::showAssistant()
702 if ( !mProperty.transformer() )
704 ( void ) mProperty.convertToTransformer();
708 QgsPropertyAssistantWidget *widget =
new QgsPropertyAssistantWidget( panel, mDefinition, mProperty, mVectorLayer );
716 mExpressionString = this->mProperty.asExpression();
717 mFieldName = this->mProperty.field();
730 QDialog *dlg =
new QDialog(
this );
731 QString key = u
"/UI/paneldialog/%1"_s.arg( widget->
panelTitle() );
732 QgsSettings settings;
733 dlg->restoreGeometry( settings.
value( key ).toByteArray() );
735 dlg->setLayout(
new QVBoxLayout() );
736 dlg->layout()->addWidget( widget );
737 QDialogButtonBox *buttonBox =
new QDialogButtonBox( QDialogButtonBox::Cancel | QDialogButtonBox::Help | QDialogButtonBox::Ok );
738 connect( buttonBox, &QDialogButtonBox::accepted, dlg, &QDialog::accept );
739 connect( buttonBox, &QDialogButtonBox::rejected, dlg, &QDialog::reject );
740 connect( buttonBox, &QDialogButtonBox::helpRequested,
this, &QgsPropertyOverrideButton::showHelp );
741 dlg->layout()->addWidget( buttonBox );
743 if ( dlg->exec() == QDialog::Accepted )
746 mExpressionString = mProperty.asExpression();
747 mFieldName = mProperty.field();
754 settings.
setValue( key, dlg->saveGeometry() );
758void QgsPropertyOverrideButton::updateGui()
760 bool hasExp = !mExpressionString.isEmpty();
761 bool hasField = !mFieldName.isEmpty();
764 QString deftip = tr(
"undefined" );
768 icon = mProperty.isActive() ?
QgsApplication::getThemeIcon( u
"/mIconDataDefineExpressionOn.svg"_s ) : QgsApplication::getThemeIcon( u
"/mIconDataDefineExpression.svg"_s );
770 const QString colorName = getColor();
771 if ( !colorName.isEmpty() )
773 icon = mProperty.isActive() ?
QgsApplication::getThemeIcon( u
"/mIconDataDefineColorOn.svg"_s ) : QgsApplication::getThemeIcon( u
"/mIconDataDefineColor.svg"_s );
775 deftype = tr(
"project color" );
779 QgsExpression exp( mExpressionString );
780 if ( exp.hasParserError() )
783 deftip = tr(
"Parse error: %1" ).arg( exp.parserErrorString() );
787 deftip = mExpressionString;
793 icon = mProperty.isActive() ?
QgsApplication::getThemeIcon( u
"/mIconDataDefineOn.svg"_s ) : QgsApplication::getThemeIcon( u
"/mIconDataDefine.svg"_s );
795 if ( !mFieldNameList.contains( mFieldName ) && !mProperty.transformer() )
797 icon = QgsApplication::getThemeIcon( u
"/mIconDataDefineError.svg"_s );
798 deftip = tr(
"'%1' field missing" ).arg( mFieldName );
809 mFullDescription.clear();
810 if ( !mDefinition.description().isEmpty() )
812 mFullDescription += u
"<b><u>%1</b></u>"_s.arg( mDefinition.description() );
814 if ( !mDefinition.comment().isEmpty() )
816 mFullDescription += u
"<p><i>%1</i></p>"_s.arg( mDefinition.comment() );
818 else if ( !mFullDescription.isEmpty() )
820 mFullDescription +=
"<br>"_L1;
823 mFullDescription += tr(
"<b>Data defined override</b><br>" );
825 mFullDescription += tr(
"<b>Active: </b>%1 <i>(ctrl|right-click toggles)</i><br>" ).arg( mProperty.isActive() ? tr(
"yes" ) : tr(
"no" ) );
827 if ( !mUsageInfo.isEmpty() )
829 mFullDescription += tr(
"<b>Usage:</b><br>%1<br>" ).arg( mUsageInfo );
832 if ( !mInputDescription.isEmpty() )
834 mFullDescription += tr(
"<b>Expected input:</b><br>%1<br>" ).arg( mInputDescription );
837 if ( !mDataTypesString.isEmpty() )
839 mFullDescription += tr(
"<b>Valid input types:</b><br>%1<br>" ).arg( mDataTypesString );
842 if ( deftype.isEmpty() && deftip != tr(
"undefined" ) )
848 if ( deftip.length() > 75 )
850 deftip.truncate( 75 );
851 deftip.append( QChar( 0x2026 ) );
854 mFullDescription += tr(
"<b>Current definition (%1):</b><br>%2" ).arg( deftype, deftip );
856 setToolTip( mFullDescription );
859void QgsPropertyOverrideButton::setActivePrivate(
bool active )
861 if ( mProperty.isActive() !=
active )
863 mProperty.setActive(
active );
868void QgsPropertyOverrideButton::updateSiblingWidgets(
bool state )
870 const auto constMSiblingWidgets = mSiblingWidgets;
871 for (
const SiblingWidget &sw : constMSiblingWidgets )
873 switch ( sw.mSiblingType )
875 case SiblingCheckState:
880 QAbstractButton *btn = qobject_cast<QAbstractButton *>( sw.mWidgetPointer.data() );
881 if ( btn && btn->isCheckable() )
883 btn->setChecked( sw.mNatural ? state : !state );
887 QGroupBox *grpbx = qobject_cast<QGroupBox *>( sw.mWidgetPointer.data() );
888 if ( grpbx && grpbx->isCheckable() )
890 grpbx->setChecked( sw.mNatural ? state : !state );
897 case SiblingEnableState:
899 QLineEdit *le = qobject_cast<QLineEdit *>( sw.mWidgetPointer.data() );
901 le->setReadOnly( sw.mNatural ? !state : state );
903 sw.mWidgetPointer.data()->setEnabled( sw.mNatural ? state : !state );
907 case SiblingVisibility:
909 sw.mWidgetPointer.data()->setVisible( sw.mNatural ? state : !state );
913 case SiblingExpressionText:
915 QLineEdit *le = qobject_cast<QLineEdit *>( sw.mWidgetPointer.data() );
918 le->setText( mProperty.asExpression() );
922 QTextEdit *te = qobject_cast<QTextEdit *>( sw.mWidgetPointer.data() );
925 te->setText( mProperty.asExpression() );
931 case SiblingLinkedWidget:
933 if ( QgsColorButton *cb = qobject_cast<QgsColorButton *>( sw.mWidgetPointer.data() ) )
935 if ( state && mProperty.isProjectColor() )
937 const QString colorName = getColor();
938 if ( !colorName.isEmpty() )
940 cb->linkToProjectColor( colorName );
945 cb->linkToProjectColor( QString() );
957 if ( mProperty.isActive() !=
active )
959 mProperty.setActive(
active );
968 mExpressionContextGenerator = generator;
973 for (
const SiblingWidget &sw : std::as_const( mSiblingWidgets ) )
975 if ( widget == sw.mWidgetPointer.data() && sw.mSiblingType == SiblingLinkedWidget )
978 mSiblingWidgets.append( SiblingWidget( QPointer<QWidget>( widget ), SiblingLinkedWidget ) );
980 if (
QgsColorButton *cb = qobject_cast<QgsColorButton *>( widget ) )
991void QgsPropertyOverrideButton::showHelp()
996QString QgsPropertyOverrideButton::getColor()
const
998 const thread_local QRegularExpression rx( u
"^project_color(_object|)\\('(.*)'\\)$"_s );
999 QRegularExpressionMatch match = rx.match( mExpressionString );
1000 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.