QGIS API Documentation  3.4.15-Madeira (e83d02e274)
Public Slots | Signals | Public Member Functions | Protected Member Functions | Properties | List of all members
QgsSymbolButton Class Reference

A button for creating and modifying QgsSymbol settings. More...

#include <qgssymbolbutton.h>

Inheritance diagram for QgsSymbolButton:
Inheritance graph
[legend]

Public Slots

void copyColor ()
 Copies the current symbol color to the clipboard. More...
 
void copySymbol ()
 Copies the current symbol to the clipboard. More...
 
void pasteColor ()
 Pastes a color from the clipboard to the symbol. More...
 
void pasteSymbol ()
 Pastes a symbol from the clipboard. More...
 
void setColor (const QColor &color)
 Sets the current color for the symbol. More...
 
void setSymbol (QgsSymbol *symbol)
 Sets the symbol for the button. More...
 

Signals

void changed ()
 Emitted when the symbol's settings are changed. More...
 

Public Member Functions

 QgsSymbolButton (QWidget *parent=nullptr, const QString &dialogTitle=QString())
 Construct a new symbol button. More...
 
template<class SymbolType >
SymbolType * clonedSymbol ()
 Returns a clone of the current symbol (as the specified template type) defined by the button. More...
 
QString dialogTitle () const
 Returns the title for the symbol settings dialog window. More...
 
QgsVectorLayerlayer () const
 Returns the layer associated with the widget. More...
 
QgsMapCanvasmapCanvas () const
 Returns the map canvas associated with the widget. More...
 
QSize minimumSizeHint () const override
 
void registerExpressionContextGenerator (QgsExpressionContextGenerator *generator)
 Register an expression context generator class that will be used to retrieve an expression context for the button when required. More...
 
void setDialogTitle (const QString &title)
 Sets the title for the symbol settings dialog window. More...
 
void setLayer (QgsVectorLayer *layer)
 Sets a layer to associate with the widget. More...
 
void setMapCanvas (QgsMapCanvas *canvas)
 Sets a map canvas to associate with the widget. More...
 
void setSymbolType (QgsSymbol::SymbolType type)
 Sets the symbol type which the button requires. More...
 
QSize sizeHint () const override
 
QgsSymbolsymbol ()
 Returns the current symbol defined by the button. More...
 
QgsSymbol::SymbolType symbolType () const
 Returns the symbol type which the button requires. More...
 

Protected Member Functions

void changeEvent (QEvent *e) override
 
void dragEnterEvent (QDragEnterEvent *e) override
 
void dragLeaveEvent (QDragLeaveEvent *e) override
 
void dropEvent (QDropEvent *e) override
 
void mouseMoveEvent (QMouseEvent *e) override
 
void mousePressEvent (QMouseEvent *e) override
 
void resizeEvent (QResizeEvent *event) override
 
void showEvent (QShowEvent *e) override
 

Properties

QString dialogTitle
 

Detailed Description

A button for creating and modifying QgsSymbol settings.

The button shows a preview icon for the current symbol, and will open a detailed symbol editor dialog (or panel widget) when clicked.

Since
QGIS 3.0

Definition at line 40 of file qgssymbolbutton.h.

Constructor & Destructor Documentation

QgsSymbolButton::QgsSymbolButton ( QWidget *  parent = nullptr,
const QString &  dialogTitle = QString() 
)

Construct a new symbol button.

Use dialogTitle string to define the title to show in the symbol settings dialog.

Definition at line 32 of file qgssymbolbutton.cpp.

Member Function Documentation

void QgsSymbolButton::changed ( )
signal

Emitted when the symbol's settings are changed.

See also
symbol()
setSymbol()
void QgsSymbolButton::changeEvent ( QEvent *  e)
overrideprotected

Definition at line 401 of file qgssymbolbutton.cpp.

template<class SymbolType >
SymbolType* QgsSymbolButton::clonedSymbol ( )
inline

Returns a clone of the current symbol (as the specified template type) defined by the button.

See also
setSymbol()
changed()
Note
Not available in Python bindings.

Definition at line 96 of file qgssymbolbutton.h.

void QgsSymbolButton::copyColor ( )
slot

Copies the current symbol color to the clipboard.

See also
pasteColor()

Definition at line 205 of file qgssymbolbutton.cpp.

void QgsSymbolButton::copySymbol ( )
slot

Copies the current symbol to the clipboard.

See also
pasteSymbol()

Definition at line 193 of file qgssymbolbutton.cpp.

QString QgsSymbolButton::dialogTitle ( ) const

Returns the title for the symbol settings dialog window.

See also
setDialogTitle()
void QgsSymbolButton::dragEnterEvent ( QDragEnterEvent *  e)
overrideprotected

Definition at line 262 of file qgssymbolbutton.cpp.

void QgsSymbolButton::dragLeaveEvent ( QDragLeaveEvent *  e)
overrideprotected

Definition at line 278 of file qgssymbolbutton.cpp.

void QgsSymbolButton::dropEvent ( QDropEvent *  e)
overrideprotected

Definition at line 285 of file qgssymbolbutton.cpp.

QgsVectorLayer * QgsSymbolButton::layer ( ) const

Returns the layer associated with the widget.

See also
setLayer()

Definition at line 158 of file qgssymbolbutton.cpp.

QgsMapCanvas * QgsSymbolButton::mapCanvas ( ) const

Returns the map canvas associated with the widget.

See also
setMapCanvas()

Definition at line 148 of file qgssymbolbutton.cpp.

QSize QgsSymbolButton::minimumSizeHint ( ) const
override

Definition at line 53 of file qgssymbolbutton.cpp.

void QgsSymbolButton::mouseMoveEvent ( QMouseEvent *  e)
overrideprotected

Definition at line 236 of file qgssymbolbutton.cpp.

void QgsSymbolButton::mousePressEvent ( QMouseEvent *  e)
overrideprotected

Definition at line 222 of file qgssymbolbutton.cpp.

void QgsSymbolButton::pasteColor ( )
slot

Pastes a color from the clipboard to the symbol.

If clipboard does not contain a valid color or string representation of a color, then no change is applied.

See also
copyColor()

Definition at line 210 of file qgssymbolbutton.cpp.

void QgsSymbolButton::pasteSymbol ( )
slot

Pastes a symbol from the clipboard.

If clipboard does not contain a valid symbol then no change is applied.

See also
copySymbol()

Definition at line 198 of file qgssymbolbutton.cpp.

void QgsSymbolButton::registerExpressionContextGenerator ( QgsExpressionContextGenerator generator)

Register an expression context generator class that will be used to retrieve an expression context for the button when required.

Definition at line 168 of file qgssymbolbutton.cpp.

void QgsSymbolButton::resizeEvent ( QResizeEvent *  event)
overrideprotected

Definition at line 416 of file qgssymbolbutton.cpp.

void QgsSymbolButton::setColor ( const QColor &  color)
slot

Sets the current color for the symbol.

Will emit a changed() signal if the color is different to the previous symbol color.

Definition at line 180 of file qgssymbolbutton.cpp.

void QgsSymbolButton::setDialogTitle ( const QString &  title)

Sets the title for the symbol settings dialog window.

See also
dialogTitle()

Definition at line 523 of file qgssymbolbutton.cpp.

void QgsSymbolButton::setLayer ( QgsVectorLayer layer)

Sets a layer to associate with the widget.

This allows the widget to setup layer related settings within the symbol settings dialog, such as correctly populating data defined override buttons.

See also
layer()

Definition at line 163 of file qgssymbolbutton.cpp.

void QgsSymbolButton::setMapCanvas ( QgsMapCanvas canvas)

Sets a map canvas to associate with the widget.

This allows the widget to fetch current settings from the map canvas, such as current scale.

See also
mapCanvas()

Definition at line 153 of file qgssymbolbutton.cpp.

void QgsSymbolButton::setSymbol ( QgsSymbol symbol)
slot

Sets the symbol for the button.

Ownership of symbol is transferred to the button.

See also
symbol()
changed()

Definition at line 173 of file qgssymbolbutton.cpp.

void QgsSymbolButton::setSymbolType ( QgsSymbol::SymbolType  type)

Sets the symbol type which the button requires.

If the type differs from the current symbol type, the symbol will be reset to a default symbol style of the new type.

See also
symbolType()

Definition at line 64 of file qgssymbolbutton.cpp.

void QgsSymbolButton::showEvent ( QShowEvent *  e)
overrideprotected

Definition at line 410 of file qgssymbolbutton.cpp.

QSize QgsSymbolButton::sizeHint ( ) const
override

Definition at line 59 of file qgssymbolbutton.cpp.

QgsSymbol * QgsSymbolButton::symbol ( )

Returns the current symbol defined by the button.

See also
setSymbol()
changed()

Definition at line 533 of file qgssymbolbutton.cpp.

QgsSymbol::SymbolType QgsSymbolButton::symbolType ( ) const
inline

Returns the symbol type which the button requires.

See also
setSymbolType()

Definition at line 69 of file qgssymbolbutton.h.

Property Documentation

QString QgsSymbolButton::dialogTitle
readwrite

Definition at line 44 of file qgssymbolbutton.h.


The documentation for this class was generated from the following files: