QGIS API Documentation  3.22.4-Białowieża (ce8e65e95e)
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
SymbolType
Symbol types.
Definition: qgis.h:169
@ Fill
Fill symbol.
A dialog for configuring a custom legend patch shape.
QgsLegendPatchShape shape() const
Returns the legend patch shape defined by the dialog.
Widget for configuring a custom legend patch shape.
void changed()
Emitted whenever the patch shape defined by the widget is changed.
Represents a patch shape for use in map legends.
Base class for any widget that can be shown as a inline panel.
StyleEntity
Enum for Entities involved in a style.
Definition: qgsstyle.h:179
#define SIP_TRANSFERTHIS
Definition: qgis_sip.h:53