File: qgslegendsettings.sip.in

package info (click to toggle)
qgis 3.40.11%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,183,800 kB
  • sloc: cpp: 1,595,841; python: 372,637; 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: 154
file content (639 lines) | stat: -rw-r--r-- 15,966 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
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
/************************************************************************
 * This file has been generated automatically from                      *
 *                                                                      *
 * src/core/qgslegendsettings.h                                         *
 *                                                                      *
 * Do not edit manually ! Edit header and run scripts/sipify.py again   *
 ************************************************************************/






class QgsLegendSettings
{
%Docstring(signature="appended")
The :py:class:`QgsLegendSettings` class stores the appearance and layout
settings for legend drawing with :py:class:`QgsLegendRenderer`.

The content of the legend is driven by the :py:class:`QgsLegendModel`
class.
%End

%TypeHeaderCode
#include "qgslegendsettings.h"
%End
  public:
    QgsLegendSettings();

    void updateDataDefinedProperties( QgsRenderContext &context );
%Docstring
Updates any data-defined properties in the settings, using the specified
render ``context``.

.. versionadded:: 3.42
%End

    void setTitle( const QString &t );
%Docstring
Sets the title for the legend, which will be rendered above all legend
items.

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

    QString title() const;
%Docstring
Returns the title for the legend, which will be rendered above all
legend items.

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

    Qt::AlignmentFlag titleAlignment() const;
%Docstring
Returns the alignment of the legend title.

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

    void setTitleAlignment( Qt::AlignmentFlag alignment );
%Docstring
Sets the ``alignment`` of the legend title.

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


    QgsLegendStyle style( QgsLegendStyle::Style s ) const;
%Docstring
Returns the style for a legend component.

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

    void setStyle( QgsLegendStyle::Style s, const QgsLegendStyle &style );
%Docstring
Sets the ``style`` for a legend component.

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

    double boxSpace() const;
%Docstring
Returns the legend box space (in millimeters), which is the empty margin
around the inside of the legend's rectangle.

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

    void setBoxSpace( double s );
%Docstring
Sets the legend box space (in millimeters), which is the empty margin
around the inside of the legend's rectangle.

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

    void setWrapChar( const QString &t );
%Docstring
Sets a string to use as a wrapping character.

Whenever this string is encountered inside legend component text it will
be automatically replaced with a new line character.

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

    QString wrapChar() const;
%Docstring
Returns the string used as a wrapping character.

Whenever this string is encountered inside legend component text it will
be automatically replaced with a new line character.

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

    double columnSpace() const;
%Docstring
Returns the margin space between adjacent columns (in millimeters).

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

    void setColumnSpace( double s );
%Docstring
Sets the margin space between adjacent columns (in millimeters).

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

    int columnCount() const;
%Docstring
Returns the desired minimum number of columns to show in the legend.

If legend components have forced column breaks then the actual number of
columns in the rendered legend may be larger than this value.

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

    void setColumnCount( int c );
%Docstring
Sets the desired minimum number of columns to show in the legend.

If legend components have forced column breaks then the actual number of
columns in the rendered legend may be larger than this value.

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

    bool splitLayer() const;
%Docstring
Returns ``True`` if layer components can be split over multiple columns.

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

    void setSplitLayer( bool s );
%Docstring
Sets whether layer components can be split over multiple columns.

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

    bool equalColumnWidth() const;
%Docstring
Returns ``True`` if all columns should have equal widths.

If ``False`` is returned then columns will be individually resized to
their minimum possible width.

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

    void setEqualColumnWidth( bool s );
%Docstring
Sets whether all columns should have equal widths.

If ``False``, then then columns will be individually resized to their
minimum possible width.

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

 QColor fontColor() const /Deprecated/;
%Docstring
Returns the font color used for legend items.

.. seealso:: :py:func:`setFontColor`

.. deprecated:: 3.40

   Use :py:func:`QgsLegendStyle.textFormat()` instead.
%End

 void setFontColor( const QColor &c ) /Deprecated/;
%Docstring
Sets the font color used for legend items.

.. seealso:: :py:func:`fontColor`

.. deprecated:: 3.40

   Use :py:func:`QgsLegendStyle.textFormat()` instead.
%End

 QColor layerFontColor() const /Deprecated/;
%Docstring
Returns layer font color, defaults to
:py:func:`~QgsLegendSettings.fontColor`

.. seealso:: :py:func:`setLayerFontColor`

.. seealso:: :py:func:`fontColor`

.. deprecated:: 3.40

   Use :py:func:`QgsLegendStyle.textFormat()` instead.
%End

 void setLayerFontColor( const QColor &fontColor ) /Deprecated/;
%Docstring
Sets layer font color to ``fontColor`` Overrides
:py:func:`~QgsLegendSettings.fontColor`

.. seealso:: :py:func:`layerFontColor`

.. seealso:: :py:func:`fontColor`

.. deprecated:: 3.40

   Use :py:func:`QgsLegendStyle.textFormat()` instead.
%End

    QSizeF symbolSize() const;
%Docstring
Returns the default symbol size (in millimeters) used for legend items.

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

    void setSymbolSize( QSizeF s );
%Docstring
Sets the default symbol size (in millimeters) used for legend items.

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

    double maximumSymbolSize() const;
%Docstring
Returns the maximum symbol size (in mm). 0.0 means there is no maximum
set.

.. seealso:: :py:func:`setMaximumSymbolSize`

.. versionadded:: 3.16
%End

    void setMaximumSymbolSize( double size );
%Docstring
Set the maximum symbol ``size`` for symbol (in millimeters).

A symbol size of 0.0 indicates no maximum is set.

.. seealso:: :py:func:`maximumSymbolSize`

.. versionadded:: 3.16
%End

    double minimumSymbolSize() const;
%Docstring
Returns the minimum symbol size (in mm). A value 0.0 means there is no
minimum set.

.. seealso:: :py:func:`setMinimumSymbolSize`

.. versionadded:: 3.16
%End

    void setMinimumSymbolSize( double size );
%Docstring
Set the minimum symbol ``size`` for symbol (in millimeters).

A symbol size of 0.0 indicates no minimum is set.

.. seealso:: :py:func:`minimumSymbolSize`

.. versionadded:: 3.16
%End

    void setSymbolAlignment( Qt::AlignmentFlag alignment );
%Docstring
Sets the ``alignment`` for placement of legend symbols.

Only Qt.AlignLeft or Qt.AlignRight are supported values.

.. seealso:: :py:func:`symbolAlignment`

.. versionadded:: 3.10
%End

    Qt::AlignmentFlag symbolAlignment() const;
%Docstring
Returns the alignment for placement of legend symbols.

Only Qt.AlignLeft or Qt.AlignRight are supported values.

.. seealso:: :py:func:`setSymbolAlignment`

.. versionadded:: 3.10
%End

    bool drawRasterStroke() const;
%Docstring
Returns whether a stroke will be drawn around raster symbol items.

.. seealso:: :py:func:`setDrawRasterStroke`

.. seealso:: :py:func:`rasterStrokeColor`

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

    void setDrawRasterStroke( bool enabled );
%Docstring
Sets whether a stroke will be drawn around raster symbol items.

:param enabled: set to ``True`` to draw borders

.. seealso:: :py:func:`drawRasterStroke`

.. seealso:: :py:func:`setRasterStrokeColor`

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

    QColor rasterStrokeColor() const;
%Docstring
Returns the stroke color for the stroke drawn around raster symbol
items. The stroke is only drawn if
:py:func:`~QgsLegendSettings.drawRasterStroke` is ``True``.

.. seealso:: :py:func:`setRasterStrokeColor`

.. seealso:: :py:func:`drawRasterStroke`

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

    void setRasterStrokeColor( const QColor &color );
%Docstring
Sets the stroke color for the stroke drawn around raster symbol items.
The stroke is only drawn if
:py:func:`~QgsLegendSettings.drawRasterStroke` is ``True``.

:param color: stroke color

.. seealso:: :py:func:`rasterStrokeColor`

.. seealso:: :py:func:`setDrawRasterStroke`

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

    double rasterStrokeWidth() const;
%Docstring
Returns the stroke width (in millimeters) for the stroke drawn around
raster symbol items. The stroke is only drawn if
:py:func:`~QgsLegendSettings.drawRasterStroke` is ``True``.

.. seealso:: :py:func:`setRasterStrokeWidth`

.. seealso:: :py:func:`drawRasterStroke`

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

    void setRasterStrokeWidth( double width );
%Docstring
Sets the stroke width for the stroke drawn around raster symbol items.
The stroke is only drawn if
:py:func:`~QgsLegendSettings.drawRasterStroke` is ``True``.

:param width: stroke width in millimeters

.. seealso:: :py:func:`rasterStrokeWidth`

.. seealso:: :py:func:`setDrawRasterStroke`

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

    QSizeF wmsLegendSize() const;
%Docstring
Returns the size (in millimeters) of WMS legend graphics shown in the
legend.

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

    void setWmsLegendSize( QSizeF s );
%Docstring
Sets the desired size (in millimeters) of WMS legend graphics shown in
the legend.

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

    void setSynchronousLegendRequests( bool b );
%Docstring
Sets whether to request legend graphics synchronously.

.. seealso:: :py:func:`synchronousLegendRequests`

.. versionadded:: 3.34
%End

    bool synchronousLegendRequests() const;
%Docstring
Returns whether to request legend graphics synchronously.

.. seealso:: :py:func:`setSynchronousLegendRequests`

.. versionadded:: 3.34
%End

 double lineSpacing() const /Deprecated/;
%Docstring
Returns the line spacing to use between lines of legend text.

.. seealso:: :py:func:`setLineSpacing`

.. deprecated:: 3.40

   Use :py:func:`QgsLegendStyle.textFormat()` from :py:func:`~QgsLegendSettings.style` instead.
%End

 void setLineSpacing( double s );
%Docstring
Sets the line spacing to use between lines of legend text.

.. seealso:: :py:func:`lineSpacing`

.. deprecated:: 3.40

   Use :py:func:`QgsLegendStyle.setTextFormat()` from :py:func:`~QgsLegendSettings.style` instead.
%End

 double mmPerMapUnit() const /Deprecated/;
%Docstring
.. deprecated:: 3.40

   Use scale factor from render contexts instead.
%End

 void setMmPerMapUnit( double mmPerMapUnit ) /Deprecated/;
%Docstring
.. deprecated:: 3.40

   Set scale factor on render contexts instead.
%End

 bool useAdvancedEffects() const /Deprecated/;
%Docstring
.. deprecated:: 3.40

   Use flags from render contexts instead.
%End

 void setUseAdvancedEffects( bool use ) /Deprecated/;
%Docstring
.. deprecated:: 3.40

   Set flag on render contexts instead.
%End

 double mapScale() const /Deprecated/;
%Docstring
Returns the legend map scale. The scale value indicates the scale
denominator, e.g. 1000.0 for a 1:1000 map.

.. seealso:: :py:func:`setMapScale`

.. deprecated:: 3.40

   Take this property from the render context instead.
%End

 void setMapScale( double scale ) /Deprecated/;
%Docstring
Sets the legend map ``scale``. The ``scale`` value indicates the scale
denominator, e.g. 1000.0 for a 1:1000 map.

.. seealso:: :py:func:`mapScale`

.. deprecated:: 3.40

   Set this property on the render context instead.
%End

 double mapUnitsPerPixel() const /Deprecated/;
%Docstring
Returns the factor of map units per pixel for symbols with size given in
map units calculated by dpi and mmPerMapUnit

.. seealso:: :py:func:`setMapUnitsPerPixel`

.. deprecated:: 3.40

   Take these properties on render contexts instead.
%End

 void setMapUnitsPerPixel( double mapUnitsPerPixel ) /Deprecated/;
%Docstring
Sets the mmPerMapUnit calculated by ``mapUnitsPerPixel`` mostly taken
from the map settings.

.. seealso:: :py:func:`mapUnitsPerPixel`

.. deprecated:: 3.40

   Set these properties on render contexts instead.
%End

 int dpi() const /Deprecated/;
%Docstring
.. deprecated:: 3.40

   Take dpi from render contexts instead.
%End

 void setDpi( int dpi ) /Deprecated/;
%Docstring
.. deprecated:: 3.40

   Set dpi on render contexts instead.
%End



    QStringList evaluateItemText( const QString &text, const QgsExpressionContext &context ) const;
%Docstring
Returns the actual text to render for a legend item, split into separate
lines.

The expression ``context`` argument is used to correctly evaluated
expressions contained within legend item text.

.. versionadded:: 3.6
%End

    QStringList splitStringForWrapping( const QString &stringToSplt ) const;
%Docstring
Splits a string using the wrap char taking into account handling empty
wrap char which means no wrapping
%End

    void drawText( QPainter *p, double x, double y, const QString &text, const QFont &font ) const;
%Docstring
Draws Text. Takes care about all the composer specific issues
(calculation to pixel, scaling of font and painter to work around the Qt
font bug)
%End

    void drawText( QPainter *p, const QRectF &rect, const QString &text, const QFont &font, Qt::AlignmentFlag halignment = Qt::AlignLeft, Qt::AlignmentFlag valignment = Qt::AlignTop, int flags = Qt::TextWordWrap ) const;
%Docstring
Like the above, but with a rectangle for multiline text

:param p: painter to use
:param rect: rectangle to draw into
:param text: text to draw
:param font: font to use
:param halignment: optional horizontal alignment
:param valignment: optional vertical alignment
:param flags: allows for passing Qt.TextFlags to control appearance of
              rendered text
%End

    QFont scaledFontPixelSize( const QFont &font ) const;
%Docstring
Returns a font where size is in pixel and font size is upscaled with
FONT_WORKAROUND_SCALE
%End

    double pixelFontSize( double pointSize ) const;
%Docstring
Calculates font to from point size to pixel size
%End

    double textWidthMillimeters( const QFont &font, const QString &text ) const;
%Docstring
Returns the font width in millimeters (considers upscaling and
downscaling with FONT_WORKAROUND_SCALE
%End

    double fontHeightCharacterMM( const QFont &font, QChar c ) const;
%Docstring
Returns the font height of a character in millimeters
%End

    double fontAscentMillimeters( const QFont &font ) const;
%Docstring
Returns the font ascent in Millimeters (considers upscaling and
downscaling with FONT_WORKAROUND_SCALE
%End

    double fontDescentMillimeters( const QFont &font ) const;
%Docstring
Returns the font descent in Millimeters (considers upscaling and
downscaling with FONT_WORKAROUND_SCALE
%End

    Qgis::LegendJsonRenderFlags jsonRenderFlags() const;
%Docstring
Returns the JSON export flags.

.. versionadded:: 3.36
%End

    void setJsonRenderFlags( const Qgis::LegendJsonRenderFlags &jsonRenderFlags );
%Docstring
Sets the the JSON export flags to ``jsonRenderFlags``.

.. versionadded:: 3.36
%End

};



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