QGIS API Documentation 3.99.0-Master (a8f284845db)
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
21#include "qgis_gui.h"
22#include "qgstextformat.h"
23
24#include <QWidget>
25
26#define SIP_NO_FILE
27
29class QLabel;
30class QPushButton;
31class QTreeView;
32class QTreeWidget;
33class QTreeWidgetItem;
34class QCheckBox;
35
36class QgsFontButton;
38class QgsMapCanvas;
39class QgsVectorLayer;
40
47class GUI_EXPORT QgsVectorLayerLegendWidget : public QWidget
48{
49 Q_OBJECT
50 public:
51 explicit QgsVectorLayerLegendWidget( QWidget *parent = nullptr );
52
54 void setMapCanvas( QgsMapCanvas *canvas );
55
57 QgsMapCanvas *mapCanvas() const { return mCanvas; }
58
60 void setLayer( QgsVectorLayer *layer );
61
63 void applyToLayer();
64
65 private slots:
66 void labelsFromExpression();
67 void labelLegendTreeWidgetItemDoubleClicked( QTreeWidgetItem *item, int column );
68
69 private:
70 void populateLegendTreeView( const QHash<QString, QString> &content );
71 void populateLabelLegendTreeWidget();
72 void applyLabelLegend();
73
74 private:
75 QCheckBox *mIncludeByDefaultInLayoutLegendsCheck = nullptr;
76 QTreeView *mLegendTreeView = nullptr;
77 QgsFontButton *mTextOnSymbolFormatButton = nullptr;
78 QPushButton *mTextOnSymbolFromExpressionButton = nullptr;
79 QgsCollapsibleGroupBox *mTextOnSymbolGroupBox = nullptr;
80 QgsCollapsibleGroupBox *mLabelLegendGroupBox = nullptr;
81 QTreeWidget *mLabelLegendTreeWidget = nullptr;
82 QLabel *mPlaceholderImageLabel = nullptr;
83 QgsImageSourceLineEdit *mImageSourceLineEdit = nullptr;
84
85 QgsMapCanvas *mCanvas = nullptr;
86 QgsVectorLayer *mLayer = nullptr;
87};
88
89#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.