QGIS API Documentation 3.41.0-Master (af5edcb665c)
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 <QStandardItemModel>
21#include <QStyledItemDelegate>
22#include <QStringListModel>
23
24#include "qgis_gui.h"
26#include "qgsdataprovider.h"
27#include "qgslayermetadata.h"
28#include "ui_qgsmetadatawidget.h"
29
30class QgsMapLayer;
31class QgsMapCanvas;
32
40class GUI_EXPORT QgsMetadataWidget : public QWidget, private Ui::QgsMetadataWidgetBase
41{
42 Q_OBJECT
43 Q_PROPERTY( QString title READ title WRITE setTitle NOTIFY titleChanged )
44
45 public:
50 enum Mode
51 {
52 LayerMetadata = 0,
54 };
55
64 QgsMetadataWidget( QWidget *parent SIP_TRANSFERTHIS = nullptr, QgsMapLayer *layer = nullptr );
65
71 void setMode( Mode mode );
72
78 Mode mode() const { return mMode; }
79
91 void setMetadata( const QgsAbstractMetadataBase *metadata );
92
101
108 void saveMetadata( QgsAbstractMetadataBase *metadata );
109
114 bool checkMetadata();
115
119 void crsChanged();
120
124 void acceptMetadata();
125
129 static QMap<QString, QString> parseLanguages();
130
134 static QStringList parseLicenses();
135
140 static QStringList parseLinkTypes();
141
146 static QStringList parseMimeTypes();
147
151 static QMap<QString, QString> parseTypes();
152
156 void setMapCanvas( QgsMapCanvas *canvas );
157
166 QString title() const;
167
168 public slots:
169
178 void setTitle( const QString &title );
179
180 signals:
181
190 void titleChanged( const QString &title );
191
192 private slots:
193 void removeSelectedCategories();
194 void updatePanel();
195 void fillSourceFromLayer();
196 void fillCrsFromLayer();
197 void fillCrsFromProvider();
198 void addDefaultCategories();
199 void addNewCategory();
200 void addVocabulary();
201 void removeSelectedVocabulary();
202 void addLicence();
203 void removeSelectedLicence();
204 void addRight();
205 void removeSelectedRight();
206 void addConstraint();
207 void removeSelectedConstraint();
208 void addAddress();
209 void removeSelectedAddress();
210 void addLink();
211 void removeSelectedLink();
212 void addHistory();
213 void removeSelectedHistory();
214
215 private:
216 void fillComboBox();
217 void setUiFromMetadata();
218 void syncFromCategoriesTabToKeywordsTab();
219
220 Mode mMode = LayerMetadata;
221
222 QStringList mDefaultCategories;
223 QgsMapLayer *mLayer = nullptr;
225 std::unique_ptr<QgsAbstractMetadataBase> mMetadata;
226 QStandardItemModel *mConstraintsModel = nullptr;
227 QStandardItemModel *mLinksModel = nullptr;
228 QStringListModel *mCategoriesModel = nullptr;
229 QStringListModel *mDefaultCategoriesModel = nullptr;
230 QStringListModel *mRightsModel = nullptr;
231 QStringListModel *mHistoryModel = nullptr;
232};
233
234#ifndef SIP_RUN
235
237
244class LinkItemDelegate : public QStyledItemDelegate
245{
246 Q_OBJECT
247
248 public:
253 explicit LinkItemDelegate( QObject *parent = nullptr );
254
258 QWidget *createEditor( QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index ) const override;
259};
260
267class ConstraintItemDelegate : public QStyledItemDelegate
268{
269 Q_OBJECT
270
271 public:
276 explicit ConstraintItemDelegate( QObject *parent = nullptr );
277
281 QWidget *createEditor( QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index ) const override;
282};
283
284
286
287#endif
288#endif
An abstract base class for metadata stores.
This class 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:76
A wizard to edit metadata on a map layer.
@ ProjectMetadata
Show project metadata.
Mode mode() const
Returns the widget's current mode.
#define SIP_TRANSFERTHIS
Definition qgis_sip.h:53
#define SIP_FACTORY
Definition qgis_sip.h:76