QGIS API Documentation 3.37.0-Master (fdefdf9c27f)
qgsvectortilelayerproperties.cpp
Go to the documentation of this file.
1/***************************************************************************
2 qgsvectortilelayerproperties.cpp
3 --------------------------------------
4 Date : May 2020
5 Copyright : (C) 2020 by Martin Dobias
6 Email : wonder dot sk at gmail dot 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
17#include "qgshelp.h"
23#include "qgsvectortilelayer.h"
24#include "qgsvectortileutils.h"
25#include "qgsgui.h"
26#include "qgsapplication.h"
27#include "qgsjsonutils.h"
28#include "qgsmetadatawidget.h"
33
34#include <QFileDialog>
35#include <QMenu>
36#include <QMessageBox>
37#include <QDesktopServices>
38#include <QTextStream>
39
40QgsVectorTileLayerProperties::QgsVectorTileLayerProperties( QgsVectorTileLayer *lyr, QgsMapCanvas *canvas, QgsMessageBar *messageBar, QWidget *parent, Qt::WindowFlags flags )
41 : QgsLayerPropertiesDialog( lyr, canvas, QStringLiteral( "VectorTileLayerProperties" ), parent, flags )
42 , mLayer( lyr )
43{
44 setupUi( this );
45
46 mRendererWidget = new QgsVectorTileBasicRendererWidget( nullptr, canvas, messageBar, this );
47 mOptsPage_Style->layout()->addWidget( mRendererWidget );
48 mOptsPage_Style->layout()->setContentsMargins( 0, 0, 0, 0 );
49
50 mLabelingWidget = new QgsVectorTileBasicLabelingWidget( nullptr, canvas, messageBar, this );
51 mOptsPage_Labeling->layout()->addWidget( mLabelingWidget );
52 mOptsPage_Labeling->layout()->setContentsMargins( 0, 0, 0, 0 );
53
54 connect( this, &QDialog::accepted, this, &QgsVectorTileLayerProperties::apply );
55 connect( this, &QDialog::rejected, this, &QgsVectorTileLayerProperties::rollback );
56 connect( buttonBox->button( QDialogButtonBox::Apply ), &QAbstractButton::clicked, this, &QgsVectorTileLayerProperties::apply );
57 connect( buttonBox, &QDialogButtonBox::helpRequested, this, &QgsVectorTileLayerProperties::showHelp );
58
59 connect( mCrsSelector, &QgsProjectionSelectionWidget::crsChanged, this, &QgsVectorTileLayerProperties::crsChanged );
60
61 // scale based layer visibility related widgets
62 mScaleRangeWidget->setMapCanvas( mCanvas );
63
64 // QgsOptionsDialogBase handles saving/restoring of geometry, splitter and current tab states,
65 // switching vertical tabs between icon/text to icon-only modes (splitter collapsed to left),
66 // and connecting QDialogButtonBox's accepted/rejected signals to dialog's accept/reject slots
67 initOptionsBase( false );
68
69 mSourceGroupBox->hide();
70
71#ifdef WITH_QTWEBKIT
72 // Setup information tab
73
74 const int horizontalDpi = logicalDpiX();
75
76 // Adjust zoom: text is ok, but HTML seems rather big at least on Linux/KDE
77 if ( horizontalDpi > 96 )
78 {
79 mMetadataViewer->setZoomFactor( mMetadataViewer->zoomFactor() * 0.9 );
80 }
81 mMetadataViewer->page()->setLinkDelegationPolicy( QWebPage::LinkDelegationPolicy::DelegateAllLinks );
82 connect( mMetadataViewer->page(), &QWebPage::linkClicked, this, &QgsVectorTileLayerProperties::openUrl );
83 mMetadataViewer->page()->settings()->setAttribute( QWebSettings::DeveloperExtrasEnabled, true );
84 mMetadataViewer->page()->settings()->setAttribute( QWebSettings::JavascriptEnabled, true );
85
86#endif
87 mOptsPage_Information->setContentsMargins( 0, 0, 0, 0 );
88
89 QVBoxLayout *layout = new QVBoxLayout( metadataFrame );
90 layout->setContentsMargins( 0, 0, 0, 0 );
91 metadataFrame->setContentsMargins( 0, 0, 0, 0 );
92 mMetadataWidget = new QgsMetadataWidget( this, mLayer );
93 mMetadataWidget->layout()->setContentsMargins( 0, 0, 0, 0 );
94 mMetadataWidget->setMapCanvas( mCanvas );
95 layout->addWidget( mMetadataWidget );
96 metadataFrame->setLayout( layout );
97 mOptsPage_Metadata->setContentsMargins( 0, 0, 0, 0 );
98
99 setMetadataWidget( mMetadataWidget, mOptsPage_Metadata );
100
101 // update based on lyr's current state
102 syncToLayer();
103
104 QgsSettings settings;
105 // if dialog hasn't been opened/closed yet, default to Styles tab, which is used most often
106 // this will be read by restoreOptionsBaseUi()
107 if ( !settings.contains( QStringLiteral( "/Windows/VectorTileLayerProperties/tab" ) ) )
108 {
109 settings.setValue( QStringLiteral( "Windows/VectorTileLayerProperties/tab" ),
110 mOptStackedWidget->indexOf( mOptsPage_Style ) );
111 }
112
113 mBtnStyle = new QPushButton( tr( "Style" ) );
114 QMenu *menuStyle = new QMenu( this );
115 menuStyle->addAction( tr( "Load Style…" ), this, &QgsVectorTileLayerProperties::loadStyle );
116 menuStyle->addAction( tr( "Save Style…" ), this, &QgsVectorTileLayerProperties::saveStyleToFile );
117 menuStyle->addSeparator();
118 menuStyle->addAction( tr( "Save as Default" ), this, &QgsVectorTileLayerProperties::saveStyleAsDefault );
119 menuStyle->addAction( tr( "Restore Default" ), this, &QgsVectorTileLayerProperties::loadDefaultStyle );
120 mBtnStyle->setMenu( menuStyle );
121 connect( menuStyle, &QMenu::aboutToShow, this, &QgsVectorTileLayerProperties::aboutToShowStyleMenu );
122
123 buttonBox->addButton( mBtnStyle, QDialogButtonBox::ResetRole );
124
125 mBtnMetadata = new QPushButton( tr( "Metadata" ), this );
126 QMenu *menuMetadata = new QMenu( this );
127 mActionLoadMetadata = menuMetadata->addAction( tr( "Load Metadata…" ), this, &QgsVectorTileLayerProperties::loadMetadataFromFile );
128 mActionSaveMetadataAs = menuMetadata->addAction( tr( "Save Metadata…" ), this, &QgsVectorTileLayerProperties::saveMetadataToFile );
129 mBtnMetadata->setMenu( menuMetadata );
130 buttonBox->addButton( mBtnMetadata, QDialogButtonBox::ResetRole );
131
132 initialize();
133}
134
135void QgsVectorTileLayerProperties::apply()
136{
137 if ( mSourceWidget )
138 {
139 const QString newSource = mSourceWidget->sourceUri();
140 if ( newSource != mLayer->source() )
141 {
142 mLayer->setDataSource( newSource, mLayer->name(), mLayer->providerType(), QgsDataProvider::ProviderOptions() );
143 }
144 }
145
146 mLayer->setName( mLayerOrigNameLineEd->text() );
147 mLayer->setCrs( mCrsSelector->crs() );
148
149 mRendererWidget->apply();
150 mLabelingWidget->apply();
151 mMetadataWidget->acceptMetadata();
152
153 mLayer->setScaleBasedVisibility( chkUseScaleDependentRendering->isChecked() );
154 mLayer->setMinimumScale( mScaleRangeWidget->minimumScale() );
155 mLayer->setMaximumScale( mScaleRangeWidget->maximumScale() );
156
157 //layer title and abstract
158 mLayer->setShortName( mLayerShortNameLineEdit->text() );
159 mLayer->setTitle( mLayerTitleLineEdit->text() );
160 mLayer->setAbstract( mLayerAbstractTextEdit->toPlainText() );
161 mLayer->setKeywordList( mLayerKeywordListLineEdit->text() );
162 mLayer->setDataUrl( mLayerDataUrlLineEdit->text() );
163 mLayer->setDataUrlFormat( mLayerDataUrlFormatComboBox->currentText() );
164
165 //layer attribution
166 mLayer->setAttribution( mLayerAttributionLineEdit->text() );
167 mLayer->setAttributionUrl( mLayerAttributionUrlLineEdit->text() );
168
169 // LegendURL
170 mLayer->setLegendUrl( mLayerLegendUrlLineEdit->text() );
171 mLayer->setLegendUrlFormat( mLayerLegendUrlFormatComboBox->currentText() );
172}
173
174void QgsVectorTileLayerProperties::syncToLayer()
175{
176 /*
177 * Information Tab
178 */
179 const QString myStyle = QgsApplication::reportStyleSheet( QgsApplication::StyleSheetType::WebBrowser );
180 // Inject the stylesheet
181 const QString html { mLayer->htmlMetadata().replace( QLatin1String( "<head>" ), QStringLiteral( R"raw(<head><style type="text/css">%1</style>)raw" ) ).arg( myStyle ) };
182 mMetadataViewer->setHtml( html );
183
184 /*
185 * Source
186 */
187
188 mLayerOrigNameLineEd->setText( mLayer->name() );
189 mCrsSelector->setCrs( mLayer->crs() );
190
191 if ( !mSourceWidget )
192 {
193 mSourceWidget = QgsGui::sourceWidgetProviderRegistry()->createWidget( mLayer );
194 if ( mSourceWidget )
195 {
196 QHBoxLayout *layout = new QHBoxLayout();
197 layout->addWidget( mSourceWidget );
198 mSourceGroupBox->setLayout( layout );
199 if ( !mSourceWidget->groupTitle().isEmpty() )
200 mSourceGroupBox->setTitle( mSourceWidget->groupTitle() );
201 mSourceGroupBox->show();
202
203 connect( mSourceWidget, &QgsProviderSourceWidget::validChanged, this, [ = ]( bool isValid )
204 {
205 buttonBox->button( QDialogButtonBox::Apply )->setEnabled( isValid );
206 buttonBox->button( QDialogButtonBox::Ok )->setEnabled( isValid );
207 } );
208 }
209 }
210
211 if ( mSourceWidget )
212 {
213 mSourceWidget->setMapCanvas( mCanvas );
214 mSourceWidget->setSourceUri( mLayer->source() );
215 }
216
217 /*
218 * Symbology Tab
219 */
220 mRendererWidget->syncToLayer( mLayer );
221
222 /*
223 * Labels Tab
224 */
225 mLabelingWidget->setLayer( mLayer );
226
227 /*
228 * Rendering
229 */
230 chkUseScaleDependentRendering->setChecked( mLayer->hasScaleBasedVisibility() );
231 mScaleRangeWidget->setScaleRange( mLayer->minimumScale(), mLayer->maximumScale() );
232
233 /*
234 * Server
235 */
236 //layer title and abstract
237 mLayer->setShortName( mLayerShortNameLineEdit->text() );
238 mLayerTitleLineEdit->setText( mLayer->title() );
239 mLayerAbstractTextEdit->setPlainText( mLayer->abstract() );
240 mLayerKeywordListLineEdit->setText( mLayer->keywordList() );
241 mLayerDataUrlLineEdit->setText( mLayer->dataUrl() );
242 mLayerDataUrlFormatComboBox->setCurrentIndex(
243 mLayerDataUrlFormatComboBox->findText(
244 mLayer->dataUrlFormat()
245 )
246 );
247 //layer attribution
248 mLayerAttributionLineEdit->setText( mLayer->attribution() );
249 mLayerAttributionUrlLineEdit->setText( mLayer->attributionUrl() );
250
251 // layer legend url
252 mLayerLegendUrlLineEdit->setText( mLayer->legendUrl() );
253 mLayerLegendUrlFormatComboBox->setCurrentIndex(
254 mLayerLegendUrlFormatComboBox->findText(
255 mLayer->legendUrlFormat()
256 )
257 );
258}
259
261{
263}
264
266{
267 const QgsSettings settings; // where we keep last used filter in persistent state
268
269 QgsMapLayerLoadStyleDialog dlg( mLayer );
270
271 if ( dlg.exec() )
272 {
273 mOldStyle = mLayer->styleManager()->style( mLayer->styleManager()->currentStyle() );
274 const QgsMapLayer::StyleCategories categories = dlg.styleCategories();
275 const QString type = dlg.fileExtension();
276 if ( type.compare( QLatin1String( "qml" ), Qt::CaseInsensitive ) == 0 )
277 {
278 QString message;
279 bool defaultLoadedFlag = false;
280 const QString filePath = dlg.filePath();
281 message = mLayer->loadNamedStyle( filePath, defaultLoadedFlag, categories );
282
283 //reset if the default style was loaded OK only
284 if ( defaultLoadedFlag )
285 {
286 syncToLayer();
287 }
288 else
289 {
290 //let the user know what went wrong
291 QMessageBox::warning( this, tr( "Load Style" ), message );
292 }
293 }
294 else if ( type.compare( QLatin1String( "json" ), Qt::CaseInsensitive ) == 0 )
295 {
296 QFile file( dlg.filePath() );
297 if ( !file.open( QIODevice::ReadOnly | QIODevice::Text ) )
298 {
299 QMessageBox::warning( this, tr( "Load Style" ), tr( "Could not read %1" ).arg( QDir::toNativeSeparators( dlg.filePath() ) ) );
300 }
301 else
302 {
303 QTextStream in( &file );
304#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
305 in.setCodec( "UTF-8" );
306#endif
307 const QString content = in.readAll();
308
310 // convert automatically from pixel sizes to millimeters, because pixel sizes
311 // are a VERY edge case in QGIS and don't play nice with hidpi map renders or print layouts
313 //assume source uses 96 dpi
314 context.setPixelSizeConversionFactor( 25.4 / 96.0 );
315
316 //load sprites
317 QVariantMap styleDefinition = QgsJsonUtils::parseJson( content ).toMap();
318
319 QFileInfo fi( dlg.filePath() );
320 QgsVectorTileUtils::loadSprites( styleDefinition, context, QStringLiteral( "file://" ) + fi.absolutePath() );
321
323
324 if ( converter.convert( content, &context ) != QgsMapBoxGlStyleConverter::Success )
325 {
326 QMessageBox::warning( this, tr( "Load Style" ), converter.errorMessage() );
327 }
328 else
329 {
330 if ( dlg.styleCategories().testFlag( QgsMapLayer::StyleCategory::Symbology ) )
331 {
332 mLayer->setRenderer( converter.renderer() );
333 }
334 if ( dlg.styleCategories().testFlag( QgsMapLayer::StyleCategory::Labeling ) )
335 {
336 mLayer->setLabeling( converter.labeling() );
337 }
338 syncToLayer();
339 }
340 }
341 }
342 activateWindow(); // set focus back to properties dialog
343 }
344}
345
347{
349}
350
351void QgsVectorTileLayerProperties::aboutToShowStyleMenu()
352{
353 QMenu *m = qobject_cast<QMenu *>( sender() );
354
356 // re-add style manager actions!
357 m->addSeparator();
359}
360
361void QgsVectorTileLayerProperties::showHelp()
362{
363 const QVariant helpPage = mOptionsStackedWidget->currentWidget()->property( "helpPage" );
364
365 if ( helpPage.isValid() )
366 {
367 QgsHelp::openHelp( helpPage.toString() );
368 }
369 else
370 {
371 QgsHelp::openHelp( QStringLiteral( "working_with_vector_tiles/vector_tiles_properties.html" ) );
372 }
373}
374
375void QgsVectorTileLayerProperties::crsChanged( const QgsCoordinateReferenceSystem &crs )
376{
377 QgsDatumTransformDialog::run( crs, QgsProject::instance()->crs(), this, mCanvas, tr( "Select Transformation" ) );
378 mLayer->setCrs( crs );
379 mMetadataWidget->crsChanged();
380}
381
@ Millimeters
Millimeters.
static QString reportStyleSheet(QgsApplication::StyleSheetType styleSheetType=QgsApplication::StyleSheetType::Qt)
Returns a css style sheet for reports, the styleSheetType argument determines what type of stylesheet...
This class represents a coordinate reference system (CRS).
static bool run(const QgsCoordinateReferenceSystem &sourceCrs=QgsCoordinateReferenceSystem(), const QgsCoordinateReferenceSystem &destinationCrs=QgsCoordinateReferenceSystem(), QWidget *parent=nullptr, QgsMapCanvas *mapCanvas=nullptr, const QString &windowTitle=QString())
Runs the dialog (if required) prompting for the desired transform to use from sourceCrs to destinatio...
static QgsProviderSourceWidgetProviderRegistry * sourceWidgetProviderRegistry()
Returns the registry of provider source widget providers.
Definition: qgsgui.cpp:114
static void openHelp(const QString &key)
Opens help topic for the given help key using default system web browser.
Definition: qgshelp.cpp:39
static QVariant parseJson(const std::string &jsonString)
Converts JSON jsonString to a QVariant, in case of parsing error an invalid QVariant is returned and ...
Base class for "layer properties" dialogs, containing common utilities for handling functionality in ...
void saveMetadataToFile()
Allows the user to save the layer's metadata as a file.
virtual void rollback()
Rolls back changes made to the layer.
void saveStyleAsDefault()
Saves the current layer style as the default for the layer.
void setMetadataWidget(QgsMetadataWidget *widget, QWidget *page)
Sets the metadata widget and page associated with the dialog.
void loadDefaultStyle()
Reloads the default style for the layer.
void saveStyleToFile()
Allows the user to save the layer's style to a file.
QgsMapCanvas * mCanvas
Associated map canvas.
QgsMapLayerStyle mOldStyle
Previous layer style.
void loadMetadataFromFile()
Allows the user to load layer metadata from a file.
void initialize()
Initialize the dialog.
void openUrl(const QUrl &url)
Handles opening a url from the dialog.
Context for a MapBox GL style conversion operation.
void setTargetUnit(Qgis::RenderUnit targetUnit)
Sets the target unit type.
void setPixelSizeConversionFactor(double sizeConversionFactor)
Sets the pixel size conversion factor, used to scale the original pixel sizes when converting styles.
Handles conversion of MapBox GL styles to QGIS vector tile renderers and labeling settings.
QgsVectorTileRenderer * renderer() const
Returns a new instance of a vector tile renderer representing the converted style,...
QgsVectorTileLabeling * labeling() const
Returns a new instance of a vector tile labeling representing the converted style,...
Result convert(const QVariantMap &style, QgsMapBoxGlStyleConversionContext *context=nullptr)
Converts a JSON style map, and returns the resultant status of the conversion.
@ Success
Conversion was successful.
QString errorMessage() const
Returns a descriptive error message if an error was encountered during the style conversion,...
Map canvas is a class for displaying all GIS data types on a canvas.
Definition: qgsmapcanvas.h:93
A reusable dialog which allows users to select stored layer styles and categories to load for a map l...
QgsMapLayer::StyleCategories styleCategories() const
Returns the list of selected style categories the user has opted to load.
QString filePath() const
Returns the full path to the selected layer style source file.
QString fileExtension() const
Returns the file extension for the selected layer style source file.
void removesExtraMenuSeparators(QMenu *m)
removes extra separators from the menu
void addStyleManagerActions(QMenu *m, QgsMapLayer *layer)
adds actions to the menu in accordance to the layer
static QgsMapLayerStyleGuiUtils * instance()
returns a singleton instance of this class
QString currentStyle() const
Returns name of the current style.
QgsMapLayerStyle style(const QString &name) const
Returns data of a stored style - accessed by its unique name.
void setShortName(const QString &shortName)
Sets the short name of the layer used by QGIS Server to identify the layer.
Definition: qgsmaplayer.h:290
QString name
Definition: qgsmaplayer.h:78
QString legendUrlFormat() const
Returns the format for a URL based layer legend.
Definition: qgsmaplayer.h:1412
void setAbstract(const QString &abstract)
Sets the abstract of the layer used by QGIS Server in GetCapabilities request.
Definition: qgsmaplayer.h:319
QString source() const
Returns the source for the layer.
void setLegendUrl(const QString &legendUrl)
Sets the URL for the layer's legend.
Definition: qgsmaplayer.h:1397
QString providerType() const
Returns the provider type (provider key) for this layer.
void setMinimumScale(double scale)
Sets the minimum map scale (i.e.
QgsCoordinateReferenceSystem crs
Definition: qgsmaplayer.h:81
QString attribution() const
Returns the attribution of the layer used by QGIS Server in GetCapabilities request.
Definition: qgsmaplayer.h:397
void setAttributionUrl(const QString &attribUrl)
Sets the attribution URL of the layer used by QGIS Server in GetCapabilities request.
Definition: qgsmaplayer.h:405
void setMaximumScale(double scale)
Sets the maximum map scale (i.e.
QString abstract() const
Returns the abstract of the layer used by QGIS Server in GetCapabilities request.
Definition: qgsmaplayer.h:327
QString dataUrlFormat() const
Returns the DataUrl format of the layer used by QGIS Server in GetCapabilities request.
Definition: qgsmaplayer.h:378
void setDataUrl(const QString &dataUrl)
Sets the DataUrl of the layer used by QGIS Server in GetCapabilities request.
Definition: qgsmaplayer.h:352
void setKeywordList(const QString &keywords)
Sets the keyword list of the layer used by QGIS Server in GetCapabilities request.
Definition: qgsmaplayer.h:334
void setAttribution(const QString &attrib)
Sets the attribution of the layer used by QGIS Server in GetCapabilities request.
Definition: qgsmaplayer.h:388
void setDataUrlFormat(const QString &dataUrlFormat)
Sets the DataUrl format of the layer used by QGIS Server in GetCapabilities request.
Definition: qgsmaplayer.h:369
QFlags< StyleCategory > StyleCategories
Definition: qgsmaplayer.h:188
QString title() const
Returns the title of the layer used by QGIS Server in GetCapabilities request.
Definition: qgsmaplayer.h:312
void setScaleBasedVisibility(bool enabled)
Sets whether scale based visibility is enabled for the layer.
QString dataUrl() const
Returns the DataUrl of the layer used by QGIS Server in GetCapabilities request.
Definition: qgsmaplayer.h:361
bool hasScaleBasedVisibility() const
Returns whether scale based visibility is enabled for the layer.
virtual QString loadNamedStyle(const QString &theURI, bool &resultFlag, bool loadFromLocalDb, QgsMapLayer::StyleCategories categories=QgsMapLayer::AllStyleCategories)
Loads a named style from file/local db/datasource db.
void setName(const QString &name)
Set the display name of the layer.
QString attributionUrl() const
Returns the attribution URL of the layer used by QGIS Server in GetCapabilities request.
Definition: qgsmaplayer.h:414
void setDataSource(const QString &dataSource, const QString &baseName, const QString &provider, bool loadDefaultStyleFlag=false)
Updates the data source of the layer.
double minimumScale() const
Returns the minimum map scale (i.e.
QgsMapLayerStyleManager * styleManager() const
Gets access to the layer's style manager.
QString legendUrl() const
Returns the URL for the layer's legend.
Definition: qgsmaplayer.h:1402
void setLegendUrlFormat(const QString &legendUrlFormat)
Sets the format for a URL based layer legend.
Definition: qgsmaplayer.h:1407
double maximumScale() const
Returns the maximum map scale (i.e.
QString keywordList() const
Returns the keyword list of the layer used by QGIS Server in GetCapabilities request.
Definition: qgsmaplayer.h:342
void setTitle(const QString &title)
Sets the title of the layer used by QGIS Server in GetCapabilities request.
Definition: qgsmaplayer.h:304
void setCrs(const QgsCoordinateReferenceSystem &srs, bool emitSignal=true)
Sets layer's spatial reference system.
A bar for displaying non-blocking messages to the user.
Definition: qgsmessagebar.h:61
A wizard to edit metadata on a map layer.
void acceptMetadata()
Saves the metadata to the layer.
void crsChanged()
If the CRS is updated.
void setMapCanvas(QgsMapCanvas *canvas)
Sets a map canvas associated with the widget.
QStackedWidget * mOptStackedWidget
void initOptionsBase(bool restoreUi=true, const QString &title=QString())
Set up the base ui connections for vertical tabs.
static QgsProject * instance()
Returns the QgsProject singleton instance.
Definition: qgsproject.cpp:481
void crsChanged(const QgsCoordinateReferenceSystem &)
Emitted when the selected CRS is changed.
QgsProviderSourceWidget * createWidget(QgsMapLayer *layer, QWidget *parent=nullptr)
Creates a new widget to configure the source of the specified layer.
virtual QString groupTitle() const
Returns an optional group title for the source settings, for use in layer properties dialogs.
void validChanged(bool isValid)
Emitted whenever the validation status of the widget changes.
virtual QString sourceUri() const =0
Returns the source URI as currently defined by the widget.
virtual void setMapCanvas(QgsMapCanvas *mapCanvas)
Sets a map canvas associated with the widget.
virtual void setSourceUri(const QString &uri)=0
Sets the source uri to show in the widget.
This class is a composition of two QSettings instances:
Definition: qgssettings.h:64
bool contains(const QString &key, QgsSettings::Section section=QgsSettings::NoSection) const
Returns true if there exists a setting called key; returns false otherwise.
void setValue(const QString &key, const QVariant &value, QgsSettings::Section section=QgsSettings::NoSection)
Sets the value of setting key to value.
Q_DECL_DEPRECATED void saveDefaultStyle() SIP_DEPRECATED
Saves the default style when appropriate button is pressed.
Q_DECL_DEPRECATED void saveStyleAs() SIP_DEPRECATED
Saves a style when appriate button is pressed.
void loadStyle()
Loads a saved style when appropriate button is pressed.
QgsVectorTileLayerProperties(QgsVectorTileLayer *lyr, QgsMapCanvas *canvas, QgsMessageBar *messageBar, QWidget *parent=nullptr, Qt::WindowFlags=QgsGuiUtils::ModalDialogFlags)
Constructor.
Implements a map layer that is dedicated to rendering of vector tiles.
void setRenderer(QgsVectorTileRenderer *r)
Sets renderer for the map layer.
void setLabeling(QgsVectorTileLabeling *labeling)
Sets labeling for the map layer.
QString htmlMetadata() const override
Obtain a formatted HTML string containing assorted metadata for this layer.
static void loadSprites(const QVariantMap &styleDefinition, QgsMapBoxGlStyleConversionContext &context, const QString &styleUrl=QString())
Downloads the sprite image and sets it to the conversion context.
const QgsCoordinateReferenceSystem & crs
Setting options for creating vector data providers.