17#include "moc_qgspainteffectpropertieswidget.cpp"
20#include <QStandardItem>
36 if ( !abstractMetadata )
38 QgsDebugError( QStringLiteral(
"Failed to find paint effect entry in registry: %1" ).arg( name ) );
44 QgsDebugError( QStringLiteral(
"Failed to cast paint effect's metadata: " ) .arg( name ) );
51static void _initWidgetFunctions()
53 static bool sInitialized =
false;
75 _initWidgetFunctions();
77 populateEffectTypes();
81 const int idx = mEffectTypeCombo->findData( effect->
type() );
82 mEffectTypeCombo->setCurrentIndex( idx );
85 updateEffectWidget( effect );
90void QgsPaintEffectPropertiesWidget::populateEffectTypes()
93 const QStringList types = registry->
effects();
95 const auto constTypes = types;
96 for (
const QString &type : constTypes )
99 if ( type == QLatin1String(
"effectStack" ) )
106void QgsPaintEffectPropertiesWidget::updateEffectWidget(
QgsPaintEffect *effect )
110 stackedWidget->setCurrentWidget( pageDummy );
114 if ( stackedWidget->currentWidget() != pageDummy )
117 if (
QgsPaintEffectWidget *pew = qobject_cast< QgsPaintEffectWidget * >( stackedWidget->currentWidget() ) )
119 stackedWidget->removeWidget( stackedWidget->currentWidget() );
130 stackedWidget->addWidget( w );
131 stackedWidget->setCurrentWidget( w );
138 stackedWidget->setCurrentWidget( pageDummy );
147 const QString newEffectType = mEffectTypeCombo->currentData().toString();
148 if ( effect->
type() == newEffectType )
163 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.
#define QgsDebugError(str)
QgsPaintEffectWidget *(* QgsPaintEffectWidgetFunc)()