QGIS API Documentation  3.26.3-Buenos Aires (65e4edfdad)
qgsvectorlayerlegendwidget.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsvectorlayerlegendwidget.h
3  ---------------------
4  Date : April 2018
5  Copyright : (C) 2018 by Martin Dobias
6  Email : wonder dot sk at gmail dot com
7  ***************************************************************************
8  * *
9  * This program is free software; you can redistribute it and/or modify *
10  * it under the terms of the GNU General Public License as published by *
11  * the Free Software Foundation; either version 2 of the License, or *
12  * (at your option) any later version. *
13  * *
14  ***************************************************************************/
15 
16 #ifndef QGSVECTORLAYERLEGENDWIDGET_H
17 #define QGSVECTORLAYERLEGENDWIDGET_H
18 
19 // We don't want to expose this in the public API
20 #define SIP_NO_FILE
21 
22 #include <QWidget>
23 
24 #include "qgstextformat.h"
25 #include "qgis_gui.h"
26 
28 class QLabel;
29 class QPushButton;
30 class QTreeView;
31 class QTreeWidget;
32 class QTreeWidgetItem;
33 
34 class QgsFontButton;
36 class QgsMapCanvas;
37 class QgsVectorLayer;
38 
45 class GUI_EXPORT QgsVectorLayerLegendWidget : public QWidget
46 {
47  Q_OBJECT
48  public:
49  explicit QgsVectorLayerLegendWidget( QWidget *parent = nullptr );
50 
52  void setMapCanvas( QgsMapCanvas *canvas );
53 
55  QgsMapCanvas *mapCanvas() const { return mCanvas; }
56 
58  void setLayer( QgsVectorLayer *layer );
59 
61  void applyToLayer();
62 
63  private slots:
64  void labelsFromExpression();
65  void labelLegendTreeWidgetItemDoubleClicked( QTreeWidgetItem *item, int column );
66 
67  private:
68  void populateLegendTreeView( const QHash<QString, QString> &content );
69  void populateLabelLegendTreeWidget();
70  void applyLabelLegend();
71 
72  private:
73  QTreeView *mLegendTreeView = nullptr;
74  QgsFontButton *mTextOnSymbolFormatButton = nullptr;
75  QPushButton *mTextOnSymbolFromExpressionButton = nullptr;
76  QgsCollapsibleGroupBox *mTextOnSymbolGroupBox = nullptr;
77  QLabel *mTextOnSymbolLabel = nullptr;
78  QgsCollapsibleGroupBox *mLabelLegendGroupBox = nullptr;
79  QTreeWidget *mLabelLegendTreeWidget = nullptr;
80  QLabel *mPlaceholderImageLabel = nullptr;
81  QgsImageSourceLineEdit *mImageSourceLineEdit = nullptr;
82 
83  QgsMapCanvas *mCanvas = nullptr;
84  QgsVectorLayer *mLayer = nullptr;
85 };
86 
87 #endif // QGSVECTORLAYERLEGENDWIDGET_H
QgsMapCanvas
Map canvas is a class for displaying all GIS data types on a canvas.
Definition: qgsmapcanvas.h:89
QgsVectorLayerLegendWidget::mapCanvas
QgsMapCanvas * mapCanvas() const
Returns pointer to map canvas.
Definition: qgsvectorlayerlegendwidget.h:55
QgsVectorLayerLegendWidget
A widget for configuration of options specific to vector layer's legend.
Definition: qgsvectorlayerlegendwidget.h:45
QgsCollapsibleGroupBox
A groupbox that collapses/expands when toggled and can save its collapsed and checked states....
Definition: qgscollapsiblegroupbox.h:185
QgsFontButton
A button for customizing QgsTextFormat settings.
Definition: qgsfontbutton.h:47
QgsVectorLayer
Represents a vector layer which manages a vector based data sets.
Definition: qgsvectorlayer.h:391
QgsImageSourceLineEdit
A line edit widget with toolbutton for setting a raster image path.
Definition: qgsfilecontentsourcelineedit.h:278
qgstextformat.h