19 #include <QStandardItem>
21 #include <QMessageBox>
35 if ( !abstractMetadata )
37 QgsDebugMsg( QStringLiteral(
"Failed to find paint effect entry in registry: %1" ).arg( name ) );
43 QgsDebugMsg( QStringLiteral(
"Failed to cast paint effect's metadata: " ) .arg( name ) );
50 static void _initWidgetFunctions()
52 static bool sInitialized =
false;
74 _initWidgetFunctions();
76 populateEffectTypes();
80 const int idx = mEffectTypeCombo->findData( effect->
type() );
81 mEffectTypeCombo->setCurrentIndex( idx );
84 updateEffectWidget( effect );
89 void QgsPaintEffectPropertiesWidget::populateEffectTypes()
92 const QStringList types = registry->
effects();
94 const auto constTypes = types;
95 for (
const QString &type : constTypes )
98 if ( type == QLatin1String(
"effectStack" ) )
105 void QgsPaintEffectPropertiesWidget::updateEffectWidget(
QgsPaintEffect *effect )
109 stackedWidget->setCurrentWidget( pageDummy );
113 if ( stackedWidget->currentWidget() != pageDummy )
116 if (
QgsPaintEffectWidget *pew = qobject_cast< QgsPaintEffectWidget * >( stackedWidget->currentWidget() ) )
118 stackedWidget->removeWidget( stackedWidget->currentWidget() );
129 stackedWidget->addWidget( w );
130 stackedWidget->setCurrentWidget( w );
137 stackedWidget->setCurrentWidget( pageDummy );
146 const QString newEffectType = mEffectTypeCombo->currentData().toString();
147 if ( effect->
type() == newEffectType )
162 updateEffectWidget( newEffect );
static QgsPaintEffectRegistry * paintEffectRegistry()
Returns the application's paint effect registry, used for managing paint effects.
Registry of available paint effects.
QgsPaintEffectAbstractMetadata * effectMetadata(const QString &name) const
Returns the metadata for a specific effect.
QStringList effects() const
Returns a list of known paint effects.
Base class for visual effects which can be applied to QPicture drawings.
virtual QVariantMap properties() const =0
Returns the properties describing the paint effect encoded in a string format.
virtual QString type() const =0
Returns the effect type.
QgsPaintEffectWidget *(* QgsPaintEffectWidgetFunc)()