QGIS API Documentation 3.99.0-Master (2fe06baccd8)
Loading...
Searching...
No Matches
qgsmetadatawidget.h
Go to the documentation of this file.
1/***************************************************************************
2 QgsAbstractMetadataBasewidget.h - description
3 -------------------
4 begin : 17/05/2017
5 copyright : (C) 2017 by Etienne Trimaille
6 email : etienne at kartoza.com
7 ***************************************************************************/
8
9/***************************************************************************
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
15 * *
16 ***************************************************************************/
17#ifndef QgsAbstractMetadataBaseWIDGET_H
18#define QgsAbstractMetadataBaseWIDGET_H
19
20#include "ui_qgsmetadatawidget.h"
21
22#include "qgis_gui.h"
24#include "qgsdataprovider.h"
25#include "qgslayermetadata.h"
26
27#include <QStandardItemModel>
28#include <QStringListModel>
29#include <QStyledItemDelegate>
30
31class QgsMapLayer;
32class QgsMapCanvas;
33
40
41class GUI_EXPORT QgsMetadataWidget : public QWidget, private Ui::QgsMetadataWidgetBase
42{
43 Q_OBJECT
44 Q_PROPERTY( QString title READ title WRITE setTitle NOTIFY titleChanged )
45
46 public:
56
65 QgsMetadataWidget( QWidget *parent SIP_TRANSFERTHIS = nullptr, QgsMapLayer *layer = nullptr );
66
72 void setMode( Mode mode );
73
79 Mode mode() const { return mMode; }
80
92 void setMetadata( const QgsAbstractMetadataBase *metadata );
93
102
109 void saveMetadata( QgsAbstractMetadataBase *metadata );
110
115 bool checkMetadata();
116
120 void crsChanged();
121
125 void acceptMetadata();
126
130 static QMap<QString, QString> parseLanguages();
131
135 static QStringList parseLicenses();
136
141 static QStringList parseLinkTypes();
142
147 static QStringList parseMimeTypes();
148
152 static QMap<QString, QString> parseTypes();
153
157 void setMapCanvas( QgsMapCanvas *canvas );
158
167 QString title() const;
168
169 public slots:
170
179 void setTitle( const QString &title );
180
181 signals:
182
191 void titleChanged( const QString &title );
192
193 private slots:
194 void removeSelectedCategories();
195 void updatePanel();
196 void fillSourceFromLayer();
197 void fillCrsFromLayer();
198 void fillCrsFromProvider();
199 void addDefaultCategories();
200 void addNewCategory();
201 void addVocabulary();
202 void removeSelectedVocabulary();
203 void addLicence();
204 void removeSelectedLicence();
205 void addRight();
206 void removeSelectedRight();
207 void addConstraint();
208 void removeSelectedConstraint();
209 void addAddress();
210 void removeSelectedAddress();
211 void addLink();
212 void removeSelectedLink();
213 void addHistory();
214 void removeSelectedHistory();
215
216 private:
217 void fillComboBox();
218 void setUiFromMetadata();
219 void syncFromCategoriesTabToKeywordsTab();
220
221 Mode mMode = LayerMetadata;
222
223 QStringList mDefaultCategories;
224 QgsMapLayer *mLayer = nullptr;
226 std::unique_ptr<QgsAbstractMetadataBase> mMetadata;
227 QStandardItemModel *mConstraintsModel = nullptr;
228 QStandardItemModel *mLinksModel = nullptr;
229 QStringListModel *mCategoriesModel = nullptr;
230 QStringListModel *mDefaultCategoriesModel = nullptr;
231 QStringListModel *mRightsModel = nullptr;
232 QStringListModel *mHistoryModel = nullptr;
233};
234
235#ifndef SIP_RUN
236
238
245class LinkItemDelegate : public QStyledItemDelegate
246{
247 Q_OBJECT
248
249 public:
254 explicit LinkItemDelegate( QObject *parent = nullptr );
255
259 QWidget *createEditor( QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index ) const override;
260};
261
268class ConstraintItemDelegate : public QStyledItemDelegate
269{
270 Q_OBJECT
271
272 public:
277 explicit ConstraintItemDelegate( QObject *parent = nullptr );
278
282 QWidget *createEditor( QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index ) const override;
283};
284
285
287
288#endif
289#endif
An abstract base class for metadata stores.
Represents a coordinate reference system (CRS).
Map canvas is a class for displaying all GIS data types on a canvas.
Base class for all map layer types.
Definition qgsmaplayer.h:80
A wizard to edit metadata on a map layer.
QgsMetadataWidget(QWidget *parent SIP_TRANSFERTHIS=nullptr, QgsMapLayer *layer=nullptr)
Constructor for the wizard.
@ LayerMetadata
Show layer metadata.
@ ProjectMetadata
Show project metadata.
Mode mode() const
Returns the widget's current mode.
void titleChanged(const QString &title)
Emitted when the title field is changed.
void setTitle(const QString &title)
Sets the title field for the metadata.
#define SIP_TRANSFERTHIS
Definition qgis_sip.h:53
#define SIP_FACTORY
Definition qgis_sip.h:84