QGIS API Documentation  3.16.0-Hannover (43b64b13f3)
qgslegendpatchshapewidget.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgslegendpatchshapewidget.h
3  ---------------------------
4  Date : April 2020
5  Copyright : (C) 2020 Nyall Dawson
6  Email : nyall dot dawson 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 QGSLEGENDPATCHSHAPEWIDGET_H
17 #define QGSLEGENDPATCHSHAPEWIDGET_H
18 
19 #include "qgis.h"
20 #include "qgis_gui.h"
21 #include "ui_qgslegendpatchshapewidgetbase.h"
22 #include "qgslegendpatchshape.h"
23 #include <QDialog>
24 
25 class QDialogButtonBox;
26 
32 class GUI_EXPORT QgsLegendPatchShapeWidget : public QgsPanelWidget, private Ui::QgsLegendPatchShapeWidgetBase
33 {
34  Q_OBJECT
35 
36  public:
37 
41  QgsLegendPatchShapeWidget( QWidget *parent SIP_TRANSFERTHIS = nullptr, const QgsLegendPatchShape &shape = QgsLegendPatchShape() );
42 
48  QgsLegendPatchShape shape() const;
49 
55  void setShape( const QgsLegendPatchShape &shape );
56 
57  signals:
58 
62  void changed();
63 
64  private slots:
65  void setShapeFromStyle( const QString &name, QgsStyle::StyleEntity type );
66  void saveShape();
67 
68  private:
69 
71 
72 };
73 
79 class GUI_EXPORT QgsLegendPatchShapeDialog : public QDialog
80 {
81  Q_OBJECT
82 
83  public:
84 
88  QgsLegendPatchShapeDialog( const QgsLegendPatchShape &shape, QWidget *parent SIP_TRANSFERTHIS = nullptr );
89 
93  QgsLegendPatchShape shape() const { return mWidget->shape(); }
94 
98  QDialogButtonBox *buttonBox() const;
99 
100  private:
101 
102  QgsLegendPatchShapeWidget *mWidget = nullptr;
103  QDialogButtonBox *mButtonBox = nullptr;
104 
105 };
106 
107 #endif // QGSLEGENDPATCHSHAPEWIDGET_H
QgsLegendPatchShapeDialog
A dialog for configuring a custom legend patch shape.
Definition: qgslegendpatchshapewidget.h:80
qgis.h
QgsLegendPatchShapeDialog::shape
QgsLegendPatchShape shape() const
Returns the legend patch shape defined by the dialog.
Definition: qgslegendpatchshapewidget.h:93
QgsLegendPatchShape
Represents a patch shape for use in map legends.
Definition: qgslegendpatchshape.h:31
QgsPanelWidget
Base class for any widget that can be shown as a inline panel.
Definition: qgspanelwidget.h:30
QgsLegendPatchShapeWidget
Widget for configuring a custom legend patch shape.
Definition: qgslegendpatchshapewidget.h:33
qgslegendpatchshape.h
QgsSymbol::Fill
@ Fill
Fill symbol.
Definition: qgssymbol.h:89
QgsLegendPatchShapeWidget::changed
void changed()
Emitted whenever the patch shape defined by the widget is changed.
QgsSymbol::SymbolType
SymbolType
Type of the symbol.
Definition: qgssymbol.h:86
SIP_TRANSFERTHIS
#define SIP_TRANSFERTHIS
Definition: qgis_sip.h:53
QgsStyle::StyleEntity
StyleEntity
Enum for Entities involved in a style.
Definition: qgsstyle.h:179