QGIS API Documentation 3.99.0-Master (21b3aa880ba)
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:
47
57
66 QgsMetadataWidget( QWidget *parent SIP_TRANSFERTHIS = nullptr, QgsMapLayer *layer = nullptr );
67
73 void setMode( Mode mode );
74
80 Mode mode() const { return mMode; }
81
93 void setMetadata( const QgsAbstractMetadataBase *metadata );
94
103
110 void saveMetadata( QgsAbstractMetadataBase *metadata );
111
116 bool checkMetadata();
117
121 void crsChanged();
122
126 void acceptMetadata();
127
131 static QMap<QString, QString> parseLanguages();
132
136 static QStringList parseLicenses();
137
142 static QStringList parseLinkTypes();
143
148 static QStringList parseMimeTypes();
149
153 static QMap<QString, QString> parseTypes();
154
158 void setMapCanvas( QgsMapCanvas *canvas );
159
168 QString title() const;
169
170 public slots:
171
180 void setTitle( const QString &title );
181
182 signals:
183
192 void titleChanged( const QString &title );
193
194 private slots:
195 void removeSelectedCategories();
196 void updatePanel();
197 void fillSourceFromLayer();
198 void fillCrsFromLayer();
199 void fillCrsFromProvider();
200 void addDefaultCategories();
201 void addNewCategory();
202 void addVocabulary();
203 void removeSelectedVocabulary();
204 void addLicence();
205 void removeSelectedLicence();
206 void addRight();
207 void removeSelectedRight();
208 void addConstraint();
209 void removeSelectedConstraint();
210 void addAddress();
211 void removeSelectedAddress();
212 void addLink();
213 void removeSelectedLink();
214 void addHistory();
215 void removeSelectedHistory();
216
217 private:
218 void fillComboBox();
219 void setUiFromMetadata();
220 void syncFromCategoriesTabToKeywordsTab();
221
222 Mode mMode = LayerMetadata;
223
224 QStringList mDefaultCategories;
225 QgsMapLayer *mLayer = nullptr;
227 std::unique_ptr<QgsAbstractMetadataBase> mMetadata;
228 QStandardItemModel *mConstraintsModel = nullptr;
229 QStandardItemModel *mLinksModel = nullptr;
230 QStringListModel *mCategoriesModel = nullptr;
231 QStringListModel *mDefaultCategoriesModel = nullptr;
232 QStringListModel *mRightsModel = nullptr;
233 QStringListModel *mHistoryModel = nullptr;
234};
235
236#ifndef SIP_RUN
237
239
246class LinkItemDelegate : public QStyledItemDelegate
247{
248 Q_OBJECT
249
250 public:
251
256 explicit LinkItemDelegate( QObject *parent = nullptr );
257
261 QWidget *createEditor( QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index ) const override;
262};
263
270class ConstraintItemDelegate : public QStyledItemDelegate
271{
272 Q_OBJECT
273
274 public:
275
280 explicit ConstraintItemDelegate( QObject *parent = nullptr );
281
285 QWidget *createEditor( QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index ) const override;
286};
287
288
290
291#endif
292#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