QGIS API Documentation 3.34.0-Prizren (ffbdd678812)
Loading...
Searching...
No Matches
qgsrendererwidget.cpp
Go to the documentation of this file.
1/***************************************************************************
2 qgsrendererwidget.cpp
3 ---------------------
4 begin : November 2009
5 copyright : (C) 2009 by Martin Dobias
6 email : wonder dot sk at gmail dot 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#include "qgsrendererwidget.h"
16
18#include "qgssymbol.h"
19#include "qgsvectorlayer.h"
20#include "qgscolordialog.h"
22#include "qgssymbollayer.h"
23#include "qgsmapcanvas.h"
24#include "qgspanelwidget.h"
25#include "qgsproject.h"
27#include "qgssymbollayerutils.h"
29#include "qgsmarkersymbol.h"
30#include "qgslinesymbol.h"
31
32#include <QMessageBox>
33#include <QInputDialog>
34#include <QMenu>
35#include <QClipboard>
36
38 : mLayer( layer )
39 , mStyle( style )
40{
41 contextMenu = new QMenu( tr( "Renderer Options" ), this );
42
43 mCopyAction = new QAction( tr( "Copy" ), this );
44 connect( mCopyAction, &QAction::triggered, this, &QgsRendererWidget::copy );
45 mCopyAction->setShortcut( QKeySequence( QKeySequence::Copy ) );
46 mPasteAction = new QAction( tr( "Paste" ), this );
47 mPasteAction->setShortcut( QKeySequence( QKeySequence::Paste ) );
48 connect( mPasteAction, &QAction::triggered, this, &QgsRendererWidget::paste );
49
50 mCopySymbolAction = new QAction( tr( "Copy Symbol" ), this );
51 contextMenu->addAction( mCopySymbolAction );
52 connect( mCopySymbolAction, &QAction::triggered, this, &QgsRendererWidget::copySymbol );
53 mPasteSymbolAction = new QAction( tr( "Paste Symbol" ), this );
54 contextMenu->addAction( mPasteSymbolAction );
55 connect( mPasteSymbolAction, &QAction::triggered, this, &QgsRendererWidget::pasteSymbolToSelection );
56
57 contextMenu->addSeparator();
58 contextMenu->addAction( tr( "Change Color…" ), this, SLOT( changeSymbolColor() ) );
59 contextMenu->addAction( tr( "Change Opacity…" ), this, SLOT( changeSymbolOpacity() ) );
60 contextMenu->addAction( tr( "Change Output Unit…" ), this, SLOT( changeSymbolUnit() ) );
61
63 {
64 contextMenu->addAction( tr( "Change Width…" ), this, SLOT( changeSymbolWidth() ) );
65 }
67 {
68 contextMenu->addAction( tr( "Change Size…" ), this, SLOT( changeSymbolSize() ) );
69 contextMenu->addAction( tr( "Change Angle…" ), this, SLOT( changeSymbolAngle() ) );
70 }
71
72 connect( contextMenu, &QMenu::aboutToShow, this, [ = ]
73 {
74 const std::unique_ptr< QgsSymbol > tempSymbol( QgsSymbolLayerUtils::symbolFromMimeData( QApplication::clipboard()->mimeData() ) );
75 mPasteSymbolAction->setEnabled( static_cast< bool >( tempSymbol ) );
76 } );
77}
78
80{
81 contextMenu->exec( QCursor::pos() );
82}
83
85{
86 const QList<QgsSymbol *> symbolList = selectedSymbols();
87 if ( symbolList.isEmpty() )
88 {
89 return;
90 }
91
92 QgsSymbol *firstSymbol = nullptr;
93 for ( QgsSymbol *symbol : symbolList )
94 {
95 if ( symbol )
96 {
97 firstSymbol = symbol;
98 break;
99 }
100 }
101 if ( !firstSymbol )
102 return;
103
104 const QColor currentColor = firstSymbol->color();
105
106 QgsPanelWidget *panel = QgsPanelWidget::findParentPanel( qobject_cast< QWidget * >( parent() ) );
107 if ( panel && panel->dockMode() )
108 {
110 colorWidget->setPanelTitle( tr( "Change Symbol Color" ) );
111 colorWidget->setAllowOpacity( true );
112 connect( colorWidget, &QgsCompoundColorWidget::currentColorChanged, this, [ = ]( const QColor & color )
113 {
114 for ( QgsSymbol *symbol : symbolList )
115 {
116 if ( symbol )
117 symbol->setColor( color );
118 }
120 } );
121 panel->openPanel( colorWidget );
122 }
123 else
124 {
125 // modal dialog version... yuck
126 const QColor color = QgsColorDialog::getColor( firstSymbol->color(), this, QStringLiteral( "Change Symbol Color" ), true );
127 if ( color.isValid() )
128 {
129 for ( QgsSymbol *symbol : symbolList )
130 {
131 if ( symbol )
132 symbol->setColor( color );
133 }
135 }
136 }
137}
138
140{
141 const QList<QgsSymbol *> symbolList = selectedSymbols();
142 if ( symbolList.isEmpty() )
143 {
144 return;
145 }
146
147 QgsSymbol *firstSymbol = nullptr;
148 const auto constSymbolList = symbolList;
149 for ( QgsSymbol *symbol : constSymbolList )
150 {
151 if ( symbol )
152 {
153 firstSymbol = symbol;
154 break;
155 }
156 }
157 if ( !firstSymbol )
158 return;
159
160 bool ok;
161 const double oldOpacity = firstSymbol->opacity() * 100; // convert to %
162 const double opacity = QInputDialog::getDouble( this, tr( "Opacity" ), tr( "Change symbol opacity [%]" ), oldOpacity, 0.0, 100.0, 1, &ok );
163 if ( ok )
164 {
165 const auto constSymbolList = symbolList;
166 for ( QgsSymbol *symbol : constSymbolList )
167 {
168 if ( symbol )
169 symbol->setOpacity( opacity / 100.0 );
170 }
172 }
173}
174
176{
177 const QList<QgsSymbol *> symbolList = selectedSymbols();
178 if ( symbolList.isEmpty() )
179 {
180 return;
181 }
182
183 QgsSymbol *firstSymbol = nullptr;
184 const auto constSymbolList = symbolList;
185 for ( QgsSymbol *symbol : constSymbolList )
186 {
187 if ( symbol )
188 {
189 firstSymbol = symbol;
190 break;
191 }
192 }
193 if ( !firstSymbol )
194 return;
195
196 bool ok;
197 const int currentUnit = ( firstSymbol->outputUnit() == Qgis::RenderUnit::Millimeters ) ? 0 : 1;
198 const QString item = QInputDialog::getItem( this, tr( "Symbol unit" ), tr( "Select symbol unit" ), QStringList() << tr( "Millimeter" ) << tr( "Map unit" ), currentUnit, false, &ok );
199 if ( ok )
200 {
201 const Qgis::RenderUnit unit = ( item.compare( tr( "Millimeter" ) ) == 0 ) ? Qgis::RenderUnit::Millimeters : Qgis::RenderUnit::MapUnits;
202
203 const auto constSymbolList = symbolList;
204 for ( QgsSymbol *symbol : constSymbolList )
205 {
206 if ( symbol )
207 symbol->setOutputUnit( unit );
208 }
210 }
211}
212
214{
215 const QList<QgsSymbol *> symbolList = selectedSymbols();
216 if ( symbolList.isEmpty() )
217 {
218 return;
219 }
220
221 QgsDataDefinedWidthDialog dlg( symbolList, mLayer );
222
223 dlg.setContext( mContext );
224
225 if ( QDialog::Accepted == dlg.exec() )
226 {
227 if ( !dlg.mDDBtn->isActive() )
228 {
229 const auto constSymbolList = symbolList;
230 for ( QgsSymbol *symbol : constSymbolList )
231 {
232 if ( !symbol )
233 continue;
234
235 if ( symbol->type() == Qgis::SymbolType::Line )
236 static_cast<QgsLineSymbol *>( symbol )->setWidth( dlg.mSpinBox->value() );
237 }
238 }
240 }
241}
242
244{
245 const QList<QgsSymbol *> symbolList = selectedSymbols();
246 if ( symbolList.isEmpty() )
247 {
248 return;
249 }
250
251 QgsDataDefinedSizeDialog dlg( symbolList, mLayer );
252 dlg.setContext( mContext );
253
254 if ( QDialog::Accepted == dlg.exec() )
255 {
256 if ( !dlg.mDDBtn->isActive() )
257 {
258 const auto constSymbolList = symbolList;
259 for ( QgsSymbol *symbol : constSymbolList )
260 {
261 if ( !symbol )
262 continue;
263
264 if ( symbol->type() == Qgis::SymbolType::Marker )
265 static_cast<QgsMarkerSymbol *>( symbol )->setSize( dlg.mSpinBox->value() );
266 }
267 }
269 }
270}
271
273{
274 const QList<QgsSymbol *> symbolList = selectedSymbols();
275 if ( symbolList.isEmpty() )
276 {
277 return;
278 }
279
280 QgsDataDefinedRotationDialog dlg( symbolList, mLayer );
281 dlg.setContext( mContext );
282
283 if ( QDialog::Accepted == dlg.exec() )
284 {
285 if ( !dlg.mDDBtn->isActive() )
286 {
287 const auto constSymbolList = symbolList;
288 for ( QgsSymbol *symbol : constSymbolList )
289 {
290 if ( !symbol )
291 continue;
292
293 if ( symbol->type() == Qgis::SymbolType::Marker )
294 static_cast<QgsMarkerSymbol *>( symbol )->setAngle( dlg.mSpinBox->value() );
295 }
296 }
298 }
299}
300
305
306void QgsRendererWidget::copySymbol()
307{
308 const QList<QgsSymbol *> symbolList = selectedSymbols();
309 if ( symbolList.isEmpty() )
310 {
311 return;
312 }
313
314 QApplication::clipboard()->setMimeData( QgsSymbolLayerUtils::symbolToMimeData( symbolList.at( 0 ) ) );
315}
316
318{
320 if ( panel && panel->dockMode() )
321 {
323 widget->setPanelTitle( tr( "Symbol Levels" ) );
324 connect( widget, &QgsPanelWidget::widgetChanged, this, [ = ]()
325 {
326 setSymbolLevels( widget->symbolLevels(), widget->usingLevels() );
327 } );
328 panel->openPanel( widget );
329 }
330 else
331 {
332 QgsSymbolLevelsDialog dlg( r, r->usingSymbolLevels(), panel );
333 if ( dlg.exec() )
334 {
336 }
337 }
338}
339
344
349
351{
352 apply();
353}
354
356{
357 if ( dockMode )
358 {
359 // when in dock mode, these shortcuts conflict with the main window shortcuts and cannot be used
360 if ( mCopyAction )
361 mCopyAction->setShortcut( QKeySequence() );
362 if ( mPasteAction )
363 mPasteAction->setShortcut( QKeySequence() );
364 }
366}
367
371
373{
374 const QgsProperty ddSize = symbol->dataDefinedSize();
375 if ( !ddSize || !ddSize.isActive() )
376 {
377 QMessageBox::warning( this, tr( "Data-defined Size Legend" ), tr( "Data-defined size is not enabled!" ) );
378 return nullptr;
379 }
380
381 QgsDataDefinedSizeLegendWidget *panel = new QgsDataDefinedSizeLegendWidget( ddsLegend, ddSize, symbol->clone(), mContext.mapCanvas() );
383 return panel;
384}
385
386void QgsRendererWidget::setSymbolLevels( const QList< QgsLegendSymbolItem > &, bool )
387{
388
389}
390
391//
392// QgsDataDefinedValueDialog
393//
394
395QgsDataDefinedValueDialog::QgsDataDefinedValueDialog( const QList<QgsSymbol *> &symbolList, QgsVectorLayer *layer, const QString &label )
396 : mSymbolList( symbolList )
397 , mLayer( layer )
398{
399 setupUi( this );
400 setWindowFlags( Qt::WindowStaysOnTopHint );
401 mLabel->setText( label );
403}
404
406{
407 mContext = context;
408}
409
411{
412 return mContext;
413}
414
415QgsExpressionContext QgsDataDefinedValueDialog::createExpressionContext() const
416{
417 QgsExpressionContext expContext;
421 if ( auto *lMapCanvas = mContext.mapCanvas() )
422 {
423 expContext << QgsExpressionContextUtils::mapSettingsScope( lMapCanvas->mapSettings() )
424 << new QgsExpressionContextScope( lMapCanvas->expressionContextScope() );
425
426 if ( const QgsExpressionContextScopeGenerator *generator = dynamic_cast< const QgsExpressionContextScopeGenerator * >( lMapCanvas->temporalController() ) )
427 {
428 expContext << generator->createExpressionContextScope();
429 }
430 }
431 else
432 {
434 }
435
436 if ( auto *lVectorLayer = vectorLayer() )
437 expContext << QgsExpressionContextUtils::layerScope( lVectorLayer );
438
439 // additional scopes
440 const auto constAdditionalExpressionContextScopes = mContext.additionalExpressionContextScopes();
441 for ( const QgsExpressionContextScope &scope : constAdditionalExpressionContextScopes )
442 {
443 expContext.appendScope( new QgsExpressionContextScope( scope ) );
444 }
445
446 return expContext;
447}
448
449void QgsDataDefinedValueDialog::init( int propertyKey )
450{
451 const QgsProperty dd( symbolDataDefined() );
452
453 mDDBtn->init( propertyKey, dd, QgsSymbolLayer::propertyDefinitions(), mLayer );
454 mDDBtn->registerExpressionContextGenerator( this );
455
456 QgsSymbol *initialSymbol = nullptr;
457 const auto constMSymbolList = mSymbolList;
458 for ( QgsSymbol *symbol : constMSymbolList )
459 {
460 if ( symbol )
461 {
462 initialSymbol = symbol;
463 }
464 }
465 mSpinBox->setValue( initialSymbol ? value( initialSymbol ) : 0 );
466 mSpinBox->setEnabled( !mDDBtn->isActive() );
467}
468
469QgsProperty QgsDataDefinedValueDialog::symbolDataDefined() const
470{
471 if ( mSymbolList.isEmpty() || !mSymbolList.back() )
472 return QgsProperty();
473
474 // check that all symbols share the same size expression
475 const QgsProperty dd = symbolDataDefined( mSymbolList.back() );
476 const auto constMSymbolList = mSymbolList;
477 for ( QgsSymbol *it : constMSymbolList )
478 {
479 const QgsProperty symbolDD( symbolDataDefined( it ) );
480 if ( !it || !dd || !symbolDD || symbolDD != dd )
481 return QgsProperty();
482 }
483 return dd;
484}
485
487{
488 const QgsProperty dd( mDDBtn->toProperty() );
489 mSpinBox->setEnabled( !dd.isActive() );
490
491 const QgsProperty symbolDD( symbolDataDefined() );
492
493 if ( // shall we remove datadefined expressions for layers ?
494 ( symbolDD && symbolDD.isActive() && !dd.isActive() )
495 // shall we set the "en masse" expression for properties ?
496 || dd.isActive() )
497 {
498 const auto constMSymbolList = mSymbolList;
499 for ( QgsSymbol *it : constMSymbolList )
500 setDataDefined( it, dd );
501 }
502}
503
504QgsDataDefinedSizeDialog::QgsDataDefinedSizeDialog( const QList<QgsSymbol *> &symbolList, QgsVectorLayer *layer )
505 : QgsDataDefinedValueDialog( symbolList, layer, tr( "Size" ) )
506{
508 if ( !symbolList.isEmpty() && symbolList.at( 0 ) && vectorLayer() )
509 {
510 mAssistantSymbol.reset( static_cast<const QgsMarkerSymbol *>( symbolList.at( 0 ) )->clone() );
511 mDDBtn->setSymbol( mAssistantSymbol );
512 }
513}
514
516{
517 const QgsMarkerSymbol *marker = static_cast<const QgsMarkerSymbol *>( symbol );
518 return marker->dataDefinedSize();
519}
520
521double QgsDataDefinedSizeDialog::value( const QgsSymbol *symbol ) const
522{
523 return static_cast<const QgsMarkerSymbol *>( symbol )->size();
524}
525
527{
528 static_cast<QgsMarkerSymbol *>( symbol )->setDataDefinedSize( dd );
529 static_cast<QgsMarkerSymbol *>( symbol )->setScaleMethod( Qgis::ScaleMethod::ScaleDiameter );
530}
531
532
534 : QgsDataDefinedValueDialog( symbolList, layer, tr( "Rotation" ) )
535{
537}
538
540{
541 const QgsMarkerSymbol *marker = static_cast<const QgsMarkerSymbol *>( symbol );
542 return marker->dataDefinedAngle();
543}
544
546{
547 return static_cast<const QgsMarkerSymbol *>( symbol )->angle();
548}
549
551{
552 static_cast<QgsMarkerSymbol *>( symbol )->setDataDefinedAngle( dd );
553}
554
555
556QgsDataDefinedWidthDialog::QgsDataDefinedWidthDialog( const QList<QgsSymbol *> &symbolList, QgsVectorLayer *layer )
557 : QgsDataDefinedValueDialog( symbolList, layer, tr( "Width" ) )
558{
560}
561
563{
564 const QgsLineSymbol *line = static_cast<const QgsLineSymbol *>( symbol );
565 return line->dataDefinedWidth();
566}
567
568double QgsDataDefinedWidthDialog::value( const QgsSymbol *symbol ) const
569{
570 return static_cast<const QgsLineSymbol *>( symbol )->width();
571}
572
574{
575 static_cast<QgsLineSymbol *>( symbol )->setDataDefinedWidth( dd );
576}
577
578void QgsRendererWidget::apply()
579{
580
581}
@ ScaleDiameter
Calculate scale by the diameter.
RenderUnit
Rendering size units.
Definition qgis.h:3627
@ Millimeters
Millimeters.
@ MapUnits
Map units.
@ Marker
Marker symbol.
@ Line
Line symbol.
static QColor getColor(const QColor &initialColor, QWidget *parent, const QString &title=QString(), bool allowOpacity=false)
Returns a color selection from a color dialog.
A custom QGIS widget for selecting a color, including options for selecting colors via hue wheel,...
@ LayoutVertical
Use a narrower, vertically stacked layout.
void currentColorChanged(const QColor &color)
Emitted when the dialog's color changes.
void setAllowOpacity(bool allowOpacity)
Sets whether opacity modification (transparency) is permitted for the color dialog.
void setColor(const QColor &color)
Sets the current color for the dialog.
void setDataDefined(QgsSymbol *symbol, const QgsProperty &dd) override
QgsDataDefinedRotationDialog(const QList< QgsSymbol * > &symbolList, QgsVectorLayer *layer)
double value(const QgsSymbol *symbol) const override
QgsProperty symbolDataDefined(const QgsSymbol *symbol) const override
QgsProperty symbolDataDefined(const QgsSymbol *symbol) const override
void setDataDefined(QgsSymbol *symbol, const QgsProperty &dd) override
double value(const QgsSymbol *symbol) const override
QgsDataDefinedSizeDialog(const QList< QgsSymbol * > &symbolList, QgsVectorLayer *layer)
Widget for configuration of appearance of legend for marker symbols with data-defined size.
Object that keeps configuration of appearance of marker symbol's data-defined size in legend.
Utility classes for "en masse" size definition.
void setContext(const QgsSymbolWidgetContext &context)
Sets the context in which the symbol widget is shown, e.g., the associated map canvas and expression ...
QgsDataDefinedValueDialog(const QList< QgsSymbol * > &symbolList, QgsVectorLayer *layer, const QString &label)
Constructor.
const QgsVectorLayer * vectorLayer() const
Returns the vector layer associated with the widget.
QgsSymbolWidgetContext context() const
Returns the context in which the symbol widget is shown, e.g., the associated map canvas and expressi...
void init(int propertyKey)
Should be called in the constructor of child classes.
QgsProperty symbolDataDefined(const QgsSymbol *symbol) const override
double value(const QgsSymbol *symbol) const override
void setDataDefined(QgsSymbol *symbol, const QgsProperty &dd) override
QgsDataDefinedWidthDialog(const QList< QgsSymbol * > &symbolList, QgsVectorLayer *layer)
Abstract interface for generating an expression context scope.
Single scope for storing variables and functions for use within a QgsExpressionContext.
static QgsExpressionContextScope * projectScope(const QgsProject *project)
Creates a new scope which contains variables and functions relating to a QGIS project.
static QgsExpressionContextScope * atlasScope(const QgsLayoutAtlas *atlas)
Creates a new scope which contains variables and functions relating to a QgsLayoutAtlas.
static QgsExpressionContextScope * mapSettingsScope(const QgsMapSettings &mapSettings)
Creates a new scope which contains variables and functions relating to a QgsMapSettings object.
static QgsExpressionContextScope * layerScope(const QgsMapLayer *layer)
Creates a new scope which contains variables and functions relating to a QgsMapLayer.
static QgsExpressionContextScope * globalScope()
Creates a new scope which contains variables and functions relating to the global QGIS context.
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
void appendScope(QgsExpressionContextScope *scope)
Appends a scope to the end of the context.
virtual QgsLegendSymbolList legendSymbolItems() const
Returns a list of symbology items for the legend.
bool usingSymbolLevels() const
A line symbol type, for rendering LineString and MultiLineString geometries.
void setWidth(double width) const
Sets the width for the whole line symbol.
QgsProperty dataDefinedWidth() const
Returns data defined width for whole symbol (including all symbol layers).
The QgsMapSettings class contains configuration for rendering of the map.
A marker symbol type, for rendering Point and MultiPoint geometries.
void setAngle(double symbolAngle) const
Sets the angle for the whole symbol.
void setSize(double size) const
Sets the size for the whole symbol.
QgsProperty dataDefinedAngle() const
Returns data defined angle for whole symbol (including all symbol layers).
QgsProperty dataDefinedSize() const
Returns data defined size for whole symbol (including all symbol layers).
QgsMarkerSymbol * clone() const override
Returns a deep copy of this symbol.
Base class for any widget that can be shown as a inline panel.
void openPanel(QgsPanelWidget *panel)
Open a panel or dialog depending on dock mode setting If dock mode is true this method will emit the ...
void widgetChanged()
Emitted when the widget state changes.
static QgsPanelWidget * findParentPanel(QWidget *widget)
Traces through the parents of a widget to find if it is contained within a QgsPanelWidget widget.
void setPanelTitle(const QString &panelTitle)
Set the title of the panel when shown in the interface.
virtual void setDockMode(bool dockMode)
Set the widget in dock mode which tells the widget to emit panel widgets and not open dialogs.
bool dockMode()
Returns the dock mode state.
static QgsProject * instance()
Returns the QgsProject singleton instance.
void changed()
Emitted when property definition changes.
A store for object properties.
bool isActive() const
Returns whether the property is currently active.
QAction * mPasteSymbolAction
Paste symbol action.
void changeSymbolSize()
Change marker sizes of selected symbols.
virtual void pasteSymbolToSelection()
Pastes the clipboard symbol over selected items.
QgsRendererWidget(QgsVectorLayer *layer, QgsStyle *style)
virtual void refreshSymbolView()
virtual QList< QgsSymbol * > selectedSymbols()
Subclasses may provide the capability of changing multiple symbols at once by implementing the follow...
void showSymbolLevelsDialog(QgsFeatureRenderer *r)
Show a dialog with renderer's symbol level settings.
void changeSymbolOpacity()
Change opacity of selected symbols.
void changeSymbolWidth()
Change line widths of selected symbols.
void setDockMode(bool dockMode) override
Set the widget in dock mode which tells the widget to emit panel widgets and not open dialogs.
QgsSymbolWidgetContext mContext
Context in which widget is shown.
void changeSymbolUnit()
Change units mm/map units of selected symbols.
virtual void setContext(const QgsSymbolWidgetContext &context)
Sets the context in which the renderer widget is shown, e.g., the associated map canvas and expressio...
QgsDataDefinedSizeLegendWidget * createDataDefinedSizeLegendWidget(const QgsMarkerSymbol *symbol, const QgsDataDefinedSizeLegend *ddsLegend)
Creates widget to setup data-defined size legend.
virtual void disableSymbolLevels()
Disables symbol level modification on the widget.
void contextMenuViewCategories(QPoint p)
virtual void setSymbolLevels(const QList< QgsLegendSymbolItem > &levels, bool enabled)
Sets the symbol levels for the renderer defined in the widget.
QgsSymbolWidgetContext context() const
Returns the context in which the renderer widget is shown, e.g., the associated map canvas and expres...
void changeSymbolColor()
Change color of selected symbols.
QAction * mCopySymbolAction
Copy symbol action.
void changeSymbolAngle()
Change marker angles of selected symbols.
void applyChanges()
This method should be called whenever the renderer is actually set on the layer.
QgsVectorLayer * mLayer
static QgsSymbol * symbolFromMimeData(const QMimeData *data)
Attempts to parse mime data as a symbol.
static QMimeData * symbolToMimeData(const QgsSymbol *symbol)
Creates new mime data from a symbol.
@ PropertyAngle
Symbol angle.
@ PropertySize
Symbol size.
@ PropertyStrokeWidth
Stroke width.
static const QgsPropertiesDefinition & propertyDefinitions()
Returns the symbol layer property definitions.
A dialog which allows the user to modify the rendering order of symbol layers.
QgsLegendSymbolList symbolLevels() const
Returns the current legend symbols with rendering passes set, as defined in the widget.
bool usingLevels() const
Returns whether the level ordering is enabled.
A widget which allows the user to modify the rendering order of symbol layers.
bool usingLevels() const
Returns whether the level ordering is enabled.
QgsLegendSymbolList symbolLevels() const
Returns the current legend symbols with rendering passes set, as defined in the widget.
Contains settings which reflect the context in which a symbol (or renderer) widget is shown,...
QList< QgsExpressionContextScope > additionalExpressionContextScopes() const
Returns the list of additional expression context scopes to show as available within the layer.
QgsMapCanvas * mapCanvas() const
Returns the map canvas associated with the widget.
Abstract base class for all rendered symbols.
Definition qgssymbol.h:94
qreal opacity() const
Returns the opacity for the symbol.
Definition qgssymbol.h:497
QColor color() const
Returns the symbol's color.
Qgis::RenderUnit outputUnit() const
Returns the units to use for sizes and widths within the symbol.
Represents a vector layer which manages a vector based data sets.
Q_INVOKABLE Qgis::GeometryType geometryType() const
Returns point, line or polygon.