Skip to content

Commit

Permalink
Added API to use layer style overrides also in map canvas
Browse files Browse the repository at this point in the history
... so that map canvas does not always use just the active layer style
  • Loading branch information
wonder-sk committed Jul 7, 2015
1 parent 12a81d9 commit 099faec
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 0 deletions.
12 changes: 12 additions & 0 deletions python/gui/qgsmapcanvas.sip
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,14 @@ class QgsMapCanvas : QGraphicsView

QGis::UnitType mapUnits() const;

//! Getter for stored overrides of styles for layers.
//! @note added in 2.12
QMap<QString, QString> layerStyleOverrides() const;

//! Setter for stored overrides of styles for layers.
//! @note added in 2.12
void setLayerStyleOverrides( const QMap<QString, QString>& overrides );

//! Get the current coordinate transform
const QgsMapToPixel* getCoordinateTransform();

Expand Down Expand Up @@ -465,6 +473,10 @@ class QgsMapCanvas : QGraphicsView
//! @note added in 2.8
void currentLayerChanged( QgsMapLayer* layer );

//! Emitted when the configuration of overridden layer styles changes
//! @note added in 2.12
void layerStyleOverridesChanged();

protected:
//! Overridden standard event to be gestures aware
bool event( QEvent * e );
Expand Down
14 changes: 14 additions & 0 deletions src/gui/qgsmapcanvas.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1642,6 +1642,20 @@ QGis::UnitType QgsMapCanvas::mapUnits() const
return mapSettings().mapUnits();
}

QMap<QString, QString> QgsMapCanvas::layerStyleOverrides() const
{
return mSettings.layerStyleOverrides();
}

void QgsMapCanvas::setLayerStyleOverrides( const QMap<QString, QString>& overrides )
{
if ( overrides == mSettings.layerStyleOverrides() )
return;

mSettings.setLayerStyleOverrides( overrides );
emit layerStyleOverridesChanged();
}


void QgsMapCanvas::setRenderFlag( bool theFlag )
{
Expand Down
12 changes: 12 additions & 0 deletions src/gui/qgsmapcanvas.h
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,14 @@ class GUI_EXPORT QgsMapCanvas : public QGraphicsView

QGis::UnitType mapUnits() const;

//! Getter for stored overrides of styles for layers.
//! @note added in 2.12
QMap<QString, QString> layerStyleOverrides() const;

//! Setter for stored overrides of styles for layers.
//! @note added in 2.12
void setLayerStyleOverrides( const QMap<QString, QString>& overrides );

//! Get the current coordinate transform
const QgsMapToPixel* getCoordinateTransform();

Expand Down Expand Up @@ -546,6 +554,10 @@ class GUI_EXPORT QgsMapCanvas : public QGraphicsView
//! @note added in 2.8
void currentLayerChanged( QgsMapLayer* layer );

//! Emitted when the configuration of overridden layer styles changes
//! @note added in 2.12
void layerStyleOverridesChanged();

protected:
#ifdef HAVE_TOUCH
//! Overridden standard event to be gestures aware
Expand Down

0 comments on commit 099faec

Please sign in to comment.