QGIS API Documentation
3.8.0-Zanzibar (11aff65)
|
A button for creating and modifying QgsSymbol settings. More...
#include <qgssymbolbutton.h>
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... | |
QgsVectorLayer * | layer () const |
Returns the layer associated with the widget. More... | |
QgsMapCanvas * | mapCanvas () const |
Returns the map canvas associated with the widget. More... | |
QgsMessageBar * | messageBar () const |
Returns the message bar 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 | setMessageBar (QgsMessageBar *bar) |
Sets the message bar associated with the widget. More... | |
void | setSymbolType (QgsSymbol::SymbolType type) |
Sets the symbol type which the button requires. More... | |
QSize | sizeHint () const override |
QgsSymbol * | symbol () |
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 |
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.
Definition at line 41 of file qgssymbolbutton.h.
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 35 of file qgssymbolbutton.cpp.
|
signal |
Emitted when the symbol's settings are changed.
|
overrideprotected |
Definition at line 415 of file qgssymbolbutton.cpp.
|
inline |
Returns a clone of the current symbol (as the specified template type) defined by the button.
Definition at line 97 of file qgssymbolbutton.h.
|
slot |
Copies the current symbol color to the clipboard.
Definition at line 219 of file qgssymbolbutton.cpp.
|
slot |
Copies the current symbol to the clipboard.
Definition at line 207 of file qgssymbolbutton.cpp.
QString QgsSymbolButton::dialogTitle | ( | ) | const |
Returns the title for the symbol settings dialog window.
|
overrideprotected |
Definition at line 276 of file qgssymbolbutton.cpp.
|
overrideprotected |
Definition at line 292 of file qgssymbolbutton.cpp.
|
overrideprotected |
Definition at line 299 of file qgssymbolbutton.cpp.
QgsVectorLayer * QgsSymbolButton::layer | ( | ) | const |
Returns the layer associated with the widget.
Definition at line 172 of file qgssymbolbutton.cpp.
QgsMapCanvas * QgsSymbolButton::mapCanvas | ( | ) | const |
Returns the map canvas associated with the widget.
Definition at line 152 of file qgssymbolbutton.cpp.
QgsMessageBar * QgsSymbolButton::messageBar | ( | ) | const |
Returns the message bar associated with the widget.
Definition at line 167 of file qgssymbolbutton.cpp.
|
override |
Definition at line 56 of file qgssymbolbutton.cpp.
|
overrideprotected |
Definition at line 250 of file qgssymbolbutton.cpp.
|
overrideprotected |
Definition at line 236 of file qgssymbolbutton.cpp.
|
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.
Definition at line 224 of file qgssymbolbutton.cpp.
|
slot |
Pastes a symbol from the clipboard.
If clipboard does not contain a valid symbol then no change is applied.
Definition at line 212 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 182 of file qgssymbolbutton.cpp.
|
overrideprotected |
Definition at line 430 of file qgssymbolbutton.cpp.
|
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 194 of file qgssymbolbutton.cpp.
void QgsSymbolButton::setDialogTitle | ( | const QString & | title | ) |
Sets the title for the symbol settings dialog window.
Definition at line 537 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.
Definition at line 177 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.
Definition at line 157 of file qgssymbolbutton.cpp.
void QgsSymbolButton::setMessageBar | ( | QgsMessageBar * | bar | ) |
Sets the message bar associated with the widget.
This allows the widget to push feedback messages to the appropriate message bar.
Definition at line 162 of file qgssymbolbutton.cpp.
|
slot |
Sets the symbol for the button.
Ownership of symbol is transferred to the button.
Definition at line 187 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.
Definition at line 67 of file qgssymbolbutton.cpp.
|
overrideprotected |
Definition at line 424 of file qgssymbolbutton.cpp.
|
override |
Definition at line 62 of file qgssymbolbutton.cpp.
QgsSymbol * QgsSymbolButton::symbol | ( | ) |
Returns the current symbol defined by the button.
Definition at line 547 of file qgssymbolbutton.cpp.
|
inline |
Returns the symbol type which the button requires.
Definition at line 70 of file qgssymbolbutton.h.
|
readwrite |
Definition at line 45 of file qgssymbolbutton.h.