QGIS API Documentation  2.12.0-Lyon
qgssymbolslistwidget.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  qgssymbolslist.cpp
3  ---------------------
4  begin : June 2012
5  copyright : (C) 2012 by Arunmozhi
6  email : aruntheguy at gmail.com
7  ***************************************************************************
8  * *
9  * This program is free software; you can redistribute it and/or modify *
10  * it under the terms of the GNU General Public License as published by *
11  * the Free Software Foundation; either version 2 of the License, or *
12  * (at your option) any later version. *
13  * *
14  ***************************************************************************/
15 
16 
17 #include "qgssymbolslistwidget.h"
18 
19 #include "qgssizescalewidget.h"
20 
22 #include "qgsdatadefined.h"
23 
24 #include "qgssymbolv2.h"
25 #include "qgsstylev2.h"
26 #include "qgssymbollayerv2utils.h"
27 #include "qgsmarkersymbollayerv2.h"
28 #include "qgsmapcanvas.h"
29 #include "qgsapplication.h"
30 
31 #include <QString>
32 #include <QStringList>
33 #include <QPainter>
34 #include <QIcon>
35 #include <QStandardItemModel>
36 #include <QColorDialog>
37 #include <QInputDialog>
38 #include <QMessageBox>
39 #include <QMenu>
40 #include <QScopedPointer>
41 
42 
44  : QWidget( parent )
45  , mSymbol( symbol )
46  , mStyle( style )
47  , mAdvancedMenu( 0 )
48  , mClipFeaturesAction( 0 )
49  , mLayer( layer )
50  , mMapCanvas( 0 )
51  , mPresetExpressionContext( 0 )
52 {
53  setupUi( this );
54 
56 
57  btnAdvanced->hide(); // advanced button is hidden by default
58  if ( menu ) // show it if there is a menu pointer
59  {
60  mAdvancedMenu = menu;
61  btnAdvanced->show();
62  btnAdvanced->setMenu( mAdvancedMenu );
63  }
64  else
65  {
66  btnAdvanced->setMenu( new QMenu( this ) );
67  }
68  mClipFeaturesAction = new QAction( tr( "Clip features to canvas extent" ), this );
70  connect( mClipFeaturesAction, SIGNAL( toggled( bool ) ), this, SLOT( clipFeaturesToggled( bool ) ) );
71 
72  // populate the groups
73  groupsCombo->addItem( "" );
74  populateGroups();
75  QStringList groups = style->smartgroupNames();
76  Q_FOREACH ( const QString& group, groups )
77  {
78  groupsCombo->addItem( group, QVariant( "smart" ) );
79  }
80 
81  QStandardItemModel* model = new QStandardItemModel( viewSymbols );
82  viewSymbols->setModel( model );
83  connect( viewSymbols->selectionModel(), SIGNAL( currentChanged( const QModelIndex &, const QModelIndex & ) ), this, SLOT( setSymbolFromStyle( const QModelIndex & ) ) );
84 
85  connect( mStyle, SIGNAL( symbolSaved( QString, QgsSymbolV2* ) ), this, SLOT( symbolAddedToStyle( QString, QgsSymbolV2* ) ) );
86  connect( openStyleManagerButton, SIGNAL( pressed() ), this, SLOT( openStyleManager() ) );
87 
88  lblSymbolName->setText( "" );
90 
91  if ( mSymbol )
92  {
94  }
95 
96  // select correct page in stacked widget
97  // there's a correspondence between symbol type number and page numbering => exploit it!
98  stackedWidget->setCurrentIndex( symbol->type() );
99  connect( btnColor, SIGNAL( colorChanged( const QColor& ) ), this, SLOT( setSymbolColor( const QColor& ) ) );
100  connect( spinAngle, SIGNAL( valueChanged( double ) ), this, SLOT( setMarkerAngle( double ) ) );
101  connect( spinSize, SIGNAL( valueChanged( double ) ), this, SLOT( setMarkerSize( double ) ) );
102  connect( spinWidth, SIGNAL( valueChanged( double ) ), this, SLOT( setLineWidth( double ) ) );
103 
104  connect( mRotationDDBtn, SIGNAL( dataDefinedChanged( const QString& ) ), this, SLOT( updateDataDefinedMarkerAngle() ) );
105  connect( mRotationDDBtn, SIGNAL( dataDefinedActivated( bool ) ), this, SLOT( updateDataDefinedMarkerAngle() ) );
106  connect( mSizeDDBtn, SIGNAL( dataDefinedChanged( const QString& ) ), this, SLOT( updateDataDefinedMarkerSize() ) );
107  connect( mSizeDDBtn, SIGNAL( dataDefinedActivated( bool ) ), this, SLOT( updateDataDefinedMarkerSize() ) );
108  connect( mWidthDDBtn, SIGNAL( dataDefinedChanged( const QString& ) ), this, SLOT( updateDataDefinedLineWidth() ) );
109  connect( mWidthDDBtn, SIGNAL( dataDefinedActivated( bool ) ), this, SLOT( updateDataDefinedLineWidth() ) );
110 
111  if ( mSymbol->type() == QgsSymbolV2::Marker && mLayer )
112  mSizeDDBtn->setAssistant( tr( "Size Assistant..." ), new QgsSizeScaleWidget( mLayer, static_cast<const QgsMarkerSymbolV2*>( mSymbol ) ) );
113 
114  // Live color updates are not undoable to child symbol layers
115  btnColor->setAcceptLiveUpdates( false );
116  btnColor->setAllowAlpha( true );
117  btnColor->setColorDialogTitle( tr( "Select color" ) );
118  btnColor->setContext( "symbology" );
119 }
120 
122 {
123  // This action was added to the menu by this widget, clean it up
124  // The menu can be passed in the constructor, so may live longer than this widget
125  btnAdvanced->menu()->removeAction( mClipFeaturesAction );
126 }
127 
129 {
130  mMapCanvas = canvas;
131  Q_FOREACH ( QgsUnitSelectionWidget* unitWidget, findChildren<QgsUnitSelectionWidget*>() )
132  {
133  unitWidget->setMapCanvas( canvas );
134  }
135  Q_FOREACH ( QgsDataDefinedButton* ddButton, findChildren<QgsDataDefinedButton*>() )
136  {
137  if ( ddButton->assistant() )
138  ddButton->assistant()->setMapCanvas( mMapCanvas );
139  }
140 }
141 
143 {
144  return mMapCanvas;
145 }
146 
148 {
149  mPresetExpressionContext = context;
150 }
151 
152 void QgsSymbolsListWidget::populateGroups( const QString& parent, const QString& prepend )
153 {
154  QgsSymbolGroupMap groups = mStyle->childGroupNames( parent );
156  while ( i != groups.constEnd() )
157  {
158  QString text;
159  if ( !prepend.isEmpty() )
160  {
161  text = prepend + "/" + i.value();
162  }
163  else
164  {
165  text = i.value();
166  }
167  groupsCombo->addItem( text, QVariant( i.key() ) );
168  populateGroups( i.value(), text );
169  ++i;
170  }
171 }
172 
174 {
176 }
177 
179 {
180  QSize previewSize = viewSymbols->iconSize();
181  QPixmap p( previewSize );
182  QPainter painter;
183 
184  QStandardItemModel* model = qobject_cast<QStandardItemModel*>( viewSymbols->model() );
185  if ( !model )
186  {
187  return;
188  }
189  model->clear();
190 
191  for ( int i = 0; i < names.count(); i++ )
192  {
193  QgsSymbolV2* s = mStyle->symbol( names[i] );
194  if ( s->type() != mSymbol->type() )
195  {
196  delete s;
197  continue;
198  }
199  QStandardItem* item = new QStandardItem( names[i] );
200  item->setData( names[i], Qt::UserRole ); //so we can load symbol with that name
201  item->setText( names[i] );
202  item->setToolTip( names[i] );
203  item->setFlags( Qt::ItemIsEnabled | Qt::ItemIsSelectable );
204  // Set font to 10points to show reasonable text
205  QFont itemFont = item->font();
206  itemFont.setPointSize( 10 );
207  item->setFont( itemFont );
208  // create preview icon
210  item->setIcon( icon );
211  // add to model
212  model->appendRow( item );
213  delete s;
214  }
215 }
216 
218 {
219  QgsStyleV2ManagerDialog dlg( mStyle, this );
220  dlg.exec();
221 
223 }
224 
226 {
227  if ( !mSymbol )
228  return;
229 
230  mSymbol->setClipFeaturesToExtent( checked );
231  emit changed();
232 }
233 
235 {
236  mSymbol->setColor( color );
237  emit changed();
238 }
239 
241 {
242  QgsMarkerSymbolV2* markerSymbol = static_cast<QgsMarkerSymbolV2*>( mSymbol );
243  if ( markerSymbol->angle() == angle )
244  return;
245  markerSymbol->setAngle( angle );
246  emit changed();
247 }
248 
250 {
251  QgsMarkerSymbolV2* markerSymbol = static_cast<QgsMarkerSymbolV2*>( mSymbol );
252  QgsDataDefined dd = mRotationDDBtn->currentDataDefined();
253 
254  spinAngle->setEnabled( !mRotationDDBtn->isActive() );
255 
256  bool isDefault = dd.hasDefaultValues();
257 
258  if ( // shall we remove datadefined expressions for layers ?
259  ( markerSymbol->dataDefinedAngle().hasDefaultValues() && isDefault )
260  // shall we set the "en masse" expression for properties ?
261  || !isDefault )
262  {
263  markerSymbol->setDataDefinedAngle( dd );
264  emit changed();
265  }
266 }
267 
269 {
270  QgsMarkerSymbolV2* markerSymbol = static_cast<QgsMarkerSymbolV2*>( mSymbol );
271  if ( markerSymbol->size() == size )
272  return;
273  markerSymbol->setSize( size );
274  emit changed();
275 }
276 
278 {
279  QgsMarkerSymbolV2* markerSymbol = static_cast<QgsMarkerSymbolV2*>( mSymbol );
280  QgsDataDefined dd = mSizeDDBtn->currentDataDefined();
281 
282  spinSize->setEnabled( !mSizeDDBtn->isActive() );
283 
284  bool isDefault = dd.hasDefaultValues();
285 
286  if ( // shall we remove datadefined expressions for layers ?
287  ( !markerSymbol->dataDefinedSize().hasDefaultValues() && isDefault )
288  // shall we set the "en masse" expression for properties ?
289  || !isDefault )
290  {
291  markerSymbol->setDataDefinedSize( dd );
292  emit changed();
293  }
294 }
295 
297 {
298  QgsLineSymbolV2* lineSymbol = static_cast<QgsLineSymbolV2*>( mSymbol );
299  if ( lineSymbol->width() == width )
300  return;
301  lineSymbol->setWidth( width );
302  emit changed();
303 }
304 
306 {
307  QgsLineSymbolV2* lineSymbol = static_cast<QgsLineSymbolV2*>( mSymbol );
308  QgsDataDefined dd = mWidthDDBtn->currentDataDefined();
309 
310  spinWidth->setEnabled( !mWidthDDBtn->isActive() );
311 
312  bool isDefault = dd.hasDefaultValues();
313 
314  if ( // shall we remove datadefined expressions for layers ?
315  ( !lineSymbol->dataDefinedWidth().hasDefaultValues() && isDefault )
316  // shall we set the "en masse" expression for properties ?
317  || !isDefault )
318  {
319  lineSymbol->setDataDefinedWidth( dd );
320  emit changed();
321  }
322 }
323 
325 {
326  Q_UNUSED( name );
327  Q_UNUSED( symbol );
329 }
330 
332 {
333  bool ok;
334  QString name = QInputDialog::getText( this, tr( "Symbol name" ),
335  tr( "Please enter name for the symbol:" ), QLineEdit::Normal, tr( "New symbol" ), &ok );
336  if ( !ok || name.isEmpty() )
337  return;
338 
339  // check if there is no symbol with same name
340  if ( mStyle->symbolNames().contains( name ) )
341  {
342  int res = QMessageBox::warning( this, tr( "Save symbol" ),
343  tr( "Symbol with name '%1' already exists. Overwrite?" )
344  .arg( name ),
345  QMessageBox::Yes | QMessageBox::No );
346  if ( res != QMessageBox::Yes )
347  {
348  return;
349  }
350  }
351 
352  // add new symbol to style and re-populate the list
353  mStyle->addSymbol( name, mSymbol->clone() );
354 
355  // make sure the symbol is stored
356  mStyle->saveSymbol( name, mSymbol->clone(), 0, QStringList() );
358 }
359 
361 {
362  if ( mSymbol )
363  {
364 
365  mSymbol->setOutputUnit( mSymbolUnitWidget->unit() );
366  mSymbol->setMapUnitScale( mSymbolUnitWidget->getMapUnitScale() );
367 
368  emit changed();
369  }
370 }
371 
373 {
374  if ( mSymbol )
375  {
376  double alpha = 1 - ( value / 255.0 );
377  mSymbol->setAlpha( alpha );
378  displayTransparency( alpha );
379  emit changed();
380  }
381 }
382 
383 void QgsSymbolsListWidget::displayTransparency( double alpha )
384 {
385  double transparencyPercent = ( 1 - alpha ) * 100;
386  mTransparencyLabel->setText( tr( "Transparency %1%" ).arg(( int ) transparencyPercent ) );
387 }
388 
390 {
391  btnColor->blockSignals( true );
392  btnColor->setColor( mSymbol->color() );
393  btnColor->blockSignals( false );
394 }
395 
396 static QgsExpressionContext _getExpressionContext( const void* context )
397 {
398  const QgsSymbolsListWidget* widget = ( const QgsSymbolsListWidget* ) context;
399 
400  if ( widget->expressionContext() )
401  return QgsExpressionContext( *widget->expressionContext() );
402 
403  //otherwise create a default symbol context
404  QgsExpressionContext expContext;
408 
409  if ( widget->mapCanvas() )
410  {
413  }
414  else
415  {
417  }
418 
419  const QgsVectorLayer* layer = widget->layer();
420  if ( layer )
421  expContext << QgsExpressionContextUtils::layerScope( layer );
422 
423  return expContext;
424 }
425 
427 {
429 
430  Q_FOREACH ( QgsDataDefinedButton* button, findChildren< QgsDataDefinedButton* >() )
431  {
433  }
434 
435  if ( mSymbol->type() == QgsSymbolV2::Marker )
436  {
437  QgsMarkerSymbolV2* markerSymbol = static_cast<QgsMarkerSymbolV2*>( mSymbol );
438  spinSize->setValue( markerSymbol->size() );
439  spinAngle->setValue( markerSymbol->angle() );
440 
441  if ( mLayer )
442  {
443  QgsDataDefined ddSize = markerSymbol->dataDefinedSize();
445  spinSize->setEnabled( !mSizeDDBtn->isActive() );
446  QgsDataDefined ddAngle( markerSymbol->dataDefinedAngle() );
447  mRotationDDBtn->init( mLayer, &ddAngle, QgsDataDefinedButton::AnyType, QgsDataDefinedButton::doubleDesc() );
448  spinAngle->setEnabled( !mRotationDDBtn->isActive() );
449  }
450  else
451  {
452  mSizeDDBtn->setEnabled( false );
453  mRotationDDBtn->setEnabled( false );
454  }
455  }
456  else if ( mSymbol->type() == QgsSymbolV2::Line )
457  {
458  QgsLineSymbolV2* lineSymbol = static_cast<QgsLineSymbolV2*>( mSymbol );
459  spinWidth->setValue( lineSymbol->width() );
460 
461  if ( mLayer )
462  {
463  QgsDataDefined dd( lineSymbol->dataDefinedWidth() );
465  spinWidth->setEnabled( !mWidthDDBtn->isActive() );
466  }
467  else
468  {
469  mWidthDDBtn->setEnabled( false );
470  }
471  }
472 
473  mSymbolUnitWidget->blockSignals( true );
474  mSymbolUnitWidget->setUnit( mSymbol->outputUnit() );
475  mSymbolUnitWidget->setMapUnitScale( mSymbol->mapUnitScale() );
476  mSymbolUnitWidget->blockSignals( false );
477 
478  mTransparencySlider->blockSignals( true );
479  double transparency = 1 - mSymbol->alpha();
480  mTransparencySlider->setValue( transparency * 255 );
481  displayTransparency( mSymbol->alpha() );
482  mTransparencySlider->blockSignals( false );
483 
485  {
486  //add clip features option for line or fill symbols
487  btnAdvanced->menu()->addAction( mClipFeaturesAction );
488  }
489  else
490  {
491  btnAdvanced->menu()->removeAction( mClipFeaturesAction );
492  }
493  btnAdvanced->setVisible( mAdvancedMenu || !btnAdvanced->menu()->isEmpty() );
494 
498 }
499 
501 {
502  QString symbolName = index.data( Qt::UserRole ).toString();
503  lblSymbolName->setText( symbolName );
504  // get new instance of symbol from style
505  QgsSymbolV2* s = mStyle->symbol( symbolName );
507  // remove all symbol layers from original symbol
508  while ( mSymbol->symbolLayerCount() )
510  // move all symbol layers to our symbol
511  while ( s->symbolLayerCount() )
512  {
513  QgsSymbolLayerV2* sl = s->takeSymbolLayer( 0 );
514  mSymbol->appendSymbolLayer( sl );
515  }
516  mSymbol->setAlpha( s->alpha() );
517  mSymbol->setOutputUnit( unit );
518  // delete the temporary symbol
519  delete s;
520 
522  emit changed();
523 }
524 
526 {
527  QStringList symbols;
528  QString text = groupsCombo->itemText( index );
529  // List all symbols when empty list item is selected
530  if ( text.isEmpty() )
531  {
532  symbols = mStyle->symbolNames();
533  }
534  else
535  {
536  int groupid;
537  if ( groupsCombo->itemData( index ).toString() == "smart" )
538  {
539  groupid = mStyle->smartgroupId( text );
540  symbols = mStyle->symbolsOfSmartgroup( QgsStyleV2::SymbolEntity, groupid );
541  }
542  else
543  {
544  groupid = groupsCombo->itemData( index ).toInt();
545  symbols = mStyle->symbolsOfGroup( QgsStyleV2::SymbolEntity, groupid );
546  }
547  }
548  populateSymbols( symbols );
549 }
550 
552 {
554  populateSymbols( symbols );
555 }
void setToolTip(const QString &toolTip)
bool deleteSymbolLayer(int index)
delete symbol layer at specified index
static unsigned index
void setPointSize(int pointSize)
void setClipFeaturesToExtent(bool clipFeaturesToExtent)
Sets whether features drawn by the symbol should be clipped to the render context's extent...
Definition: qgssymbolv2.h:206
void on_mTransparencySlider_valueChanged(int value)
void setLineWidth(double width)
void setupUi(QWidget *widget)
OutputUnit
The unit of the output.
Definition: qgssymbolv2.h:55
void setIcon(const QIcon &icon)
void setDataDefinedAngle(const QgsDataDefined &dd)
Set data defined angle for whole symbol (including all symbol layers).
A container class for data source field mapping or expression.
void setSymbolFromStyle(const QModelIndex &index)
static QString doublePosDesc()
SymbolType type() const
Definition: qgssymbolv2.h:95
bool addSymbol(const QString &name, QgsSymbolV2 *symbol, bool update=false)
add symbol to style. takes symbol's ownership
Definition: qgsstylev2.cpp:83
static QgsExpressionContextScope * atlasScope(const QgsAtlasComposition *atlas)
Creates a new scope which contains variables and functions relating to a QgsAtlasComposition.
void setDataDefinedSize(const QgsDataDefined &dd)
Set data defined size for whole symbol (including all symbol layers).
void setChecked(bool)
double size() const
virtual QgsSymbolV2 * clone() const =0
QgsDataDefined dataDefinedSize() const
Returns data defined size for whole symbol (including all symbol layers).
const_iterator constBegin() const
The output shall be in pixels.
Definition: qgssymbolv2.h:60
QStringList symbolsOfGroup(StyleEntity type, int groupid)
returns the symbolnames of a given groupid
Definition: qgsstylev2.cpp:527
bool contains(const QString &str, Qt::CaseSensitivity cs) const
QgsMapUnitScale mapUnitScale() const
const QgsMapSettings & mapSettings() const
Get access to properties used for map rendering.
int exec()
Line symbol.
Definition: qgssymbolv2.h:71
const QPixmap * icon() const
void setMarkerSize(double size)
void on_groupsCombo_editTextChanged(const QString &text)
QString tr(const char *sourceText, const char *disambiguation, int n)
Map canvas is a class for displaying all GIS data types on a canvas.
Definition: qgsmapcanvas.h:107
const QgsVectorLayer * mLayer
void setWidth(double width)
Marker symbol.
Definition: qgssymbolv2.h:70
QgsDataDefined dataDefinedWidth() const
Returns data defined size for whole symbol (including all symbol layers).
virtual void setData(const QVariant &value, int role)
void setMapUnitScale(const QgsMapUnitScale &scale)
The QgsMapSettings class contains configuration for rendering of the map.
bool isEmpty() const
int width() const
QSize size() const
void setColor(const QColor &color)
const char * name() const
The output shall be in millimeters.
Definition: qgssymbolv2.h:57
static QIcon symbolPreviewIcon(QgsSymbolV2 *symbol, QSize size)
QgsSymbolGroupMap childGroupNames(const QString &parent="")
return a map of groupid and names for the given parent group
Definition: qgsstylev2.cpp:480
int count(const T &value) const
const QgsVectorLayer * layer() const
Returns the vector layer associated with the widget.
double width() const
static QgsExpressionContextScope * globalScope()
Creates a new scope which contains variables and functions relating to the global QGIS context...
virtual void setMapCanvas(QgsMapCanvas *canvas)
Sets the map canvas associated with the widget.
bool appendSymbolLayer(QgsSymbolLayerV2 *layer)
Append symbol layer at the end of the list Ownership will be transferred.
bool saveSymbol(const QString &name, QgsSymbolV2 *symbol, int groupid, const QStringList &tags)
add the symbol to the DB with the tags
Definition: qgsstylev2.cpp:107
const Key & key() const
qreal alpha() const
Get alpha transparency 1 for opaque, 0 for invisible.
Definition: qgssymbolv2.h:191
QgsSymbolsListWidget(QgsSymbolV2 *symbol, QgsStyleV2 *style, QMenu *menu, QWidget *parent, const QgsVectorLayer *layer=0)
void setFlags(QFlags< Qt::ItemFlag > flags)
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
bool isEmpty() const
const_iterator constEnd() const
The output shall be in map unitx.
Definition: qgssymbolv2.h:58
double angle() const
void setAngle(double angle)
void setSymbolColor(const QColor &color)
int symbolLayerCount()
Returns total number of symbol layers contained in the symbol.
Definition: qgssymbolv2.h:122
void setSize(double size)
const T & value() const
void setMarkerAngle(double angle)
QStringList symbolsOfSmartgroup(StyleEntity type, int id)
returns the symbols for the smartgroup
QgsDataDefinedAssistant * assistant()
Returns the assistant used to defined the data defined object properties, if set. ...
Single scope for storing variables and functions for use within a QgsExpressionContext.
QStringList symbolNames()
return a list of names of symbols
Definition: qgsstylev2.cpp:182
QgsExpressionContext * expressionContext() const
Returns the expression context used for the widget, if set.
void setFont(const QFont &font)
A button for defining data source field mappings or expressions.
QString getText(QWidget *parent, const QString &title, const QString &label, QLineEdit::EchoMode mode, const QString &text, bool *ok, QFlags< Qt::WindowType > flags, QFlags< Qt::InputMethodHint > inputMethodHints)
double ANALYSIS_EXPORT angle(Point3D *p1, Point3D *p2, Point3D *p3, Point3D *p4)
Calculates the angle between two segments (in 2 dimension, z-values are ignored)
QgsSymbolV2 * symbol(const QString &name)
return a NEW copy of symbol
Definition: qgsstylev2.cpp:166
bool blockSignals(bool block)
void on_groupsCombo_currentIndexChanged(int index)
virtual ~QgsSymbolsListWidget()
Destructor.
void registerGetExpressionContextCallback(ExpressionContextCallback fnGetExpressionContext, const void *context)
Register callback function for retrieving the expression context for the button.
void setCheckable(bool)
void setText(const QString &text)
void setDataDefinedWidth(const QgsDataDefined &dd)
Set data defined width for whole symbol (including all symbol layers).
void clipFeaturesToggled(bool checked)
QStringList smartgroupNames()
returns the smart groups list
QFont font() const
static QgsExpressionContextScope * mapSettingsScope(const QgsMapSettings &mapSettings)
Creates a new scope which contains variables and functions relating to a QgsMapSettings object...
QgsExpressionContextScope & expressionContextScope()
Returns a reference to the expression context scope for the map canvas.
Definition: qgsmapcanvas.h:429
QgsDataDefined dataDefinedAngle() const
Returns data defined angle for whole symbol (including all symbol layers).
const QgsMapCanvas * mapCanvas() const
Returns the map canvas associated with the widget.
QVariant data(int role) const
void setExpressionContext(QgsExpressionContext *context)
Sets the optional expression context used for the widget.
Fill symbol.
Definition: qgssymbolv2.h:72
QgsSymbolV2::OutputUnit outputUnit() const
StandardButton warning(QWidget *parent, const QString &title, const QString &text, QFlags< QMessageBox::StandardButton > buttons, StandardButton defaultButton)
static QgsExpressionContext _getExpressionContext(const void *context)
void show()
QgsSymbolLayerV2 * takeSymbolLayer(int index)
Remove symbol layer from the list and return pointer to it.
bool hasDefaultValues() const
Returns whether the data defined container is set to all the default values, ie, disabled, with empty expression and no assigned field.
static QgsExpressionContextScope * projectScope()
Creates a new scope which contains variables and functions relating to the current QGIS project...
void setMapCanvas(QgsMapCanvas *canvas)
Sets the map canvas associated with the widget.
static QgsExpressionContextScope * layerScope(const QgsMapLayer *layer)
Creates a new scope which contains variables and functions relating to a QgsMapLayer.
int smartgroupId(const QString &smartgroup)
return the DB id for the given smartgroup name
Definition: qgsstylev2.cpp:972
Widget displaying a combobox allowing the user to choose between millimeter and map units If the user...
bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
void populateSymbols(const QStringList &symbols)
bool clipFeaturesToExtent() const
Returns whether features drawn by the symbol will be clipped to the render context's extent...
Definition: qgssymbolv2.h:216
Represents a vector layer which manages a vector based data sets.
virtual void setMapCanvas(QgsMapCanvas *canvas)
Sets the map canvas associated with the widget.
QString toString() const
void setOutputUnit(QgsSymbolV2::OutputUnit u)
void appendRow(const QList< QStandardItem * > &items)
void setAlpha(qreal alpha)
Set alpha transparency 1 for opaque, 0 for invisible.
Definition: qgssymbolv2.h:193
QStringList findSymbols(StyleEntity type, const QString &qword)
return the names of the symbols which have a matching 'substring' in its defintion ...
Definition: qgsstylev2.cpp:764
QColor color() const
void symbolAddedToStyle(const QString &name, QgsSymbolV2 *symbol)