QGIS API Documentation  2.18.21-Las Palmas (9fba24a)
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( nullptr )
48  , mClipFeaturesAction( nullptr )
49  , mLayer( layer )
50  , mMapCanvas( nullptr )
51  , mPresetExpressionContext( nullptr )
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, mSymbol ) );
113  else if ( mSymbol->type() == QgsSymbolV2::Line && mLayer )
114  mWidthDDBtn->setAssistant( tr( "Width Assistant..." ), new QgsSizeScaleWidget( mLayer, mSymbol ) );
115 
116  // Live color updates are not undoable to child symbol layers
117  btnColor->setAcceptLiveUpdates( false );
118  btnColor->setAllowAlpha( true );
119  btnColor->setColorDialogTitle( tr( "Select color" ) );
120  btnColor->setContext( "symbology" );
121 
122  connect( btnSaveSymbol, SIGNAL( clicked() ), this, SLOT( saveSymbol() ) );
123 }
124 
126 {
127  // This action was added to the menu by this widget, clean it up
128  // The menu can be passed in the constructor, so may live longer than this widget
129  btnAdvanced->menu()->removeAction( mClipFeaturesAction );
130 }
131 
133 {
134  mMapCanvas = canvas;
135  Q_FOREACH ( QgsUnitSelectionWidget* unitWidget, findChildren<QgsUnitSelectionWidget*>() )
136  {
137  unitWidget->setMapCanvas( canvas );
138  }
139  Q_FOREACH ( QgsDataDefinedButton* ddButton, findChildren<QgsDataDefinedButton*>() )
140  {
141  if ( ddButton->assistant() )
142  ddButton->assistant()->setMapCanvas( mMapCanvas );
143  }
144 }
145 
147 {
148  return mMapCanvas;
149 }
150 
152 {
153  mPresetExpressionContext = context;
154 }
155 
156 void QgsSymbolsListWidget::populateGroups( const QString& parent, const QString& prepend )
157 {
158  QgsSymbolGroupMap groups = mStyle->childGroupNames( parent );
160  while ( i != groups.constEnd() )
161  {
162  QString text;
163  if ( !prepend.isEmpty() )
164  {
165  text = prepend + '/' + i.value();
166  }
167  else
168  {
169  text = i.value();
170  }
171  groupsCombo->addItem( text, QVariant( i.key() ) );
172  populateGroups( i.value(), text );
173  ++i;
174  }
175 }
176 
178 {
180 }
181 
183 {
184  QSize previewSize = viewSymbols->iconSize();
185 
186  QStandardItemModel* model = qobject_cast<QStandardItemModel*>( viewSymbols->model() );
187  if ( !model )
188  {
189  return;
190  }
191  model->clear();
192 
193  for ( int i = 0; i < names.count(); i++ )
194  {
195  QgsSymbolV2* s = mStyle->symbol( names[i] );
196  if ( s->type() != mSymbol->type() )
197  {
198  delete s;
199  continue;
200  }
201  QStandardItem* item = new QStandardItem( names[i] );
202  item->setData( names[i], Qt::UserRole ); //so we can load symbol with that name
203  item->setText( names[i] );
204  item->setToolTip( names[i] );
205  item->setFlags( Qt::ItemIsEnabled | Qt::ItemIsSelectable );
206  // Set font to 10points to show reasonable text
207  QFont itemFont = item->font();
208  itemFont.setPointSize( 10 );
209  item->setFont( itemFont );
210  // create preview icon
212  item->setIcon( icon );
213  // add to model
214  model->appendRow( item );
215  delete s;
216  }
217 }
218 
220 {
221  QgsStyleV2ManagerDialog dlg( mStyle, this );
222  dlg.exec();
223 
225 }
226 
228 {
229  if ( !mSymbol )
230  return;
231 
232  mSymbol->setClipFeaturesToExtent( checked );
233  emit changed();
234 }
235 
237 {
238  mSymbol->setColor( color );
239  emit changed();
240 }
241 
243 {
244  QgsMarkerSymbolV2* markerSymbol = static_cast<QgsMarkerSymbolV2*>( mSymbol );
245  if ( markerSymbol->angle() == angle )
246  return;
247  markerSymbol->setAngle( angle );
248  emit changed();
249 }
250 
252 {
253  QgsMarkerSymbolV2* markerSymbol = static_cast<QgsMarkerSymbolV2*>( mSymbol );
254  QgsDataDefined dd = mRotationDDBtn->currentDataDefined();
255 
256  spinAngle->setEnabled( !mRotationDDBtn->isActive() );
257 
258  bool isDefault = dd.hasDefaultValues();
259 
260  if ( // shall we remove datadefined expressions for layers ?
261  ( markerSymbol->dataDefinedAngle().hasDefaultValues() && isDefault )
262  // shall we set the "en masse" expression for properties ?
263  || !isDefault )
264  {
265  markerSymbol->setDataDefinedAngle( dd );
266  emit changed();
267  }
268 }
269 
271 {
272  QgsMarkerSymbolV2* markerSymbol = static_cast<QgsMarkerSymbolV2*>( mSymbol );
273  if ( markerSymbol->size() == size )
274  return;
275  markerSymbol->setSize( size );
276  emit changed();
277 }
278 
280 {
281  QgsMarkerSymbolV2* markerSymbol = static_cast<QgsMarkerSymbolV2*>( mSymbol );
282  QgsDataDefined dd = mSizeDDBtn->currentDataDefined();
283 
284  spinSize->setEnabled( !mSizeDDBtn->isActive() );
285 
286  bool isDefault = dd.hasDefaultValues();
287 
288  if ( // shall we remove datadefined expressions for layers ?
289  ( !markerSymbol->dataDefinedSize().hasDefaultValues() && isDefault )
290  // shall we set the "en masse" expression for properties ?
291  || !isDefault )
292  {
293  markerSymbol->setDataDefinedSize( dd );
295  emit changed();
296  }
297 }
298 
300 {
301  QgsLineSymbolV2* lineSymbol = static_cast<QgsLineSymbolV2*>( mSymbol );
302  if ( lineSymbol->width() == width )
303  return;
304  lineSymbol->setWidth( width );
305  emit changed();
306 }
307 
309 {
310  QgsLineSymbolV2* lineSymbol = static_cast<QgsLineSymbolV2*>( mSymbol );
311  QgsDataDefined dd = mWidthDDBtn->currentDataDefined();
312 
313  spinWidth->setEnabled( !mWidthDDBtn->isActive() );
314 
315  bool isDefault = dd.hasDefaultValues();
316 
317  if ( // shall we remove datadefined expressions for layers ?
318  ( !lineSymbol->dataDefinedWidth().hasDefaultValues() && isDefault )
319  // shall we set the "en masse" expression for properties ?
320  || !isDefault )
321  {
322  lineSymbol->setDataDefinedWidth( dd );
323  emit changed();
324  }
325 }
326 
328 {
329  Q_UNUSED( name );
330  Q_UNUSED( symbol );
332 }
333 
335 {
336  bool ok;
337  QString name = QInputDialog::getText( this, tr( "Symbol name" ),
338  tr( "Please enter name for the symbol:" ), QLineEdit::Normal, tr( "New symbol" ), &ok );
339  if ( !ok || name.isEmpty() )
340  return;
341 
342  // check if there is no symbol with same name
343  if ( mStyle->symbolNames().contains( name ) )
344  {
345  int res = QMessageBox::warning( this, tr( "Save symbol" ),
346  tr( "Symbol with name '%1' already exists. Overwrite?" )
347  .arg( name ),
348  QMessageBox::Yes | QMessageBox::No );
349  if ( res != QMessageBox::Yes )
350  {
351  return;
352  }
353  }
354 
355  // add new symbol to style and re-populate the list
356  mStyle->addSymbol( name, mSymbol->clone() );
357 
358  // make sure the symbol is stored
359  mStyle->saveSymbol( name, mSymbol->clone(), 0, QStringList() );
361 }
362 
364 {
365  bool ok;
366  QString name = QInputDialog::getText( this, tr( "Symbol name" ),
367  tr( "Please enter name for the symbol:" ), QLineEdit::Normal, tr( "New symbol" ), &ok );
368  if ( !ok || name.isEmpty() )
369  return;
370 
371  // check if there is no symbol with same name
372  if ( mStyle->symbolNames().contains( name ) )
373  {
374  int res = QMessageBox::warning( this, tr( "Save symbol" ),
375  tr( "Symbol with name '%1' already exists. Overwrite?" )
376  .arg( name ),
377  QMessageBox::Yes | QMessageBox::No );
378  if ( res != QMessageBox::Yes )
379  {
380  return;
381  }
382  }
383 
384  // add new symbol to style and re-populate the list
385  mStyle->addSymbol( name, mSymbol->clone() );
386 
387  // make sure the symbol is stored
388  mStyle->saveSymbol( name, mSymbol->clone(), 0, QStringList() );
389 }
390 
392 {
393  if ( mSymbol )
394  {
395 
396  mSymbol->setOutputUnit( mSymbolUnitWidget->unit() );
397  mSymbol->setMapUnitScale( mSymbolUnitWidget->getMapUnitScale() );
398 
399  emit changed();
400  }
401 }
402 
404 {
405  if ( mSymbol )
406  {
407  double alpha = 1 - ( value / 255.0 );
408  mSymbol->setAlpha( alpha );
409  displayTransparency( alpha );
410  emit changed();
411  }
412 }
413 
414 void QgsSymbolsListWidget::displayTransparency( double alpha )
415 {
416  double transparencyPercent = ( 1 - alpha ) * 100;
417  mTransparencyLabel->setText( tr( "Transparency %1%" ).arg(( int ) transparencyPercent ) );
418 }
419 
421 {
422  btnColor->blockSignals( true );
423  btnColor->setColor( mSymbol->color() );
424  btnColor->blockSignals( false );
425 }
426 
427 static QgsExpressionContext _getExpressionContext( const void* context )
428 {
429  const QgsSymbolsListWidget* widget = ( const QgsSymbolsListWidget* ) context;
430 
431  if ( widget->expressionContext() )
432  return QgsExpressionContext( *widget->expressionContext() );
433 
434  //otherwise create a default symbol context
435  QgsExpressionContext expContext;
439 
440  if ( widget->mapCanvas() )
441  {
444  }
445  else
446  {
448  }
449 
450  const QgsVectorLayer* layer = widget->layer();
451  if ( layer )
452  expContext << QgsExpressionContextUtils::layerScope( layer );
453 
454  return expContext;
455 }
456 
458 {
460 
461  Q_FOREACH ( QgsDataDefinedButton* button, findChildren< QgsDataDefinedButton* >() )
462  {
464  }
465 
466  if ( mSymbol->type() == QgsSymbolV2::Marker )
467  {
468  QgsMarkerSymbolV2* markerSymbol = static_cast<QgsMarkerSymbolV2*>( mSymbol );
469  spinSize->setValue( markerSymbol->size() );
470  spinAngle->setValue( markerSymbol->angle() );
471 
472  if ( mLayer )
473  {
474  QgsDataDefined ddSize = markerSymbol->dataDefinedSize();
476  spinSize->setEnabled( !mSizeDDBtn->isActive() );
477  QgsDataDefined ddAngle( markerSymbol->dataDefinedAngle() );
478  mRotationDDBtn->init( mLayer, &ddAngle, QgsDataDefinedButton::AnyType, QgsDataDefinedButton::doubleDesc() );
479  spinAngle->setEnabled( !mRotationDDBtn->isActive() );
480  }
481  else
482  {
483  mSizeDDBtn->setEnabled( false );
484  mRotationDDBtn->setEnabled( false );
485  }
486  }
487  else if ( mSymbol->type() == QgsSymbolV2::Line )
488  {
489  QgsLineSymbolV2* lineSymbol = static_cast<QgsLineSymbolV2*>( mSymbol );
490  spinWidth->setValue( lineSymbol->width() );
491 
492  if ( mLayer )
493  {
494  QgsDataDefined dd( lineSymbol->dataDefinedWidth() );
496  spinWidth->setEnabled( !mWidthDDBtn->isActive() );
497  }
498  else
499  {
500  mWidthDDBtn->setEnabled( false );
501  }
502  }
503 
504  mSymbolUnitWidget->blockSignals( true );
505  mSymbolUnitWidget->setUnit( mSymbol->outputUnit() );
506  mSymbolUnitWidget->setMapUnitScale( mSymbol->mapUnitScale() );
507  mSymbolUnitWidget->blockSignals( false );
508 
509  mTransparencySlider->blockSignals( true );
510  double transparency = 1 - mSymbol->alpha();
511  mTransparencySlider->setValue( transparency * 255 );
512  displayTransparency( mSymbol->alpha() );
513  mTransparencySlider->blockSignals( false );
514 
516  {
517  //add clip features option for line or fill symbols
518  btnAdvanced->menu()->addAction( mClipFeaturesAction );
519  }
520  else
521  {
522  btnAdvanced->menu()->removeAction( mClipFeaturesAction );
523  }
524  btnAdvanced->setVisible( mAdvancedMenu || !btnAdvanced->menu()->isEmpty() );
525 
529 }
530 
532 {
533  QString symbolName = index.data( Qt::UserRole ).toString();
534  lblSymbolName->setText( symbolName );
535  // get new instance of symbol from style
536  QgsSymbolV2* s = mStyle->symbol( symbolName );
538  // remove all symbol layers from original symbol
539  while ( mSymbol->symbolLayerCount() )
541  // move all symbol layers to our symbol
542  while ( s->symbolLayerCount() )
543  {
544  QgsSymbolLayerV2* sl = s->takeSymbolLayer( 0 );
545  mSymbol->appendSymbolLayer( sl );
546  }
547  mSymbol->setAlpha( s->alpha() );
548  mSymbol->setOutputUnit( unit );
549  // delete the temporary symbol
550  delete s;
551 
553  emit changed();
554 }
555 
557 {
558  QStringList symbols;
559  QString text = groupsCombo->itemText( index );
560  // List all symbols when empty list item is selected
561  if ( text.isEmpty() )
562  {
563  symbols = mStyle->symbolNames();
564  }
565  else
566  {
567  int groupid;
568  if ( groupsCombo->itemData( index ).toString() == "smart" )
569  {
570  groupid = mStyle->smartgroupId( text );
571  symbols = mStyle->symbolsOfSmartgroup( QgsStyleV2::SymbolEntity, groupid );
572  }
573  else
574  {
575  groupid = groupsCombo->itemData( index ).toInt();
576  symbols = mStyle->symbolsOfGroup( QgsStyleV2::SymbolEntity, groupid );
577  }
578  }
579  populateSymbols( symbols );
580 }
581 
583 {
585  populateSymbols( symbols );
586 }
QgsDataDefined dataDefinedAngle() const
Returns data defined angle for whole symbol (including all symbol layers).
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&#39;s extent...
Definition: qgssymbolv2.h:219
void on_mTransparencySlider_valueChanged(int value)
void setLineWidth(double width)
double angle() const
Returns the marker angle for the whole symbol.
QgsSymbolsListWidget(QgsSymbolV2 *symbol, QgsStyleV2 *style, QMenu *menu, QWidget *parent, const QgsVectorLayer *layer=nullptr)
void setupUi(QWidget *widget)
OutputUnit
The unit of the output.
Definition: qgssymbolv2.h:65
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)
const QgsMapCanvas * mapCanvas() const
Returns the map canvas associated with the widget.
static QString doublePosDesc()
bool addSymbol(const QString &name, QgsSymbolV2 *symbol, bool update=false)
add symbol to style. takes symbol&#39;s ownership
Definition: qgsstylev2.cpp:81
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)
virtual QgsSymbolV2 * clone() const =0
const_iterator constBegin() const
The output shall be in pixels.
Definition: qgssymbolv2.h:70
Calculate scale by the diameter.
Definition: qgssymbolv2.h:93
QStringList symbolsOfGroup(StyleEntity type, int groupid)
returns the symbolnames of a given groupid
Definition: qgsstylev2.cpp:538
bool contains(const QString &str, Qt::CaseSensitivity cs) const
int exec()
SymbolType type() const
Definition: qgssymbolv2.h:107
Line symbol.
Definition: qgssymbolv2.h:82
double size() const
Returns the size for the whole symbol, which is the maximum size of all marker symbol layers in the s...
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:109
const QgsVectorLayer * mLayer
void setWidth(double width)
Marker symbol.
Definition: qgssymbolv2.h:81
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
QgsDataDefined dataDefinedWidth() const
Returns data defined size for whole symbol (including all symbol layers).
The output shall be in millimeters.
Definition: qgssymbolv2.h:67
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:491
int count(const T &value) 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:105
const Key & key() const
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:68
void setAngle(double angle)
Sets the angle for the whole symbol.
void setSymbolColor(const QColor &color)
int symbolLayerCount()
Returns total number of symbol layers contained in the symbol.
Definition: qgssymbolv2.h:134
void setSize(double size)
Sets the size for the whole symbol.
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.
QgsMapUnitScale mapUnitScale() const
QStringList symbolNames()
return a list of names of symbols
Definition: qgsstylev2.cpp:180
qreal alpha() const
Get alpha transparency 1 for opaque, 0 for invisible.
Definition: qgssymbolv2.h:204
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)
const QgsVectorLayer * layer() const
Returns the vector layer associated with the widget.
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:164
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.
bool clipFeaturesToExtent() const
Returns whether features drawn by the symbol will be clipped to the render context&#39;s extent...
Definition: qgssymbolv2.h:229
void setCheckable(bool)
const QgsMapSettings & mapSettings() const
Get access to properties used for map rendering.
void setText(const QString &text)
QgsSymbolV2::OutputUnit outputUnit() const
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:455
QVariant data(int role) const
QgsDataDefined dataDefinedSize() const
Returns data defined size for whole symbol (including all symbol layers).
QColor color() const
void setExpressionContext(QgsExpressionContext *context)
Sets the optional expression context used for the widget.
Fill symbol.
Definition: qgssymbolv2.h:83
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.
static QgsExpressionContextScope * projectScope()
Creates a new scope which contains variables and functions relating to the current QGIS project...
double width() const
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.
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.
int smartgroupId(const QString &smartgroup)
return the DB id for the given smartgroup name
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)
QgsExpressionContext * expressionContext() const
Returns the expression context used for the widget, if set.
QObject * parent() const
void populateSymbols(const QStringList &symbols)
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:206
void setScaleMethod(QgsSymbolV2::ScaleMethod scaleMethod)
QStringList findSymbols(StyleEntity type, const QString &qword)
return the names of the symbols which have a matching &#39;substring&#39; in its defintion ...
Definition: qgsstylev2.cpp:796
void symbolAddedToStyle(const QString &name, QgsSymbolV2 *symbol)