QGIS API Documentation
4.3.0-Master (16eddb2670e)
Toggle main menu visibility
Loading...
Searching...
No Matches
src
gui
qgsgeometrywidget.h
Go to the documentation of this file.
1
/***************************************************************************
2
qgsgeometrywidget.h
3
--------------------------------------
4
Date : March 2015
5
Copyright : (C) 2015 Nyall Dawson
6
Email : nyall.dawson@gmail.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 QGSGEOMETRYWIDGET_H
17
#define QGSGEOMETRYWIDGET_H
18
19
#include "qgis_gui.h"
20
#include "
qgis_sip.h
"
21
#include "
qgsreferencedgeometry.h
"
22
23
#include <QList>
24
#include <QWidget>
25
26
class
QLineEdit;
27
class
QToolButton;
28
class
QMenu;
29
41
class
GUI_EXPORT
QgsGeometryWidget
:
public
QWidget
42
{
43
Q_OBJECT
44
45
Q_PROPERTY(
QgsReferencedGeometry
geometryValue
READ
geometryValue
WRITE
setGeometryValue
NOTIFY
geometryValueChanged
)
46
47
public
:
51
explicit
QgsGeometryWidget
( QWidget *parent
SIP_TRANSFERTHIS
=
nullptr
);
52
62
void
setGeometryValue
(
const
QgsReferencedGeometry
&geometry );
63
73
QgsReferencedGeometry
geometryValue
()
const
;
74
80
void
setAcceptedWkbTypes
(
const
QList<Qgis::WkbType> &types );
81
87
QList<Qgis::WkbType>
acceptedWkbTypes
()
const
;
88
94
bool
isReadOnly
()
const
;
95
96
public
slots:
97
103
void
setReadOnly
(
bool
readOnly );
104
108
void
clearGeometry
();
109
115
void
copyAsWkt
();
116
122
void
copyAsGeoJson
();
123
124
signals:
125
132
void
geometryValueChanged
(
const
QgsReferencedGeometry
&value );
133
134
private
slots:
135
139
void
pasteTriggered();
140
141
private
:
142
QLineEdit *mLineEdit =
nullptr
;
143
QToolButton *mButton =
nullptr
;
144
QMenu *mMenu =
nullptr
;
145
QAction *mClearAction =
nullptr
;
146
QAction *mCopyWktAction =
nullptr
;
147
QAction *mCopyGeoJsonAction =
nullptr
;
148
QAction *mPasteAction =
nullptr
;
149
QgsReferencedGeometry
mGeometry;
150
QgsReferencedGeometry
mPastedGeom;
151
QList<Qgis::WkbType> mAcceptedTypes;
152
bool
mReadOnly =
false
;
153
154
void
fetchGeomFromClipboard();
155
bool
typeIsAcceptable(
Qgis::WkbType
type )
const
;
156
157
private
slots:
158
159
void
prepareMenu();
160
void
updateLineEdit();
161
};
162
163
#endif
// QGSGEOMETRYWIDGET_H
Qgis::WkbType
WkbType
The WKB type describes the number of dimensions a geometry has.
Definition
qgis.h:314
QgsGeometryWidget::setGeometryValue
void setGeometryValue(const QgsReferencedGeometry &geometry)
Sets the current geometry value for the widget.
Definition
qgsgeometrywidget.cpp:103
QgsGeometryWidget::geometryValue
QgsReferencedGeometry geometryValue
Definition
qgsgeometrywidget.h:45
QgsGeometryWidget::setReadOnly
void setReadOnly(bool readOnly)
Sets whether the widget should be in a read-only state.
Definition
qgsgeometrywidget.cpp:138
QgsGeometryWidget::QgsGeometryWidget
QgsGeometryWidget(QWidget *parent=nullptr)
Constructor for QgsGeometryWidget, with the specified parent widget.
Definition
qgsgeometrywidget.cpp:36
QgsGeometryWidget::copyAsWkt
void copyAsWkt()
Copies the current geometry value to the clipboard, as a WKT string.
Definition
qgsgeometrywidget.cpp:151
QgsGeometryWidget::setAcceptedWkbTypes
void setAcceptedWkbTypes(const QList< Qgis::WkbType > &types)
Sets the list of WKB geometry types which are permitted for the widget.
Definition
qgsgeometrywidget.cpp:123
QgsGeometryWidget::acceptedWkbTypes
QList< Qgis::WkbType > acceptedWkbTypes() const
Returns the list of WKB geometry types which are permitted for the widget.
Definition
qgsgeometrywidget.cpp:128
QgsGeometryWidget::clearGeometry
void clearGeometry()
Clears the current geometry value stored in the widget.
Definition
qgsgeometrywidget.cpp:143
QgsGeometryWidget::geometryValueChanged
void geometryValueChanged(const QgsReferencedGeometry &value)
Emitted whenever the geometry value of the widget is changed.
QgsGeometryWidget::isReadOnly
bool isReadOnly() const
Returns whether the widget is in a read-only state.
Definition
qgsgeometrywidget.cpp:133
QgsGeometryWidget::copyAsGeoJson
void copyAsGeoJson()
Copies the current geometry value to the clipboard, as a GeoJSON string.
Definition
qgsgeometrywidget.cpp:159
QgsReferencedGeometry
A QgsGeometry with associated coordinate reference system.
Definition
qgsreferencedgeometry.h:147
qgis_sip.h
SIP_TRANSFERTHIS
#define SIP_TRANSFERTHIS
Definition
qgis_sip.h:52
qgsreferencedgeometry.h
Generated on
for QGIS API Documentation by
1.17.0