Skip to content

Commit

Permalink
Add unit tests, standardise method names
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Dec 6, 2018
1 parent a97d335 commit 048d526
Show file tree
Hide file tree
Showing 11 changed files with 295 additions and 11 deletions.
8 changes: 4 additions & 4 deletions python/core/auto_generated/layout/qgslayoutitemmapgrid.sip.in
Expand Up @@ -752,22 +752,22 @@ framePenSize method.
.. seealso:: :py:func:`setFrameWidth`
%End

void setGridFrameMargin( const double margin );
void setFrameMargin( const double margin );
%Docstring
Sets the grid frame margin (in layout units).
This property controls distance between the map frame and the grid frame.

.. seealso:: :py:func:`gridFrameMargin`
.. seealso:: :py:func:`frameMargin`

.. versionadded:: 3.6
%End

double gridFrameMargin() const;
double frameMargin() const;
%Docstring
Sets the grid frame Margin (in layout units).
This property controls distance between the map frame and the grid frame.

.. seealso:: :py:func:`setGridFrameMargin`
.. seealso:: :py:func:`setFrameMargin`

.. versionadded:: 3.6
%End
Expand Down
6 changes: 3 additions & 3 deletions src/app/layout/qgslayoutmapgridwidget.cpp
Expand Up @@ -476,7 +476,7 @@ void QgsLayoutMapGridWidget::setGridItems()
mOffsetYSpinBox->setValue( mMapGrid->offsetY() );
mCrossWidthSpinBox->setValue( mMapGrid->crossLength() );
mFrameWidthSpinBox->setValue( mMapGrid->frameWidth() );
mGridFrameMarginSpinBox->setValue( mMapGrid->gridFrameMargin() );
mGridFrameMarginSpinBox->setValue( mMapGrid->frameMargin() );
mGridFramePenSizeSpinBox->setValue( mMapGrid->framePenSize() );
mGridFramePenColorButton->setColor( mMapGrid->framePenColor() );
mGridFrameFill1ColorButton->setColor( mMapGrid->frameFillColor1() );
Expand Down Expand Up @@ -533,7 +533,7 @@ void QgsLayoutMapGridWidget::setGridItems()

//grid frame
mFrameWidthSpinBox->setValue( mMapGrid->frameWidth() );
mGridFrameMarginSpinBox->setValue( mMapGrid->gridFrameMargin() );
mGridFrameMarginSpinBox->setValue( mMapGrid->frameMargin() );
QgsLayoutItemMapGrid::FrameStyle gridFrameStyle = mMapGrid->frameStyle();
mFrameStyleComboBox->setCurrentIndex( mFrameStyleComboBox->findData( gridFrameStyle ) );
switch ( gridFrameStyle )
Expand Down Expand Up @@ -709,7 +709,7 @@ void QgsLayoutMapGridWidget::mGridFrameMarginSpinBox_valueChanged( double val )
}

mMap->beginCommand( tr( "Change Grid Frame Margin" ) );
mMapGrid->setGridFrameMargin( val );
mMapGrid->setFrameMargin( val );
mMap->updateBoundingRect();
mMap->update();
mMap->endCommand();
Expand Down
8 changes: 4 additions & 4 deletions src/core/layout/qgslayoutitemmapgrid.h
Expand Up @@ -729,18 +729,18 @@ class CORE_EXPORT QgsLayoutItemMapGrid : public QgsLayoutItemMapItem
/**
* Sets the grid frame margin (in layout units).
* This property controls distance between the map frame and the grid frame.
* \see gridFrameMargin()
* \see frameMargin()
* \since QGIS 3.6
*/
void setGridFrameMargin( const double margin ) { mGridFrameMargin = margin; }
void setFrameMargin( const double margin ) { mGridFrameMargin = margin; }

/**
* Sets the grid frame Margin (in layout units).
* This property controls distance between the map frame and the grid frame.
* \see setGridFrameMargin()
* \see setFrameMargin()
* \since QGIS 3.6
*/
double gridFrameMargin() const { return mGridFrameMargin; }
double frameMargin() const { return mGridFrameMargin; }

/**
* Sets the \a width of the stroke drawn in the grid frame.
Expand Down

0 comments on commit 048d526

Please sign in to comment.