QGIS API Documentation 3.99.0-Master (2fe06baccd8)
Loading...
Searching...
No Matches
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 "qgis_gui.h"
23#include "qgstextformat.h"
24
25#include <QWidget>
26
28class QLabel;
29class QPushButton;
30class QTreeView;
31class QTreeWidget;
32class QTreeWidgetItem;
33class QCheckBox;
34
35class QgsFontButton;
37class QgsMapCanvas;
38class QgsVectorLayer;
39
46class GUI_EXPORT QgsVectorLayerLegendWidget : public QWidget
47{
48 Q_OBJECT
49 public:
50 explicit QgsVectorLayerLegendWidget( QWidget *parent = nullptr );
51
53 void setMapCanvas( QgsMapCanvas *canvas );
54
56 QgsMapCanvas *mapCanvas() const { return mCanvas; }
57
59 void setLayer( QgsVectorLayer *layer );
60
62 void applyToLayer();
63
64 private slots:
65 void labelsFromExpression();
66 void labelLegendTreeWidgetItemDoubleClicked( QTreeWidgetItem *item, int column );
67
68 private:
69 void populateLegendTreeView( const QHash<QString, QString> &content );
70 void populateLabelLegendTreeWidget();
71 void applyLabelLegend();
72
73 private:
74 QCheckBox *mIncludeByDefaultInLayoutLegendsCheck = nullptr;
75 QTreeView *mLegendTreeView = nullptr;
76 QgsFontButton *mTextOnSymbolFormatButton = nullptr;
77 QPushButton *mTextOnSymbolFromExpressionButton = nullptr;
78 QgsCollapsibleGroupBox *mTextOnSymbolGroupBox = nullptr;
79 QgsCollapsibleGroupBox *mLabelLegendGroupBox = nullptr;
80 QTreeWidget *mLabelLegendTreeWidget = nullptr;
81 QLabel *mPlaceholderImageLabel = nullptr;
82 QgsImageSourceLineEdit *mImageSourceLineEdit = nullptr;
83
84 QgsMapCanvas *mCanvas = nullptr;
85 QgsVectorLayer *mLayer = nullptr;
86};
87
88#endif // QGSVECTORLAYERLEGENDWIDGET_H
A groupbox that collapses/expands when toggled and can save its collapsed and checked states.
A button for customizing QgsTextFormat settings.
A line edit widget with toolbutton for setting a raster image path.
Map canvas is a class for displaying all GIS data types on a canvas.
QgsMapCanvas * mapCanvas() const
Returns pointer to map canvas.
QgsVectorLayerLegendWidget(QWidget *parent=nullptr)
void setMapCanvas(QgsMapCanvas *canvas)
Sets pointer to map canvas.
Represents a vector layer which manages a vector based dataset.