QGIS/src/core/qgsdataprovider.cpp
David Signer 625d601e86 Deprecate forceReload() and merge it together with reloadData()
`reloadData()` implementations are set to private on `reloadProviderData()`

All calls of `forceReload()` or `reloadData()` target `QgsDataProvider::reloadData()` what calls the implemented `reloadProviderData()` of the provider and `dataChanged()` signal is called allways. That this signal is called changes the behavior of the `dataReload()` calls of all providers.
2019-12-12 15:59:07 +01:00

79 lines
2.5 KiB
C++

/***************************************************************************
qgsdataprovider.cpp - DataProvider Interface
--------------------------------------
Date : May 2016
Copyright : (C) 2016 by Matthias Kuhn
email : matthias@opengis.ch
***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#include <QMutexLocker>
#include "qgsdataprovider.h"
#define SUBLAYER_SEPARATOR QStringLiteral( "!!::!!" )
QgsDataProvider::QgsDataProvider( const QString &uri, const QgsDataProvider::ProviderOptions &providerOptions )
: mDataSourceURI( uri ),
mOptions( providerOptions )
{
}
void QgsDataProvider::reloadData()
{
reloadProviderData();
emit dataChanged();
}
void QgsDataProvider::setProviderProperty( QgsDataProvider::ProviderProperty property, const QVariant &value )
{
mProviderProperties.insert( property, value );
}
void QgsDataProvider::setProviderProperty( int property, const QVariant &value )
{
mProviderProperties.insert( property, value );
}
QVariant QgsDataProvider::providerProperty( QgsDataProvider::ProviderProperty property, const QVariant &defaultValue ) const
{
return mProviderProperties.value( property, defaultValue );
}
QVariant QgsDataProvider::providerProperty( int property, const QVariant &defaultValue = QVariant() ) const
{
return mProviderProperties.value( property, defaultValue );
}
void QgsDataProvider::setListening( bool isListening )
{
Q_UNUSED( isListening )
}
bool QgsDataProvider::renderInPreview( const PreviewContext &context )
{
return context.lastRenderingTimeMs <= context.maxRenderingTimeMs;
}
QgsCoordinateTransformContext QgsDataProvider::transformContext() const
{
QMutexLocker locker( &mOptionsMutex );
return mOptions.transformContext;
}
void QgsDataProvider::setTransformContext( const QgsCoordinateTransformContext &value )
{
QMutexLocker locker( &mOptionsMutex );
mOptions.transformContext = value;
}
QString QgsDataProvider::sublayerSeparator()
{
return SUBLAYER_SEPARATOR;
}