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 int idx = mEffectTypeCombo->findData( effect->
type() );
81 mEffectTypeCombo->setCurrentIndex( idx );
84 updateEffectWidget( effect );
89 void QgsPaintEffectPropertiesWidget::populateEffectTypes()
92 QStringList types = registry->
effects();
94 Q_FOREACH (
const QString &type, types )
97 if ( type == QLatin1String(
"effectStack" ) )
104 void QgsPaintEffectPropertiesWidget::updateEffectWidget(
QgsPaintEffect *effect )
108 stackedWidget->setCurrentWidget( pageDummy );
112 if ( stackedWidget->currentWidget() != pageDummy )
115 if (
QgsPaintEffectWidget *pew = qobject_cast< QgsPaintEffectWidget * >( stackedWidget->currentWidget() ) )
117 stackedWidget->removeWidget( stackedWidget->currentWidget() );
128 stackedWidget->addWidget( w );
129 stackedWidget->setCurrentWidget( w );
136 stackedWidget->setCurrentWidget( pageDummy );
145 QString newEffectType = mEffectTypeCombo->currentData().toString();
146 if ( effect->
type() == newEffectType )
161 updateEffectWidget( newEffect );
virtual QgsStringMap properties() const =0
Returns the properties describing the paint effect encoded in a string format.
Base class for visual effects which can be applied to QPicture drawings.
static QgsPaintEffectRegistry * paintEffectRegistry()
Returns the application's paint effect registry, used for managing paint effects. ...
virtual QString type() const =0
Returns the effect type.
QgsPaintEffectWidget *(* QgsPaintEffectWidgetFunc)()
QStringList effects() const
Returns a list of known paint effects.
QgsPaintEffectAbstractMetadata * effectMetadata(const QString &name) const
Returns the metadata for a specific effect.
Registry of available paint effects.