1/************************************************************************ 2 * This file has been generated automatically from * 3 * * 4 * src/gui/qgssymbolbutton.h * 5 * * 6 * Do not edit manually ! Edit header and run scripts/sipify.pl again * 7 ************************************************************************/ 8 9 10 11 12class QgsSymbolButton : QToolButton 13{ 14%Docstring(signature="appended") 15A button for creating and modifying :py:class:`QgsSymbol` settings. 16 17The button shows a preview icon for the current symbol, and will open a detailed symbol editor dialog (or 18panel widget) when clicked. 19 20.. versionadded:: 3.0 21%End 22 23%TypeHeaderCode 24#include "qgssymbolbutton.h" 25%End 26 public: 27 28 QgsSymbolButton( QWidget *parent /TransferThis/ = 0, const QString &dialogTitle = QString() ); 29%Docstring 30Construct a new symbol button. 31Use ``dialogTitle`` string to define the title to show in the symbol settings dialog. 32%End 33 ~QgsSymbolButton(); 34 35 virtual QSize minimumSizeHint() const; 36 37 virtual QSize sizeHint() const; 38 39 40 void setSymbolType( Qgis::SymbolType type ); 41%Docstring 42Sets the symbol ``type`` which the button requires. 43If the type differs from the current symbol type, the symbol will be reset 44to a default symbol style of the new type. 45 46.. seealso:: :py:func:`symbolType` 47%End 48 49 Qgis::SymbolType symbolType() const; 50%Docstring 51Returns the symbol type which the button requires. 52 53.. seealso:: :py:func:`setSymbolType` 54%End 55 56 void setDialogTitle( const QString &title ); 57%Docstring 58Sets the ``title`` for the symbol settings dialog window. 59 60.. seealso:: :py:func:`dialogTitle` 61%End 62 63 QString dialogTitle() const; 64%Docstring 65Returns the title for the symbol settings dialog window. 66 67.. seealso:: :py:func:`setDialogTitle` 68%End 69 70 QgsSymbol *symbol(); 71%Docstring 72Returns the current symbol defined by the button. 73 74.. seealso:: :py:func:`setSymbol` 75 76.. seealso:: :py:func:`changed` 77%End 78 79 80 QgsMapCanvas *mapCanvas() const; 81%Docstring 82Returns the map canvas associated with the widget. 83 84.. seealso:: :py:func:`setMapCanvas` 85%End 86 87 void setMapCanvas( QgsMapCanvas *canvas ); 88%Docstring 89Sets a map ``canvas`` to associate with the widget. This allows the 90widget to fetch current settings from the map canvas, such as current scale. 91 92.. seealso:: :py:func:`mapCanvas` 93%End 94 95 void setMessageBar( QgsMessageBar *bar ); 96%Docstring 97Sets the message ``bar`` associated with the widget. This allows the widget to push feedback messages 98to the appropriate message bar. 99 100.. seealso:: :py:func:`messageBar` 101 102.. versionadded:: 3.6 103%End 104 105 QgsMessageBar *messageBar() const; 106%Docstring 107Returns the message bar associated with the widget. 108 109.. seealso:: :py:func:`setMessageBar` 110 111.. versionadded:: 3.6 112%End 113 114 QgsVectorLayer *layer() const; 115%Docstring 116Returns the layer associated with the widget. 117 118.. seealso:: :py:func:`setLayer` 119%End 120 121 void setLayer( QgsVectorLayer *layer ); 122%Docstring 123Sets a ``layer`` to associate with the widget. This allows the 124widget to setup layer related settings within the symbol settings dialog, 125such as correctly populating data defined override buttons. 126 127.. seealso:: :py:func:`layer` 128%End 129 130 void registerExpressionContextGenerator( QgsExpressionContextGenerator *generator ); 131%Docstring 132Register an expression context generator class that will be used to retrieve 133an expression context for the button when required. 134%End 135 136 public slots: 137 138 void setSymbol( QgsSymbol *symbol /Transfer/ ); 139%Docstring 140Sets the ``symbol`` for the button. Ownership of ``symbol`` is transferred to the 141button. 142 143.. seealso:: :py:func:`symbol` 144 145.. seealso:: :py:func:`changed` 146%End 147 148 void setColor( const QColor &color ); 149%Docstring 150Sets the current ``color`` for the symbol. Will emit a :py:func:`~QgsSymbolButton.changed` signal if the color is different 151to the previous symbol color. 152%End 153 154 void copySymbol(); 155%Docstring 156Copies the current symbol to the clipboard. 157 158.. seealso:: :py:func:`pasteSymbol` 159%End 160 161 void pasteSymbol(); 162%Docstring 163Pastes a symbol from the clipboard. If clipboard does not contain a valid 164symbol then no change is applied. 165 166.. seealso:: :py:func:`copySymbol` 167%End 168 169 void copyColor(); 170%Docstring 171Copies the current symbol color to the clipboard. 172 173.. seealso:: :py:func:`pasteColor` 174%End 175 176 void pasteColor(); 177%Docstring 178Pastes a color from the clipboard to the symbol. If clipboard does not contain a valid 179color or string representation of a color, then no change is applied. 180 181.. seealso:: :py:func:`copyColor` 182%End 183 184 signals: 185 186 void changed(); 187%Docstring 188Emitted when the symbol's settings are changed. 189 190.. seealso:: :py:func:`symbol` 191 192.. seealso:: :py:func:`setSymbol` 193%End 194 195 protected: 196 197 virtual void changeEvent( QEvent *e ); 198 199 virtual void showEvent( QShowEvent *e ); 200 201 virtual void resizeEvent( QResizeEvent *event ); 202 203 204 virtual void mousePressEvent( QMouseEvent *e ); 205 206 virtual void mouseMoveEvent( QMouseEvent *e ); 207 208 virtual void mouseReleaseEvent( QMouseEvent *e ); 209 210 virtual void keyPressEvent( QKeyEvent *e ); 211 212 virtual void dragEnterEvent( QDragEnterEvent *e ); 213 214 215 virtual void dragLeaveEvent( QDragLeaveEvent *e ); 216 217 218 virtual void dropEvent( QDropEvent *e ); 219 220 221}; 222 223/************************************************************************ 224 * This file has been generated automatically from * 225 * * 226 * src/gui/qgssymbolbutton.h * 227 * * 228 * Do not edit manually ! Edit header and run scripts/sipify.pl again * 229 ************************************************************************/ 230