1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321
|
/************************************************************************
* This file has been generated automatically from *
* *
* src/gui/qgssymbolbutton.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.py again *
************************************************************************/
class QgsSymbolButton : QToolButton
{
%Docstring(signature="appended")
A button for creating and modifying :py:class:`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.
%End
%TypeHeaderCode
#include "qgssymbolbutton.h"
%End
public:
QgsSymbolButton( QWidget *parent /TransferThis/ = 0, const QString &dialogTitle = QString() );
%Docstring
Construct a new symbol button. Use ``dialogTitle`` string to define the
title to show in the symbol settings dialog.
%End
~QgsSymbolButton();
virtual QSize minimumSizeHint() const;
virtual QSize sizeHint() const;
void setSymbolType( Qgis::SymbolType type );
%Docstring
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.
.. seealso:: :py:func:`symbolType`
%End
Qgis::SymbolType symbolType() const;
%Docstring
Returns the symbol type which the button requires.
.. seealso:: :py:func:`setSymbolType`
%End
void setDialogTitle( const QString &title );
%Docstring
Sets the ``title`` for the symbol settings dialog window.
.. seealso:: :py:func:`dialogTitle`
%End
QString dialogTitle() const;
%Docstring
Returns the title for the symbol settings dialog window.
.. seealso:: :py:func:`setDialogTitle`
%End
QgsSymbol *symbol();
%Docstring
Returns the current symbol defined by the button.
.. seealso:: :py:func:`setSymbol`
.. seealso:: :py:func:`changed`
%End
QgsMapCanvas *mapCanvas() const;
%Docstring
Returns the map canvas associated with the widget.
.. seealso:: :py:func:`setMapCanvas`
%End
void setMapCanvas( QgsMapCanvas *canvas );
%Docstring
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.
.. seealso:: :py:func:`mapCanvas`
%End
void setMessageBar( QgsMessageBar *bar );
%Docstring
Sets the message ``bar`` associated with the widget. This allows the
widget to push feedback messages to the appropriate message bar.
.. seealso:: :py:func:`messageBar`
.. versionadded:: 3.6
%End
QgsMessageBar *messageBar() const;
%Docstring
Returns the message bar associated with the widget.
.. seealso:: :py:func:`setMessageBar`
.. versionadded:: 3.6
%End
QgsVectorLayer *layer() const;
%Docstring
Returns the layer associated with the widget.
.. seealso:: :py:func:`setLayer`
%End
void setLayer( QgsVectorLayer *layer );
%Docstring
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.
.. seealso:: :py:func:`layer`
%End
void registerExpressionContextGenerator( QgsExpressionContextGenerator *generator );
%Docstring
Register an expression context generator class that will be used to
retrieve an expression context for the button when required.
%End
void setDefaultSymbol( QgsSymbol *symbol /Transfer/ );
%Docstring
Sets the default symbol for the button, which is shown in the button's
drop-down menu for the "default symbol" option.
:param symbol: default symbol for the button. Set to ``None`` to disable
the default symbol option. Ownership of ``symbol`` is
transferred to the button.
.. seealso:: :py:func:`defaultSymbol`
.. versionadded:: 3.30
%End
const QgsSymbol *defaultSymbol() const;
%Docstring
Returns the default symbol for the button, which is shown in the
button's drop-down menu for the "default symbol" option.
:return: default symbol for the button. Returns ``None`` if the default
symbol option is disabled.
.. seealso:: :py:func:`setDefaultSymbol`
.. versionadded:: 3.30
%End
bool showNull() const;
%Docstring
Returns whether the set to null (clear) option is shown in the button's
drop-down menu.
.. seealso:: :py:func:`setShowNull`
.. seealso:: :py:func:`isNull`
.. versionadded:: 3.26
%End
bool isNull() const;
%Docstring
Returns ``True`` if the current symbol is null.
.. seealso:: :py:func:`setShowNull`
.. seealso:: :py:func:`showNull`
.. versionadded:: 3.26
%End
public slots:
void setSymbol( QgsSymbol *symbol /Transfer/ );
%Docstring
Sets the ``symbol`` for the button. Ownership of ``symbol`` is
transferred to the button.
.. seealso:: :py:func:`symbol`
.. seealso:: :py:func:`changed`
%End
void setColor( const QColor &color );
%Docstring
Sets the current ``color`` for the symbol. Will emit a
:py:func:`~QgsSymbolButton.changed` signal if the color is different to
the previous symbol color.
%End
void copySymbol();
%Docstring
Copies the current symbol to the clipboard.
.. seealso:: :py:func:`pasteSymbol`
%End
void pasteSymbol();
%Docstring
Pastes a symbol from the clipboard. If clipboard does not contain a
valid symbol then no change is applied.
.. seealso:: :py:func:`copySymbol`
%End
void copyColor();
%Docstring
Copies the current symbol color to the clipboard.
.. seealso:: :py:func:`pasteColor`
%End
void pasteColor();
%Docstring
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.
.. seealso:: :py:func:`copyColor`
%End
void setShowNull( bool showNull );
%Docstring
Sets whether a set to null (clear) option is shown in the button's
drop-down menu.
:param showNull: set to ``True`` to show a null option
.. seealso:: :py:func:`showNull`
.. seealso:: :py:func:`isNull`
.. versionadded:: 3.26
%End
void setToNull();
%Docstring
Sets symbol to to null.
.. seealso:: :py:func:`setShowNull`
.. seealso:: :py:func:`setToDefaultSymbol`
.. seealso:: :py:func:`showNull`
.. versionadded:: 3.26
%End
void setToDefaultSymbol();
%Docstring
Sets symbol to the button's default symbol, if set.
.. seealso:: :py:func:`setDefaultSymbol`
.. seealso:: :py:func:`defaultSymbol`
.. seealso:: :py:func:`setToNull`
.. versionadded:: 3.30
%End
signals:
void changed();
%Docstring
Emitted when the symbol's settings are changed.
.. seealso:: :py:func:`symbol`
.. seealso:: :py:func:`setSymbol`
%End
protected:
virtual void changeEvent( QEvent *e );
virtual void showEvent( QShowEvent *e );
virtual void resizeEvent( QResizeEvent *event );
virtual void mousePressEvent( QMouseEvent *e );
virtual void mouseMoveEvent( QMouseEvent *e );
virtual void mouseReleaseEvent( QMouseEvent *e );
virtual void keyPressEvent( QKeyEvent *e );
virtual void dragEnterEvent( QDragEnterEvent *e );
virtual void dragLeaveEvent( QDragLeaveEvent *e );
virtual void dropEvent( QDropEvent *e );
virtual void wheelEvent( QWheelEvent *event );
};
/************************************************************************
* This file has been generated automatically from *
* *
* src/gui/qgssymbolbutton.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.py again *
************************************************************************/
|