QGIS API Documentation 3.34.0-Prizren (ffbdd678812)
Loading...
Searching...
No Matches
qgsannotationitemwidget_impl.h
Go to the documentation of this file.
1/***************************************************************************
2 qgsannotationitemwidget_impl.h
3 ------------------------
4 Date : September 2021
5 Copyright : (C) 2021 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 QGSANNOTATIONITEMWIDGETIMPL_H
16#define QGSANNOTATIONITEMWIDGETIMPL_H
17
19#include "qgis_sip.h"
20#include "qgis_gui.h"
21#include "qgstextformat.h"
22#include <memory>
23
24#include "ui_qgsannotationpointtextwidgetbase.h"
25#include "ui_qgsannotationsymbolwidgetbase.h"
26#include "ui_qgsannotationlinetextwidgetbase.h"
27
29class QgsFillSymbol;
30class QgsLineSymbol;
31class QgsMarkerSymbol;
38
39#define SIP_NO_FILE
40
42
43class QgsAnnotationPolygonItemWidget : public QgsAnnotationItemBaseWidget, private Ui_QgsAnnotationSymbolWidgetBase
44{
45 Q_OBJECT
46
47 public:
48 QgsAnnotationPolygonItemWidget( QWidget *parent );
49 ~QgsAnnotationPolygonItemWidget() override;
50 QgsAnnotationItem *createItem() override;
51 void updateItem( QgsAnnotationItem *item ) override;
52 void setDockMode( bool dockMode ) override;
53 void setContext( const QgsSymbolWidgetContext &context ) override;
54
55 protected:
56 bool setNewItem( QgsAnnotationItem *item ) override;
57
58 private:
59
60 QgsSymbolSelectorWidget *mSelector = nullptr;
61 std::unique_ptr< QgsFillSymbol > mSymbol;
62 bool mBlockChangedSignal = false;
63 std::unique_ptr< QgsAnnotationPolygonItem> mItem;
64};
65
66class QgsAnnotationLineItemWidget : public QgsAnnotationItemBaseWidget, private Ui_QgsAnnotationSymbolWidgetBase
67{
68 Q_OBJECT
69
70 public:
71 QgsAnnotationLineItemWidget( QWidget *parent );
72 ~QgsAnnotationLineItemWidget() override;
73 QgsAnnotationItem *createItem() override;
74 void updateItem( QgsAnnotationItem *item ) override;
75 void setDockMode( bool dockMode ) override;
76 void setContext( const QgsSymbolWidgetContext &context ) override;
77
78 protected:
79 bool setNewItem( QgsAnnotationItem *item ) override;
80
81 private:
82
83 QgsSymbolSelectorWidget *mSelector = nullptr;
84 std::unique_ptr< QgsLineSymbol > mSymbol;
85 bool mBlockChangedSignal = false;
86 std::unique_ptr< QgsAnnotationLineItem> mItem;
87};
88
89class QgsAnnotationMarkerItemWidget : public QgsAnnotationItemBaseWidget, private Ui_QgsAnnotationSymbolWidgetBase
90{
91 Q_OBJECT
92
93 public:
94 QgsAnnotationMarkerItemWidget( QWidget *parent );
95 ~QgsAnnotationMarkerItemWidget() override;
96 QgsAnnotationItem *createItem() override;
97 void updateItem( QgsAnnotationItem *item ) override;
98 void setDockMode( bool dockMode ) override;
99 void setContext( const QgsSymbolWidgetContext &context ) override;
100
101 protected:
102 bool setNewItem( QgsAnnotationItem *item ) override;
103
104 private:
105
106 QgsSymbolSelectorWidget *mSelector = nullptr;
107 std::unique_ptr< QgsMarkerSymbol > mSymbol;
108 bool mBlockChangedSignal = false;
109 std::unique_ptr< QgsAnnotationMarkerItem> mItem;
110};
111
112
113class QgsAnnotationPointTextItemWidget : public QgsAnnotationItemBaseWidget, private Ui_QgsAnnotationPointTextWidgetBase
114{
115 Q_OBJECT
116
117 public:
118 QgsAnnotationPointTextItemWidget( QWidget *parent );
119 ~QgsAnnotationPointTextItemWidget() override;
120 QgsAnnotationItem *createItem() override;
121 void updateItem( QgsAnnotationItem *item ) override;
122 void setDockMode( bool dockMode ) override;
123 void setContext( const QgsSymbolWidgetContext &context ) override;
124
125 public slots:
126
127 void focusDefaultWidget() override;
128
129 protected:
130 bool setNewItem( QgsAnnotationItem *item ) override;
131
132 private:
133 void mInsertExpressionButton_clicked();
134
135 QgsTextFormatWidget *mTextFormatWidget = nullptr;
136 bool mBlockChangedSignal = false;
137 std::unique_ptr< QgsAnnotationPointTextItem> mItem;
138};
139
140
141class QgsAnnotationLineTextItemWidget : public QgsAnnotationItemBaseWidget, private Ui_QgsAnnotationLineTextWidgetBase
142{
143 Q_OBJECT
144
145 public:
146 QgsAnnotationLineTextItemWidget( QWidget *parent );
147 ~QgsAnnotationLineTextItemWidget() override;
148 QgsAnnotationItem *createItem() override;
149 void updateItem( QgsAnnotationItem *item ) override;
150 void setDockMode( bool dockMode ) override;
151 void setContext( const QgsSymbolWidgetContext &context ) override;
152
153 public slots:
154
155 void focusDefaultWidget() override;
156
157 protected:
158 bool setNewItem( QgsAnnotationItem *item ) override;
159
160 private:
161 void mInsertExpressionButton_clicked();
162
163 QgsTextFormatWidget *mTextFormatWidget = nullptr;
164 bool mBlockChangedSignal = false;
165 std::unique_ptr< QgsAnnotationLineTextItem> mItem;
166};
167
168
170
171#endif // QGSANNOTATIONITEMWIDGETIMPL_H
A base class for property widgets for annotation items.
virtual void focusDefaultWidget()
Focuses the default widget for the page.
virtual void setContext(const QgsSymbolWidgetContext &context)
Sets the context in which the widget is shown, e.g., the associated map canvas and expression context...
virtual QgsAnnotationItem * createItem()=0
Creates a new item matching the settings defined in the widget.
virtual bool setNewItem(QgsAnnotationItem *item)
Attempts to update the widget to show the properties for the specified item.
virtual void updateItem(QgsAnnotationItem *item)=0
Updates an existing item to match the settings defined in the widget.
Abstract base class for annotation items which are drawn with QgsAnnotationLayers.
An annotation item which renders a line symbol along a line geometry.
An annotation item which renders text along a line geometry.
An annotation item which renders a marker symbol at a point location.
An annotation item which renders a text string at a point location.
An annotation item which renders a fill symbol for a polygon geometry.
A fill symbol type, for rendering Polygon and MultiPolygon geometries.
A line symbol type, for rendering LineString and MultiLineString geometries.
A marker symbol type, for rendering Point and MultiPoint geometries.
virtual void setDockMode(bool dockMode)
Set the widget in dock mode which tells the widget to emit panel widgets and not open dialogs.
Symbol selector widget that can be used to select and build a symbol.
Contains settings which reflect the context in which a symbol (or renderer) widget is shown,...
A widget for customizing text formatting settings.