Skip to content
Permalink
Browse files

Expose QgsSnappingConfig to QML

Sponsored by QField
  • Loading branch information
m-kuhn committed Dec 20, 2016
1 parent a332ff9 commit 95fedd082dcaa822b8415b281de0b904a56886b0
Showing with 38 additions and 7 deletions.
  1. +3 −1 python/core/qgssnappingconfig.sip
  2. +1 −2 src/core/CMakeLists.txt
  3. +15 −1 src/core/qgssnappingconfig.cpp
  4. +19 −3 src/core/qgssnappingconfig.h
@@ -87,7 +87,7 @@ class QgsSnappingConfig
/**
* Constructor with default parameters defined in global settings
*/
explicit QgsSnappingConfig( QgsProject* project );
explicit QgsSnappingConfig( QgsProject* project = nullptr );

~QgsSnappingConfig();

@@ -221,5 +221,7 @@ class QgsSnappingConfig
* @note Added in QGIS 3.0
*/
bool removeLayers( const QList<QgsMapLayer*>& layers );
QgsProject* project() const;
void setProject(QgsProject* project);

};
@@ -505,6 +505,7 @@ SET(QGIS_CORE_MOC_HDRS
qgsproject.h
qgsrelationmanager.h
qgsrunprocess.h
qgssnappingconfig.h
qgssnappingutils.h
qgstaskmanager.h
qgstracer.h
@@ -707,7 +708,6 @@ SET(QGIS_CORE_HDRS
qgsprojectbadlayerhandler.h
qgsprojectfiletransform.h
qgsprojectproperty.h
qgssnappingconfig.h
qgsprojectversion.h
qgsprovidermetadata.h
qgsproviderregistry.h
@@ -722,7 +722,6 @@ SET(QGIS_CORE_HDRS
qgsscaleutils.h
qgssimplifymethod.h
qgssnapper.h
qgssnappingconfig.h
qgssnappingutils.h
qgsspatialindex.h
qgssqlexpressioncompiler.h
@@ -107,7 +107,8 @@ bool QgsSnappingConfig::IndividualLayerSettings::operator ==( const QgsSnappingC
QgsSnappingConfig::QgsSnappingConfig( QgsProject* project )
: mProject( project )
{
reset();
if ( project )
reset();
}

QgsSnappingConfig::~QgsSnappingConfig()
@@ -475,3 +476,16 @@ void QgsSnappingConfig::readLegacySettings()
mIndividualLayerSettings.insert( vlayer, IndividualLayerSettings( *enabledIt == QLatin1String( "enabled" ), t, tolIt->toDouble(), static_cast<QgsTolerance::UnitType>( tolUnitIt->toInt() ) ) );
}
}

QgsProject* QgsSnappingConfig::project() const
{
return mProject;
}

void QgsSnappingConfig::setProject( QgsProject* project )
{
if ( mProject != project )
mProject = project;

reset();
}
@@ -29,6 +29,10 @@ class QgsVectorLayer;
*/
class CORE_EXPORT QgsSnappingConfig
{
Q_GADGET

Q_PROPERTY( QgsProject* project READ project WRITE setProject )

public:

/**
@@ -118,7 +122,7 @@ class CORE_EXPORT QgsSnappingConfig
/**
* Constructor with default parameters defined in global settings
*/
explicit QgsSnappingConfig( QgsProject* project );
explicit QgsSnappingConfig( QgsProject* project = nullptr );

~QgsSnappingConfig();

@@ -177,8 +181,6 @@ class CORE_EXPORT QgsSnappingConfig
*/
bool operator!= ( const QgsSnappingConfig& other ) const;

public:

/**
* Reads the configuration from the specified QGIS project document.
*
@@ -217,6 +219,20 @@ class CORE_EXPORT QgsSnappingConfig
*/
bool removeLayers( const QList<QgsMapLayer*>& layers );

/**
* The project from which the snapped layers should be retrieved
*
* \note Added in QGIS 3.0
*/
QgsProject* project() const;

/**
* \copydoc project()
*
* \note Added in QGIS 3.0
*/
void setProject( QgsProject* project );

private:
void readLegacySettings();

0 comments on commit 95fedd0

Please sign in to comment.
You can’t perform that action at this time.