QGIS API Documentation  3.0.2-Girona (307d082)
qgsmetadatawidget.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsmetadatawidget.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 QGSMETADATAWIDGET_H
18 #define QGSMETADATAWIDGET_H
19 
20 #include "QStandardItemModel"
21 #include "QStyledItemDelegate"
22 
23 #include "qgis_gui.h"
25 #include "qgsdataprovider.h"
26 #include "qgsmaplayer.h"
27 #include "qgslayermetadata.h"
28 #include "ui_qgsmetadatawidget.h"
29 
38 class GUI_EXPORT QgsMetadataWidget : public QWidget, private Ui::QgsMetadataWidget
39 {
40  Q_OBJECT
41 
42  public:
43 
52  QgsMetadataWidget( QWidget *parent, QgsMapLayer *layer = nullptr );
53 
62  void setMetadata( const QgsLayerMetadata &metadata );
63 
68  QgsLayerMetadata metadata();
69 
76  void saveMetadata( QgsLayerMetadata &layerMetadata );
77 
82  bool checkMetadata();
83 
87  void crsChanged();
88 
92  void acceptMetadata();
93 
97  static QMap<QString, QString> parseLanguages();
98 
102  static QStringList parseLicenses();
103 
108  static QStringList parseLinkTypes();
109 
114  static QStringList parseMimeTypes();
115 
119  static QMap<QString, QString> parseTypes();
120 
124  void setMapCanvas( QgsMapCanvas *canvas );
125 
126  private slots:
127  void removeSelectedCategories();
128  void updatePanel();
129  void fillSourceFromLayer();
130  void fillCrsFromLayer();
131  void fillCrsFromProvider();
132  void addDefaultCategories();
133  void addNewCategory();
134  void addVocabulary();
135  void removeSelectedVocabulary();
136  void addLicence();
137  void removeSelectedLicence();
138  void addRight();
139  void removeSelectedRight();
140  void addConstraint();
141  void removeSelectedConstraint();
142  void addAddress();
143  void removeSelectedAddress();
144  void addLink();
145  void removeSelectedLink();
146  void addHistory();
147  void removeSelectedHistory();
148 
149  private:
150 
151  void fillComboBox();
152  void setPropertiesFromLayer();
153  void syncFromCategoriesTabToKeywordsTab();
154  QStringList mDefaultCategories;
155  QgsMapLayer *mLayer = nullptr;
157  QgsLayerMetadata mMetadata;
158  QStandardItemModel *mConstraintsModel = nullptr;
159  QStandardItemModel *mLinksModel = nullptr;
160  QStringListModel *mCategoriesModel = nullptr;
161  QStringListModel *mDefaultCategoriesModel = nullptr;
162  QStringListModel *mRightsModel = nullptr;
163  QStringListModel *mHistoryModel = nullptr;
164 };
165 
166 #ifndef SIP_RUN
167 
168 
177 class LinkItemDelegate : public QStyledItemDelegate
178 {
179 
180  Q_OBJECT
181 
182  public:
183 
188  explicit LinkItemDelegate( QObject *parent = nullptr );
189 
193  QWidget *createEditor( QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index ) const override;
194 };
195 
203 class ConstraintItemDelegate : public QStyledItemDelegate
204 {
205 
206  Q_OBJECT
207 
208  public:
209 
214  explicit ConstraintItemDelegate( QObject *parent = nullptr );
215 
219  QWidget *createEditor( QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index ) const override;
220 };
221 
226 #endif
227 #endif
Base class for all map layer types.
Definition: qgsmaplayer.h:56
\@cond PRIVATE
A wizard to edit metadata on a map layer.
Map canvas is a class for displaying all GIS data types on a canvas.
Definition: qgsmapcanvas.h:74
A structured metadata store for a map layer.
This class represents a coordinate reference system (CRS).
Special delegate for the constraint view in the metadata wizard.