22 #include <QMessageBox>
23 #include <QInputDialog>
27 :
QWidget(), mLayer( layer ), mStyle( style )
60 if ( symbolList.
size() < 1 )
69 for ( ; symbolIt != symbolList.
end(); ++symbolIt )
71 ( *symbolIt )->setColor( color );
80 if ( symbolList.
size() < 1 )
86 double oldTransparency = ( 1 - symbolList.
at( 0 )->alpha() ) * 100;
87 double transparency =
QInputDialog::getDouble(
this,
tr(
"Transparency" ),
tr(
"Change symbol transparency [%]" ), oldTransparency, 0.0, 100.0, 0, &ok );
91 for ( ; symbolIt != symbolList.
end(); ++symbolIt )
93 ( *symbolIt )->setAlpha( 1 - transparency / 100 );
102 if ( symbolList.
size() < 1 )
108 int currentUnit = ( symbolList.
at( 0 )->outputUnit() ==
QgsSymbolV2::MM ) ? 0 : 1;
115 for ( ; symbolIt != symbolList.
end(); ++symbolIt )
117 ( *symbolIt )->setOutputUnit( unit );
126 if ( symbolList.
size() < 1 )
133 if ( QDialog::Accepted == dlg.
exec() )
135 if ( !dlg.mDDBtn->isActive() )
138 for ( ; symbolIt != symbolList.
end(); ++symbolIt )
141 static_cast<QgsLineSymbolV2*>( *symbolIt )->setWidth( dlg.mSpinBox->
value() );
151 if ( symbolList.
size() < 1 )
158 if ( QDialog::Accepted == dlg.
exec() )
160 if ( !dlg.mDDBtn->isActive() )
163 for ( ; symbolIt != symbolList.
end(); ++symbolIt )
166 static_cast<QgsMarkerSymbolV2*>( *symbolIt )->setSize( dlg.mSpinBox->
value() );
176 if ( symbolList.
size() < 1 )
183 if ( QDialog::Accepted == dlg.
exec() )
185 if ( !dlg.mDDBtn->isActive() )
188 for ( ; symbolIt != symbolList.
end(); ++symbolIt )
191 static_cast<QgsMarkerSymbolV2*>( *symbolIt )->setAngle( dlg.mSpinBox->
value() );
216 :
QObject( menu ), mLayer( layer )
278 bool hasField =
false;
280 for (
int idx = 0; idx < flds.
count(); ++idx )
283 if ( fld.
type() == QVariant::Int || fld.
type() == QVariant::Double )
287 if ( fieldName == fld.
name() )
305 aExpr->
setText(
tr(
"- expression -" ) + fieldName );
320 if ( fldName ==
tr(
"- no field -" ) )
324 else if ( fldName.
startsWith(
tr(
"- expression -" ) ) )
327 expr.
replace( 0,
tr(
"- expression -" ).length(),
"" );
329 if ( !dialog.
exec() )
return;
332 a->
setText(
tr(
"- expression -" ) + fldName );
347 if ( fldName ==
tr(
"- no field -" ) )
351 else if ( fldName.
startsWith(
tr(
"- expression -" ) ) )
354 expr.
replace( 0,
tr(
"- expression -" ).length(),
"" );
356 if ( !dialog.
exec() )
return;
359 a->
setText(
tr(
"- expression -" ) + fldName );
370 if ( a->
text() ==
tr(
"Scale area" ) )
374 else if ( a->
text() ==
tr(
"Scale diameter" ) )
379 #if 0 // MK: is there any reason for this?
380 void QgsRendererV2DataDefinedMenus::updateMenu(
QActionGroup* actionGroup,
QString fieldName )
390 : mSymbolList( symbolList )
395 mLabel->setText( label );
406 mSpinBox->setEnabled( !mDDBtn->isActive() );
423 mSpinBox->setEnabled( !dd.
isActive() );
double value(const QgsSymbolV2 *symbol) const override
void setText(const QString &text)
Class for parsing and evaluation of expressions (formerly called "search strings").
const QString & name() const
Gets the name of the field.
A container class for data source field mapping or expression.
void init(const QString &description)
void setDataDefined(QgsSymbolV2 *symbol, const QgsDataDefined &dd) override
void setDataDefined(QgsSymbolV2 *symbol, const QgsDataDefined &dd) override
QgsDataDefined dataDefinedSize() const
Returns data defined size for whole symbol (including all symbol layers).
const T & at(int i) const
virtual QgsLegendSymbolList legendSymbolItems(double scaleDenominator=-1, QString rule="")
return a list of item text / symbol
Container of fields for a vector layer.
QString tr(const char *sourceText, const char *disambiguation, int n)
double value(const QgsSymbolV2 *symbol) const override
QgsDataDefined dataDefinedWidth() const
Returns data defined size for whole symbol (including all symbol layers).
QgsDataDefined symbolDataDefined() const
bool startsWith(const QString &s, Qt::CaseSensitivity cs) const
int count() const
Return number of items.
QGis::GeometryType geometryType() const
Returns point, line or polygon.
double value(const QgsSymbolV2 *symbol) const override
Encapsulate a field in an attribute table or data source.
virtual double value(const QgsSymbolV2 *) const =0
void setShortcut(const QKeySequence &shortcut)
void setDataDefined(QgsSymbolV2 *symbol, const QgsDataDefined &dd) override
void dataDefinedChanged()
void setUsingSymbolLevels(bool usingSymbolLevels)
QString & replace(int position, int n, QChar after)
QList< QgsSymbolV2 * > mSymbolList
QList< QAction * > actions() const
static QColor getColor(const QColor &initialColor, QWidget *parent, const QString &title=QString(), const bool allowAlpha=false)
Return a color selection from a color dialog.
QgsDataDefined dataDefinedAngle() const
Returns data defined angle for whole symbol (including all symbol layers).
virtual void setDataDefined(QgsSymbolV2 *symbol, const QgsDataDefined &dd)=0
bool usingSymbolLevels() const
const QgsFields & pendingFields() const
returns field list in the to-be-committed state
bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
Represents a vector layer which manages a vector based data sets.
int compare(const QString &other) const
A generic dialog for building expression strings.
QgsDataDefinedValueDialog(const QList< QgsSymbolV2 * > &symbolList, QgsVectorLayer *layer, const QString &label)
Constructor.
QVariant::Type type() const
Gets variant type of the field as it will be retrieved from data source.