File: qgscolorrampbutton.sip.in

package info (click to toggle)
qgis 3.40.10%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,183,672 kB
  • sloc: cpp: 1,595,771; python: 372,544; xml: 23,474; sh: 3,761; perl: 3,664; ansic: 2,257; sql: 2,137; yacc: 1,068; lex: 577; javascript: 540; lisp: 411; makefile: 161
file content (353 lines) | stat: -rw-r--r-- 9,799 bytes parent folder | download | duplicates (12)
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
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
/************************************************************************
 * This file has been generated automatically from                      *
 *                                                                      *
 * src/gui/qgscolorrampbutton.h                                         *
 *                                                                      *
 * Do not edit manually ! Edit header and run scripts/sipify.py again   *
 ************************************************************************/




class QgsColorRampButton : QToolButton
{
%Docstring(signature="appended")
A cross platform button subclass for selecting color ramps. Will open
color ramp dialogs when clicked. Offers live updates to button from
color ramp dialog. An attached drop-down menu allows for access to saved
color ramps, as well as option to invert the current color ramp and
create new ramps.
%End

%TypeHeaderCode
#include "qgscolorrampbutton.h"
%End
  public:
    QgsColorRampButton( QWidget *parent /TransferThis/ = 0, const QString &dialogTitle = QString() );
%Docstring
Construct a new color ramp button. Use ``parent`` to attach a parent
QWidget to the dialog. Use ``dialogTitle`` string to define the title to
show in the color ramp dialog
%End

    ~QgsColorRampButton();

    virtual QSize sizeHint() const;


    QgsColorRamp *colorRamp() const /Factory/;
%Docstring
Returns a copy of the current color ramp.

.. seealso:: :py:func:`setColorRamp`
%End

    void setColorRampDialogTitle( const QString &title );
%Docstring
Set the title for the color ramp dialog window.

:param title: Title for the color ramp dialog

.. seealso:: :py:func:`colorRampDialogTitle`
%End

    QString colorRampDialogTitle() const;
%Docstring
Returns the title for the color ramp dialog window.

:return: title for the color ramp dialog

.. seealso:: :py:func:`setColorRampDialogTitle`
%End

    bool acceptLiveUpdates() const;
%Docstring
Returns whether the button accepts live updates from
:py:class:`QgsColorRampDialog`.

:return: ``True`` if the button will be accepted immediately when the
         dialog's color ramp changes

.. seealso:: :py:func:`setAcceptLiveUpdates`
%End

    void setAcceptLiveUpdates( const bool accept );
%Docstring
Sets whether the button accepts live updates from
:py:class:`QgsColorRampDialog`. Live updates may cause changes that are
not undoable on QColorRampDialog cancel.

:param accept: set to ``True`` to enable live updates

.. seealso:: :py:func:`acceptLiveUpdates`
%End

    void setShowMenu( bool showMenu );
%Docstring
Sets whether the drop-down menu should be shown for the button. The
default behavior is to show the menu.

:param showMenu: set to ``False`` to hide the drop-down menu

.. seealso:: :py:func:`showMenu`
%End

    bool showMenu() const;
%Docstring
Returns whether the drop-down menu is shown for the button.

:return: ``True`` if drop-down menu is shown

.. seealso:: :py:func:`setShowMenu`
%End

    void setDefaultColorRamp( QgsColorRamp *colorramp );
%Docstring
Sets the default color ramp for the button, which is shown in the
button's drop-down menu for the "default color ramp" option.

:param colorramp: default color ramp for the button. Set to ``None`` to
                  disable the default color ramp option. The ramp will
                  be cloned and ownership is not transferred.

.. seealso:: :py:func:`defaultColorRamp`
%End

    QgsColorRamp *defaultColorRamp() const /Factory/;
%Docstring
Returns a copy of the default color ramp for the button, which is shown
in the button's drop-down menu for the "default color ramp" option.

:return: default color ramp for the button. Returns ``None`` if the
         default color ramp option is disabled. Caller takes ownership
         of the returned object.

.. seealso:: :py:func:`setDefaultColorRamp`
%End

    void setShowRandomColorRamp( bool showRandom );
%Docstring
Sets whether a random colors option is shown in the button's drop-down
menu.

:param showRandom: set to ``True`` to show a random colors option

.. seealso:: :py:func:`showRandomColorRamp`
%End

    bool showRandomColorRamp() const;
%Docstring
Returns whether random colors option is shown in the button's drop-down
menu.

.. seealso:: :py:func:`setShowRandomColorRamp`
%End

    bool isRandomColorRamp() const;
%Docstring
Returns ``True`` if the current color ramp is random.

.. seealso:: :py:func:`setShowNull`

.. seealso:: :py:func:`showNull`
%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`
%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`
%End

    bool isNull() const;
%Docstring
Returns ``True`` if the current color ramp is null.

.. seealso:: :py:func:`setShowNull`

.. seealso:: :py:func:`showNull`
%End

    void setContext( const QString &context );
%Docstring
Sets the context string for the color ramp button. The context string is
passed to all color ramp preview icons shown in the button's drop-down
menu, to (eventually) allow them to customize their display colors based
on the context.

:param context: context string for the color dialog button's color ramp
                preview icons

.. seealso:: :py:func:`context`
%End

    QString context() const;
%Docstring
Returns the context string for the color ramp button. The context string
is passed to all color ramp preview icons shown in the button's
drop-down menu, to (eventually) allow them to customize their display
colors based on the context.

:return: context context string for the color dialog button's color ramp
         preview icons

.. seealso:: :py:func:`setContext`
%End

    void setShowGradientOnly( bool gradientonly );
%Docstring
Sets whether the color ramp button only shows gradient type ramps

:param gradientonly: set to ``True`` to show only gradient type ramps

.. seealso:: :py:func:`showGradientOnly`
%End

    bool showGradientOnly() const;
%Docstring
Returns ``True`` if the color ramp button only shows gradient type ramps

.. seealso:: :py:func:`setShowGradientOnly`
%End

    void setColorRampName( const QString &name );
%Docstring
Sets the name of the current color ramp when it's available in the style
manager

:param name: Name of the saved color ramp

.. seealso:: :py:func:`colorRampName`
%End

    QString colorRampName() const;
%Docstring
Returns the name of the current color ramp when it's available in the
style manager

.. seealso:: :py:func:`setColorRampName`
%End

  public slots:

    void setColorRamp( QgsColorRamp *colorramp );
%Docstring
Sets the current color ramp for the button. Will emit a
:py:func:`~QgsColorRampButton.colorRampChanged` signal if the color ramp
is different to the previous color ramp.

:param colorramp: New color ramp for the button. The ramp will be cloned
                  and ownership is not transferred.

.. seealso:: :py:func:`setRandomColorRamp`

.. seealso:: :py:func:`setColorRampFromName`

.. seealso:: :py:func:`colorRamp`
%End

    void setRandomColorRamp();
%Docstring
Sets the current color ramp for the button to random colors. Will emit a
:py:func:`~QgsColorRampButton.colorRampChanged` signal if the color ramp
is different to the previous color ramp.

.. seealso:: :py:func:`setColorRamp`

.. seealso:: :py:func:`setColorRampFromName`

.. seealso:: :py:func:`colorRamp`
%End

    void setColorRampFromName( const QString &name = QString() );
%Docstring
Sets the current color ramp for the button using a saved color ramp
name. Will emit a :py:func:`~QgsColorRampButton.colorRampChanged` signal
if the color ramp is different to the previous color ramp.

:param name: Name of saved color ramp

.. seealso:: :py:func:`setColorRamp`

.. seealso:: :py:func:`setRandomColorRamp`

.. seealso:: :py:func:`colorRamp`
%End

    void setButtonBackground( QgsColorRamp *colorramp = 0 );
%Docstring
Sets the background pixmap for the button based upon current color ramp.

:param colorramp: Color ramp for button background. If no color ramp is
                  specified, the button's current color ramp will be
                  used
%End

    void setToDefaultColorRamp();
%Docstring
Sets color ramp to the button's default color ramp, if set.

.. seealso:: :py:func:`setDefaultColorRamp`

.. seealso:: :py:func:`defaultColorRamp`

.. seealso:: :py:func:`setToNull`
%End

    void setToNull();
%Docstring
Sets color ramp to null.

.. seealso:: :py:func:`setToDefaultColorRamp`
%End

  signals:

    void colorRampChanged();
%Docstring
Emitted whenever a new color ramp is set for the button. The color ramp
is always valid. In case the new color ramp is the same, no signal is
emitted to avoid infinite loops.
%End

  protected:
    virtual bool event( QEvent *e );

    virtual void changeEvent( QEvent *e );

    virtual void showEvent( QShowEvent *e );

    virtual void resizeEvent( QResizeEvent *event );


    virtual void mousePressEvent( QMouseEvent *e );

%Docstring
Reimplemented to detect right mouse button clicks on the color ramp
button
%End

};

/************************************************************************
 * This file has been generated automatically from                      *
 *                                                                      *
 * src/gui/qgscolorrampbutton.h                                         *
 *                                                                      *
 * Do not edit manually ! Edit header and run scripts/sipify.py again   *
 ************************************************************************/