|
QGIS API Documentation 3.99.0-Master (d270888f95f)
|
A button for creating and modifying QgsSymbol settings. More...
#include <qgssymbolbutton.h>

Public Slots | |
| void | copyColor () |
| Copies the current symbol color to the clipboard. | |
| void | copySymbol () |
| Copies the current symbol to the clipboard. | |
| void | pasteColor () |
| Pastes a color from the clipboard to the symbol. | |
| void | pasteSymbol () |
| Pastes a symbol from the clipboard. | |
| void | setColor (const QColor &color) |
| Sets the current color for the symbol. | |
| void | setFixedSizeConstraints (bool fixedSizeConstraints) |
| Sets whether the widget adopts fixed size constraints. | |
| void | setShowNull (bool showNull) |
| Sets whether a set to null (clear) option is shown in the button's drop-down menu. | |
| void | setSymbol (QgsSymbol *symbol) |
| Sets the symbol for the button. | |
| void | setToDefaultSymbol () |
| Sets symbol to the button's default symbol, if set. | |
| void | setToNull () |
| Sets symbol to to null. | |
Signals | |
| void | changed () |
| Emitted when the symbol's settings are changed. | |
Public Member Functions | |
| QgsSymbolButton (QWidget *parent=nullptr, const QString &dialogTitle=QString()) | |
| Construct a new symbol button. | |
| ~QgsSymbolButton () override | |
| template<class SymbolType> | |
| SymbolType * | clonedSymbol () |
| Returns a clone of the current symbol (as the specified template type) defined by the button. | |
| const QgsSymbol * | defaultSymbol () const |
| Returns the default symbol for the button, which is shown in the button's drop-down menu for the "default symbol" option. | |
| QString | dialogTitle () const |
| Returns the title for the symbol settings dialog window. | |
| bool | fixedSizeConstraints () const |
Returns true if the widget adopts fixed size constraints. | |
| bool | isNull () const |
Returns true if the current symbol is null. | |
| QgsVectorLayer * | layer () const |
| Returns the layer associated with the widget. | |
| QgsMapCanvas * | mapCanvas () const |
| Returns the map canvas associated with the widget. | |
| QgsMessageBar * | messageBar () const |
| Returns the message bar associated with the widget. | |
| 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. | |
| void | setDefaultSymbol (QgsSymbol *symbol) |
| Sets the default symbol for the button, which is shown in the button's drop-down menu for the "default symbol" option. | |
| void | setDialogTitle (const QString &title) |
| Sets the title for the symbol settings dialog window. | |
| void | setLayer (QgsVectorLayer *layer) |
| Sets a layer to associate with the widget. | |
| void | setMapCanvas (QgsMapCanvas *canvas) |
| Sets a map canvas to associate with the widget. | |
| void | setMessageBar (QgsMessageBar *bar) |
| Sets the message bar associated with the widget. | |
| void | setSymbolType (Qgis::SymbolType type) |
| Sets the symbol type which the button requires. | |
| bool | showNull () const |
| Returns whether the set to null (clear) option is shown in the button's drop-down menu. | |
| QSize | sizeHint () const override |
| QgsSymbol * | symbol () |
| Returns the current symbol defined by the button. | |
| Qgis::SymbolType | symbolType () const |
| Returns the symbol type which the button requires. | |
Protected Member Functions | |
| void | changeEvent (QEvent *e) override |
| void | dragEnterEvent (QDragEnterEvent *e) override |
| void | dragLeaveEvent (QDragLeaveEvent *e) override |
| void | dropEvent (QDropEvent *e) override |
| void | keyPressEvent (QKeyEvent *e) override |
| void | mouseMoveEvent (QMouseEvent *e) override |
| void | mousePressEvent (QMouseEvent *e) override |
| void | mouseReleaseEvent (QMouseEvent *e) override |
| void | resizeEvent (QResizeEvent *event) override |
| void | showEvent (QShowEvent *e) override |
| void | wheelEvent (QWheelEvent *event) 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 45 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 47 of file qgssymbolbutton.cpp.
|
overridedefault |
|
signal |
Emitted when the symbol's settings are changed.
|
overrideprotected |
Definition at line 620 of file qgssymbolbutton.cpp.
|
inline |
Returns a clone of the current symbol (as the specified template type) defined by the button.
Definition at line 101 of file qgssymbolbutton.h.
|
slot |
Copies the current symbol color to the clipboard.
Definition at line 294 of file qgssymbolbutton.cpp.
|
slot |
Copies the current symbol to the clipboard.
Definition at line 282 of file qgssymbolbutton.cpp.
| const QgsSymbol * QgsSymbolButton::defaultSymbol | ( | ) | const |
Returns the default symbol for the button, which is shown in the button's drop-down menu for the "default symbol" option.
nullptr if the default symbol option is disabled. Definition at line 253 of file qgssymbolbutton.cpp.
| QString QgsSymbolButton::dialogTitle | ( | ) | const |
Returns the title for the symbol settings dialog window.
Definition at line 819 of file qgssymbolbutton.cpp.
|
overrideprotected |
Definition at line 391 of file qgssymbolbutton.cpp.
|
overrideprotected |
Definition at line 407 of file qgssymbolbutton.cpp.
|
overrideprotected |
Definition at line 414 of file qgssymbolbutton.cpp.
| bool QgsSymbolButton::fixedSizeConstraints | ( | ) | const |
Returns true if the widget adopts fixed size constraints.
Definition at line 846 of file qgssymbolbutton.cpp.
| bool QgsSymbolButton::isNull | ( | ) | const |
Returns true if the current symbol is null.
Definition at line 851 of file qgssymbolbutton.cpp.
|
overrideprotected |
Definition at line 378 of file qgssymbolbutton.cpp.
| QgsVectorLayer * QgsSymbolButton::layer | ( | ) | const |
Returns the layer associated with the widget.
Definition at line 233 of file qgssymbolbutton.cpp.
| QgsMapCanvas * QgsSymbolButton::mapCanvas | ( | ) | const |
Returns the map canvas associated with the widget.
Definition at line 213 of file qgssymbolbutton.cpp.
| QgsMessageBar * QgsSymbolButton::messageBar | ( | ) | const |
Returns the message bar associated with the widget.
Definition at line 228 of file qgssymbolbutton.cpp.
|
override |
Definition at line 109 of file qgssymbolbutton.cpp.
|
overrideprotected |
Definition at line 332 of file qgssymbolbutton.cpp.
|
overrideprotected |
Definition at line 311 of file qgssymbolbutton.cpp.
|
overrideprotected |
Definition at line 365 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 299 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 287 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 243 of file qgssymbolbutton.cpp.
|
overrideprotected |
Definition at line 635 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 266 of file qgssymbolbutton.cpp.
| void QgsSymbolButton::setDefaultSymbol | ( | QgsSymbol * | symbol | ) |
Sets the default symbol for the button, which is shown in the button's drop-down menu for the "default symbol" option.
| symbol | default symbol for the button. Set to nullptr to disable the default symbol option. Ownership of symbol is transferred to the button. |
Definition at line 248 of file qgssymbolbutton.cpp.
| void QgsSymbolButton::setDialogTitle | ( | const QString & | title | ) |
Sets the title for the symbol settings dialog window.
Definition at line 814 of file qgssymbolbutton.cpp.
|
slot |
Sets whether the widget adopts fixed size constraints.
Definition at line 839 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 238 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 218 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 223 of file qgssymbolbutton.cpp.
|
slot |
Sets whether a set to null (clear) option is shown in the button's drop-down menu.
| showNull | set to true to show a null option |
Definition at line 829 of file qgssymbolbutton.cpp.
|
slot |
Sets the symbol for the button.
Ownership of symbol is transferred to the button.
Definition at line 258 of file qgssymbolbutton.cpp.
| void QgsSymbolButton::setSymbolType | ( | Qgis::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 119 of file qgssymbolbutton.cpp.
|
slot |
Sets symbol to the button's default symbol, if set.
Definition at line 861 of file qgssymbolbutton.cpp.
|
slot |
|
overrideprotected |
Definition at line 629 of file qgssymbolbutton.cpp.
| bool QgsSymbolButton::showNull | ( | ) | const |
Returns whether the set to null (clear) option is shown in the button's drop-down menu.
Definition at line 834 of file qgssymbolbutton.cpp.
|
override |
Definition at line 114 of file qgssymbolbutton.cpp.
| QgsSymbol * QgsSymbolButton::symbol | ( | ) |
Returns the current symbol defined by the button.
Definition at line 824 of file qgssymbolbutton.cpp.
|
inline |
Returns the symbol type which the button requires.
Definition at line 74 of file qgssymbolbutton.h.
|
overrideprotected |
Definition at line 432 of file qgssymbolbutton.cpp.
|
readwrite |
Definition at line 49 of file qgssymbolbutton.h.