1/************************************************************************
2 * This file has been generated automatically from                      *
3 *                                                                      *
4 * src/core/layout/qgslayoutitemlegend.h                                *
5 *                                                                      *
6 * Do not edit manually ! Edit header and run scripts/sipify.pl again   *
7 ************************************************************************/
8
9
10
11
12
13class QgsLegendModel : QgsLayerTreeModel
14{
15%Docstring(signature="appended")
16Item model implementation based on layer tree model for layout legend.
17
18Overrides some functionality of :py:class:`QgsLayerTreeModel` to better fit the needs of layout legends.
19
20.. versionadded:: 2.6
21%End
22
23%TypeHeaderCode
24#include "qgslayoutitemlegend.h"
25%End
26  public:
27    QgsLegendModel( QgsLayerTree *rootNode, QObject *parent /TransferThis/ = 0, QgsLayoutItemLegend *layout = 0 );
28%Docstring
29Construct the model based on the given layer tree
30%End
31
32    QgsLegendModel( QgsLayerTree *rootNode,  QgsLayoutItemLegend *layout );
33%Docstring
34Alternative constructor.
35%End
36
37    virtual QVariant data( const QModelIndex &index, int role ) const;
38
39
40    virtual Qt::ItemFlags flags( const QModelIndex &index ) const;
41
42
43
44    void clearCachedData( QgsLayerTreeNode *node ) const;
45%Docstring
46Clears any previously cached data for the specified ``node``.
47
48.. versionadded:: 3.14
49%End
50
51  signals:
52
53    void refreshLegend();
54%Docstring
55Emitted to refresh the legend.
56
57.. versionadded:: 3.10
58%End
59
60};
61
62
63
64class QgsLayoutItemLegend : QgsLayoutItem
65{
66%Docstring(signature="appended")
67A layout item subclass for map legends.
68
69.. versionadded:: 3.0
70%End
71
72%TypeHeaderCode
73#include "qgslayoutitemlegend.h"
74%End
75  public:
76
77    QgsLayoutItemLegend( QgsLayout *layout );
78%Docstring
79Constructor for QgsLayoutItemLegend, with the specified parent ``layout``.
80%End
81
82    static QgsLayoutItemLegend *create( QgsLayout *layout ) /Factory/;
83%Docstring
84Returns a new legend item for the specified ``layout``.
85
86The caller takes responsibility for deleting the returned object.
87%End
88
89    virtual int type() const;
90
91    virtual QIcon icon() const;
92
93    virtual QgsLayoutItem::Flags itemFlags() const;
94
95    virtual QString displayName() const;
96
97
98    void adjustBoxSize();
99%Docstring
100Sets the legend's item bounds to fit the whole legend content.
101%End
102
103    void setResizeToContents( bool enabled );
104%Docstring
105Sets whether the legend should automatically resize to fit its contents.
106
107:param enabled: set to ``False`` to disable automatic resizing. The legend frame will not
108                be expanded to fit legend items, and items may be cropped from display.
109
110.. seealso:: :py:func:`resizeToContents`
111%End
112
113    bool resizeToContents() const;
114%Docstring
115Returns whether the legend should automatically resize to fit its contents.
116
117.. seealso:: :py:func:`setResizeToContents`
118%End
119
120    QgsLegendModel *model();
121%Docstring
122Returns the legend model.
123%End
124
125    void setAutoUpdateModel( bool autoUpdate );
126%Docstring
127Sets whether the legend content should auto update to reflect changes in the project's
128layer tree.
129
130.. seealso:: :py:func:`autoUpdateModel`
131%End
132
133    bool autoUpdateModel() const;
134%Docstring
135Returns whether the legend content should auto update to reflect changes in the project's
136layer tree.
137
138.. seealso:: :py:func:`setAutoUpdateModel`
139%End
140
141    void setLegendFilterByMapEnabled( bool enabled );
142%Docstring
143Set whether legend items should be filtered to show just the ones visible in the associated map.
144
145.. seealso:: :py:func:`legendFilterByMapEnabled`
146%End
147
148    bool legendFilterByMapEnabled() const;
149%Docstring
150Find out whether legend items are filtered to show just the ones visible in the associated map
151
152.. seealso:: :py:func:`setLegendFilterByMapEnabled`
153%End
154
155    void setLegendFilterOutAtlas( bool doFilter );
156%Docstring
157When set to ``True``, during an atlas rendering, it will filter out legend elements
158where features are outside the current atlas feature.
159
160.. seealso:: :py:func:`legendFilterOutAtlas`
161%End
162
163    bool legendFilterOutAtlas() const;
164%Docstring
165Returns whether to filter out legend elements outside of the current atlas feature.
166
167.. seealso:: :py:func:`setLegendFilterOutAtlas`
168%End
169
170    void setTitle( const QString &title );
171%Docstring
172Sets the legend ``title``.
173
174.. seealso:: :py:func:`title`
175%End
176
177    QString title() const;
178%Docstring
179Returns the legend title.
180
181.. seealso:: :py:func:`setTitle`
182%End
183
184    Qt::AlignmentFlag titleAlignment() const;
185%Docstring
186Returns the alignment of the legend title.
187
188.. seealso:: :py:func:`setTitleAlignment`
189%End
190
191    void setTitleAlignment( Qt::AlignmentFlag alignment );
192%Docstring
193Sets the ``alignment`` of the legend title.
194
195.. seealso:: :py:func:`titleAlignment`
196%End
197
198    QgsLegendStyle &rstyle( QgsLegendStyle::Style s );
199%Docstring
200Returns reference to modifiable legend style.
201%End
202
203    QgsLegendStyle style( QgsLegendStyle::Style s ) const;
204%Docstring
205Returns legend style.
206%End
207
208    void setStyle( QgsLegendStyle::Style component, const QgsLegendStyle &style );
209%Docstring
210Sets the style of ``component`` to ``style`` for the legend.
211%End
212
213    QFont styleFont( QgsLegendStyle::Style component ) const;
214%Docstring
215Returns the font settings for a legend ``component``.
216
217.. seealso:: :py:func:`setStyleFont`
218%End
219
220    void setStyleFont( QgsLegendStyle::Style component, const QFont &font );
221%Docstring
222Sets the style ``font`` for a legend ``component``.
223
224.. seealso:: :py:func:`styleFont`
225%End
226
227    void setStyleMargin( QgsLegendStyle::Style component, double margin );
228%Docstring
229Set the ``margin`` for a legend ``component``.
230%End
231
232    void setStyleMargin( QgsLegendStyle::Style component, QgsLegendStyle::Side side, double margin );
233%Docstring
234Set the ``margin`` for a particular ``side`` of a legend ``component``.
235%End
236
237    double lineSpacing() const;
238%Docstring
239Returns the spacing in-between lines in layout units.
240
241.. seealso:: :py:func:`setLineSpacing`
242%End
243
244    void setLineSpacing( double spacing );
245%Docstring
246Sets the ``spacing`` in-between multiple lines.
247
248.. seealso:: :py:func:`lineSpacing`
249%End
250
251    double boxSpace() const;
252%Docstring
253Returns the legend box space.
254
255.. seealso:: :py:func:`setBoxSpace`
256%End
257
258    void setBoxSpace( double space );
259%Docstring
260Sets the legend box ``space``.
261
262.. seealso:: :py:func:`boxSpace`
263%End
264
265    double columnSpace() const;
266%Docstring
267Returns the legend column spacing.
268
269.. seealso:: :py:func:`setColumnSpace`
270%End
271
272    void setColumnSpace( double spacing );
273%Docstring
274Sets the legend column ``spacing``.
275
276.. seealso:: :py:func:`columnSpace`
277%End
278
279    QColor fontColor() const;
280%Docstring
281Returns the legend font color.
282
283.. seealso:: :py:func:`setFontColor`
284%End
285
286    void setFontColor( const QColor &color );
287%Docstring
288Sets the legend font ``color``.
289
290.. seealso:: :py:func:`fontColor`
291%End
292
293    double symbolWidth() const;
294%Docstring
295Returns the legend symbol width.
296
297.. seealso:: :py:func:`setSymbolWidth`
298%End
299
300    void setSymbolWidth( double width );
301%Docstring
302Sets the legend symbol ``width``.
303
304.. seealso:: :py:func:`symbolWidth`
305%End
306
307    double maximumSymbolSize() const;
308%Docstring
309Returns the maximum symbol size (in mm). 0.0 means there is no maximum set.
310
311.. seealso:: :py:func:`setMaximumSymbolSize`
312
313.. versionadded:: 3.16
314%End
315
316    void setMaximumSymbolSize( double size );
317%Docstring
318Set the maximum symbol ``size`` for symbol (in millimeters).
319
320A symbol size of 0.0 indicates no maximum is set.
321
322.. seealso:: :py:func:`maximumSymbolSize`
323
324.. versionadded:: 3.16
325%End
326
327    double minimumSymbolSize() const;
328%Docstring
329Returns the minimum symbol size (in mm). A value 0.0 means there is no minimum set.
330
331.. seealso:: :py:func:`setMinimumSymbolSize`
332
333.. versionadded:: 3.16
334%End
335
336    void setMinimumSymbolSize( double size );
337%Docstring
338Set the minimum symbol ``size`` for symbol (in millimeters).
339
340A symbol size of 0.0 indicates no minimum is set.
341
342.. seealso:: :py:func:`minimumSymbolSize`
343
344.. versionadded:: 3.16
345%End
346
347    void setSymbolAlignment( Qt::AlignmentFlag alignment );
348%Docstring
349Sets the ``alignment`` for placement of legend symbols.
350
351Only Qt.AlignLeft or Qt.AlignRight are supported values.
352
353.. seealso:: :py:func:`symbolAlignment`
354
355.. versionadded:: 3.10
356%End
357
358    Qt::AlignmentFlag symbolAlignment() const;
359%Docstring
360Returns the alignment for placement of legend symbols.
361
362Only Qt.AlignLeft or Qt.AlignRight are supported values.
363
364.. seealso:: :py:func:`setSymbolAlignment`
365
366.. versionadded:: 3.10
367%End
368
369    double symbolHeight() const;
370%Docstring
371Returns the legend symbol height.
372
373.. seealso:: :py:func:`setSymbolHeight`
374%End
375
376    void setSymbolHeight( double height );
377%Docstring
378Sets the legend symbol ``height``.
379
380.. seealso:: :py:func:`symbolHeight`
381%End
382
383    double wmsLegendWidth() const;
384%Docstring
385Returns the WMS legend width.
386
387.. seealso:: :py:func:`setWmsLegendWidth`
388%End
389
390    void setWmsLegendWidth( double width );
391%Docstring
392Sets the WMS legend ``width``.
393
394.. seealso:: :py:func:`wmsLegendWidth`
395%End
396
397    double wmsLegendHeight() const;
398%Docstring
399Returns the WMS legend height.
400
401.. seealso:: :py:func:`setWmsLegendHeight`
402%End
403
404    void setWmsLegendHeight( double height );
405%Docstring
406Sets the WMS legend ``height``.
407
408.. seealso:: :py:func:`wmsLegendHeight`
409%End
410
411    void setWrapString( const QString &string );
412%Docstring
413Sets the legend text wrapping ``string``.
414
415.. seealso:: :py:func:`wrapString`
416%End
417
418    QString wrapString() const;
419%Docstring
420Returns the legend text wrapping string.
421
422.. seealso:: :py:func:`setWrapString`
423%End
424
425    int columnCount() const;
426%Docstring
427Returns the legend column count.
428
429.. seealso:: :py:func:`setColumnCount`
430%End
431
432    void setColumnCount( int count );
433%Docstring
434Sets the legend column ``count``.
435
436.. seealso:: :py:func:`columnCount`
437%End
438
439    bool splitLayer() const;
440%Docstring
441Returns whether the legend items from a single layer can be split
442over multiple columns.
443
444.. seealso:: :py:func:`setSplitLayer`
445%End
446
447    void setSplitLayer( bool enabled );
448%Docstring
449Sets whether the legend items from a single layer can be split
450over multiple columns.
451
452.. seealso:: :py:func:`splitLayer`
453%End
454
455    bool equalColumnWidth() const;
456%Docstring
457Returns whether column widths should be equalized.
458
459.. seealso:: :py:func:`setEqualColumnWidth`
460%End
461
462    void setEqualColumnWidth( bool equalize );
463%Docstring
464Sets whether column widths should be equalized.
465
466.. seealso:: :py:func:`equalColumnWidth`
467%End
468
469    bool drawRasterStroke() const;
470%Docstring
471Returns whether a stroke will be drawn around raster symbol items.
472
473.. seealso:: :py:func:`setDrawRasterStroke`
474
475.. seealso:: :py:func:`rasterStrokeColor`
476
477.. seealso:: :py:func:`rasterStrokeWidth`
478%End
479
480    void setDrawRasterStroke( bool enabled );
481%Docstring
482Sets whether a stroke will be drawn around raster symbol items.
483
484:param enabled: set to ``True`` to draw borders
485
486.. seealso:: :py:func:`drawRasterStroke`
487
488.. seealso:: :py:func:`setRasterStrokeColor`
489
490.. seealso:: :py:func:`setRasterStrokeWidth`
491%End
492
493    QColor rasterStrokeColor() const;
494%Docstring
495Returns the stroke color for the stroke drawn around raster symbol items. The stroke is
496only drawn if :py:func:`~QgsLayoutItemLegend.drawRasterStroke` is ``True``.
497
498.. seealso:: :py:func:`setRasterStrokeColor`
499
500.. seealso:: :py:func:`drawRasterStroke`
501
502.. seealso:: :py:func:`rasterStrokeWidth`
503%End
504
505    void setRasterStrokeColor( const QColor &color );
506%Docstring
507Sets the stroke ``color`` for the stroke drawn around raster symbol items. The stroke is
508only drawn if :py:func:`~QgsLayoutItemLegend.drawRasterStroke` is ``True``.
509
510.. seealso:: :py:func:`rasterStrokeColor`
511
512.. seealso:: :py:func:`setDrawRasterStroke`
513
514.. seealso:: :py:func:`setRasterStrokeWidth`
515%End
516
517    double rasterStrokeWidth() const;
518%Docstring
519Returns the stroke width (in layout units) for the stroke drawn around raster symbol items. The stroke is
520only drawn if :py:func:`~QgsLayoutItemLegend.drawRasterStroke` is ``True``.
521
522.. seealso:: :py:func:`setRasterStrokeWidth`
523
524.. seealso:: :py:func:`drawRasterStroke`
525
526.. seealso:: :py:func:`rasterStrokeColor`
527%End
528
529    void setRasterStrokeWidth( double width );
530%Docstring
531Sets the stroke width for the stroke drawn around raster symbol items. The stroke is
532only drawn if :py:func:`~QgsLayoutItemLegend.drawRasterStroke` is ``True``.
533
534.. seealso:: :py:func:`rasterStrokeWidth`
535
536.. seealso:: :py:func:`setDrawRasterStroke`
537
538.. seealso:: :py:func:`setRasterStrokeColor`
539%End
540
541    void setLinkedMap( QgsLayoutItemMap *map );
542%Docstring
543Sets the ``map`` to associate with the legend.
544
545.. seealso:: :py:func:`linkedMap`
546%End
547
548    QgsLayoutItemMap *linkedMap() const;
549%Docstring
550Returns the associated map.
551
552.. seealso:: :py:func:`setLinkedMap`
553%End
554
555    QString themeName() const;
556%Docstring
557Returns the name of the theme currently linked to the legend.
558
559This usually equates to the theme rendered in the :py:func:`~QgsLayoutItemLegend.linkedMap`.
560
561.. versionadded:: 3.14
562%End
563
564    void updateLegend();
565%Docstring
566Updates the model and all legend entries.
567%End
568
569    void updateFilterByMap( bool redraw = true );
570%Docstring
571Updates the legend content when filtered by map.
572%End
573
574    const QgsLegendSettings &legendSettings() const;
575%Docstring
576Returns the legend's renderer settings object.
577%End
578
579    virtual void paint( QPainter *painter, const QStyleOptionGraphicsItem *itemStyle, QWidget *pWidget );
580
581
582    virtual void finalizeRestoreFromXml();
583
584
585    virtual QgsExpressionContext createExpressionContext() const;
586
587    virtual ExportLayerBehavior exportLayerBehavior() const;
588
589    virtual bool accept( QgsStyleEntityVisitorInterface *visitor ) const;
590
591
592  public slots:
593
594    virtual void refresh();
595
596    virtual void refreshDataDefinedProperty( QgsLayoutObject::DataDefinedProperty property = QgsLayoutObject::AllProperties );
597
598
599  protected:
600    virtual void draw( QgsLayoutItemRenderContext &context );
601
602    virtual bool writePropertiesToElement( QDomElement &element, QDomDocument &document, const QgsReadWriteContext &context ) const;
603
604    virtual bool readPropertiesFromElement( const QDomElement &element, const QDomDocument &document, const QgsReadWriteContext &context );
605
606
607};
608
609
610/************************************************************************
611 * This file has been generated automatically from                      *
612 *                                                                      *
613 * src/core/layout/qgslayoutitemlegend.h                                *
614 *                                                                      *
615 * Do not edit manually ! Edit header and run scripts/sipify.pl again   *
616 ************************************************************************/
617