QGIS API Documentation
4.3.0-Master (16eddb2670e)
Toggle main menu visibility
Loading...
Searching...
No Matches
src
gui
qgslegendpatchshapebutton.h
Go to the documentation of this file.
1
/***************************************************************************
2
qgslegendpatchshapebutton.h
3
-----------------
4
Date : April 2020
5
Copyright : (C) 2020 by 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
#ifndef QGSLEGENDPATCHSHAPEBUTTON_H
16
#define QGSLEGENDPATCHSHAPEBUTTON_H
17
18
#include <memory>
19
20
#include "qgis_gui.h"
21
#include "
qgis_sip.h
"
22
#include "
qgslegendpatchshape.h
"
23
24
#include <QPointer>
25
#include <QToolButton>
26
27
class
QgsPanelWidget
;
28
class
QgsMessageBar
;
29
class
QgsSymbol
;
30
38
class
GUI_EXPORT
QgsLegendPatchShapeButton
:
public
QToolButton
39
{
40
Q_OBJECT
41
42
public
:
47
QgsLegendPatchShapeButton
( QWidget *parent
SIP_TRANSFERTHIS
=
nullptr
,
const
QString &
dialogTitle
= QString() );
48
~QgsLegendPatchShapeButton
()
override
;
49
50
QSize
minimumSizeHint
()
const override
;
51
QSize
sizeHint
()
const override
;
52
59
void
setSymbolType
(
Qgis::SymbolType
type );
60
65
Qgis::SymbolType
symbolType
()
const
{
return
mType; }
66
73
void
setPreviewSymbol(
QgsSymbol
*symbol
SIP_TRANSFER
);
74
79
void
setDialogTitle(
const
QString &title );
80
85
QString dialogTitle()
const
;
86
92
QgsLegendPatchShape
shape();
93
100
void
setMessageBar(
QgsMessageBar
*bar );
101
107
QgsMessageBar
*messageBar()
const
;
108
109
public
slots:
110
116
void
setShape(
const
QgsLegendPatchShape
&shape );
117
121
void
setToDefault();
122
123
signals:
124
130
void
changed
();
131
132
protected
:
133
void
changeEvent
( QEvent *e )
override
;
134
void
showEvent
( QShowEvent *e )
override
;
135
void
resizeEvent
( QResizeEvent *event )
override
;
136
137
// Reimplemented to detect right mouse button clicks on the button
138
void
mousePressEvent
( QMouseEvent *e )
override
;
139
140
private
slots:
141
142
void
showSettingsDialog();
143
147
void
prepareMenu();
148
149
void
loadPatchFromStyle(
const
QString &name );
150
151
private
:
152
QgsLegendPatchShape
mShape;
153
154
QSize mSizeHint;
155
156
QString mDialogTitle;
157
158
Qgis::SymbolType
mType =
Qgis::SymbolType::Fill
;
159
160
std::unique_ptr<QgsSymbol> mPreviewSymbol;
161
162
QgsMessageBar
*mMessageBar =
nullptr
;
163
164
QMenu *mMenu =
nullptr
;
165
166
QSize mIconSize;
167
168
bool
mIsDefault =
true
;
169
173
void
updatePreview();
174
};
175
176
#endif
// QGSLEGENDPATCHSHAPEBUTTON_H
Qgis::SymbolType
SymbolType
Symbol types.
Definition
qgis.h:671
Qgis::SymbolType::Fill
@ Fill
Fill symbol.
Definition
qgis.h:674
QgsLegendPatchShapeButton::setSymbolType
void setSymbolType(Qgis::SymbolType type)
Sets the symbol type which the button requires.
Definition
qgslegendpatchshapebutton.cpp:66
QgsLegendPatchShapeButton::QgsLegendPatchShapeButton
QgsLegendPatchShapeButton(QWidget *parent=nullptr, const QString &dialogTitle=QString())
Construct a new patch shape button with the specified parent widget.
Definition
qgslegendpatchshapebutton.cpp:33
QgsLegendPatchShapeButton::changeEvent
void changeEvent(QEvent *e) override
Definition
qgslegendpatchshapebutton.cpp:235
QgsLegendPatchShapeButton::mousePressEvent
void mousePressEvent(QMouseEvent *e) override
Definition
qgslegendpatchshapebutton.cpp:179
QgsLegendPatchShapeButton::resizeEvent
void resizeEvent(QResizeEvent *event) override
Definition
qgslegendpatchshapebutton.cpp:250
QgsLegendPatchShapeButton::changed
void changed()
Emitted when the shape's settings are changed.
QgsLegendPatchShapeButton::dialogTitle
QString dialogTitle() const
Returns the title for the symbol settings dialog window.
Definition
qgslegendpatchshapebutton.cpp:317
QgsLegendPatchShapeButton::sizeHint
QSize sizeHint() const override
Definition
qgslegendpatchshapebutton.cpp:61
QgsLegendPatchShapeButton::minimumSizeHint
QSize minimumSizeHint() const override
Definition
qgslegendpatchshapebutton.cpp:56
QgsLegendPatchShapeButton::~QgsLegendPatchShapeButton
~QgsLegendPatchShapeButton() override
QgsLegendPatchShapeButton::symbolType
Qgis::SymbolType symbolType() const
Returns the symbol type which the button requires.
Definition
qgslegendpatchshapebutton.h:65
QgsLegendPatchShapeButton::showEvent
void showEvent(QShowEvent *e) override
Definition
qgslegendpatchshapebutton.cpp:244
QgsLegendPatchShape
Represents a patch shape for use in map legends.
Definition
qgslegendpatchshape.h:34
QgsMessageBar
A bar for displaying non-blocking messages to the user.
Definition
qgsmessagebar.h:61
QgsPanelWidget
Base class for any widget that can be shown as an inline panel.
Definition
qgspanelwidget.h:32
QgsSymbol
Abstract base class for all rendered symbols.
Definition
qgssymbol.h:227
qgis_sip.h
SIP_TRANSFERTHIS
#define SIP_TRANSFERTHIS
Definition
qgis_sip.h:52
SIP_TRANSFER
#define SIP_TRANSFER
Definition
qgis_sip.h:35
qgslegendpatchshape.h
Generated on
for QGIS API Documentation by
1.17.0