QGIS API Documentation 3.41.0-Master (57ec4277f5e)
Loading...
Searching...
No Matches
qgsgeometrywidget.h
Go to the documentation of this file.
1/***************************************************************************
2 qgsgeometrywidget.h
3 --------------------------------------
4 Date : March 2015
5 Copyright : (C) 2015 Nyall Dawson
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 QGSGEOMETRYWIDGET_H
17#define QGSGEOMETRYWIDGET_H
18
19#include "qgis_gui.h"
20#include "qgis_sip.h"
21
22#include <QList>
23#include <QWidget>
24
26
27class QLineEdit;
28class QToolButton;
29class QMenu;
30
42class GUI_EXPORT QgsGeometryWidget : public QWidget
43{
44 Q_OBJECT
45
46 Q_PROPERTY( QgsReferencedGeometry geometryValue READ geometryValue WRITE setGeometryValue NOTIFY geometryValueChanged )
47
48 public:
52 explicit QgsGeometryWidget( QWidget *parent SIP_TRANSFERTHIS = nullptr );
53
63 void setGeometryValue( const QgsReferencedGeometry &geometry );
64
74 QgsReferencedGeometry geometryValue() const;
75
81 void setAcceptedWkbTypes( const QList<Qgis::WkbType> &types );
82
88 QList<Qgis::WkbType> acceptedWkbTypes() const;
89
95 bool isReadOnly() const;
96
97 public slots:
98
104 void setReadOnly( bool readOnly );
105
109 void clearGeometry();
110
116 void copyAsWkt();
117
123 void copyAsGeoJson();
124
125 signals:
126
134
135 private slots:
136
140 void pasteTriggered();
141
142 private:
143 QLineEdit *mLineEdit = nullptr;
144 QToolButton *mButton = nullptr;
145 QMenu *mMenu = nullptr;
146 QAction *mClearAction = nullptr;
147 QAction *mCopyWktAction = nullptr;
148 QAction *mCopyGeoJsonAction = nullptr;
149 QAction *mPasteAction = nullptr;
150 QgsReferencedGeometry mGeometry;
151 QgsReferencedGeometry mPastedGeom;
152 QList<Qgis::WkbType> mAcceptedTypes;
153 bool mReadOnly = false;
154
155 void fetchGeomFromClipboard();
156 bool typeIsAcceptable( Qgis::WkbType type ) const;
157
158 private slots:
159
160 void prepareMenu();
161 void updateLineEdit();
162};
163
164#endif // QGSGEOMETRYWIDGET_H
WkbType
The WKB type describes the number of dimensions a geometry has.
Definition qgis.h:256
A widget for storing and interacting with a QgsGeometry object.
void geometryValueChanged(const QgsReferencedGeometry &value)
Emitted whenever the geometry value of the widget is changed.
A QgsGeometry with associated coordinate reference system.
#define SIP_TRANSFERTHIS
Definition qgis_sip.h:53