Skip to content

Commit

Permalink
Remove redundant composer selection tolerance setting
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Oct 31, 2013
1 parent 0a59d43 commit 247e6c7
Show file tree
Hide file tree
Showing 6 changed files with 1 addition and 74 deletions.
3 changes: 0 additions & 3 deletions python/core/composer/qgscomposition.sip
Original file line number Diff line number Diff line change
Expand Up @@ -150,9 +150,6 @@ class QgsComposition : QGraphicsScene
QgsComposerMap* worldFileMap();
void setWorldFileMap( QgsComposerMap* map );

double selectionTolerance() const;
void setSelectionTolerance( double tol );

/**Returns pointer to map renderer of qgis map canvas*/
QgsMapRenderer* mapRenderer();

Expand Down
10 changes: 0 additions & 10 deletions src/app/composer/qgscompositionwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@ QgsCompositionWidget::QgsCompositionWidget( QWidget* parent, QgsComposition* c )
mGridStyleComboBox->setCurrentIndex( 2 );
}

mSelectionToleranceSpinBox->setValue( mComposition->selectionTolerance() );
mGridToleranceSpinBox->setValue( mComposition->snapGridTolerance() );
}
blockSignals( false );
Expand Down Expand Up @@ -560,14 +559,6 @@ void QgsCompositionWidget::on_mGridToleranceSpinBox_valueChanged( double d )
}
}

void QgsCompositionWidget::on_mSelectionToleranceSpinBox_valueChanged( double d )
{
if ( mComposition )
{
mComposition->setSelectionTolerance( d );
}
}

void QgsCompositionWidget::on_mAlignmentToleranceSpinBox_valueChanged( double d )
{
if ( mComposition )
Expand All @@ -592,6 +583,5 @@ void QgsCompositionWidget::blockSignals( bool block )
mGridColorButton->blockSignals( block );
mGridStyleComboBox->blockSignals( block );
mGridToleranceSpinBox->blockSignals( block );
mSelectionToleranceSpinBox->blockSignals( block );
mAlignmentToleranceSpinBox->blockSignals( block );
}
1 change: 0 additions & 1 deletion src/app/composer/qgscompositionwidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ class QgsCompositionWidget: public QWidget, private Ui::QgsCompositionWidgetBase
void on_mGridColorButton_colorChanged( const QColor &newColor );
void on_mGridStyleComboBox_currentIndexChanged( const QString& text );
void on_mGridToleranceSpinBox_valueChanged( double d );
void on_mSelectionToleranceSpinBox_valueChanged( double d );
void on_mAlignmentToleranceSpinBox_valueChanged( double d );

/**Sets GUI elements to width/height from composition*/
Expand Down
23 changes: 1 addition & 22 deletions src/core/composer/qgscomposition.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ QgsComposition::QgsComposition( QgsMapRenderer* mapRenderer )
, mGenerateWorldFile( false )
, mWorldFileMap( 0 )
, mUseAdvancedEffects( true )
, mSelectionTolerance( 0.0 )
, mSnapToGrid( false )
, mGridVisible( false )
, mSnapGridResolution( 10.0 )
Expand Down Expand Up @@ -99,7 +98,6 @@ QgsComposition::QgsComposition()
mGenerateWorldFile( false ),
mWorldFileMap( 0 ),
mUseAdvancedEffects( true ),
mSelectionTolerance( 0.0 ),
mSnapToGrid( false ),
mGridVisible( false ),
mSnapGridResolution( 10.0 ),
Expand Down Expand Up @@ -226,15 +224,7 @@ QgsComposerItem* QgsComposition::composerItemAt( const QPointF & position, const
{
//get a list of items which intersect the specified position, in descending z order
QList<QGraphicsItem*> itemList;
if ( mSelectionTolerance <= 0.0 )
{
itemList = items( position, Qt::IntersectsItemShape, Qt::DescendingOrder );
}
else
{
itemList = items( QRectF( position.x() - mSelectionTolerance, position.y() - mSelectionTolerance, 2 * mSelectionTolerance, 2 * mSelectionTolerance ),
Qt::IntersectsItemShape, Qt::DescendingOrder );
}
itemList = items( position, Qt::IntersectsItemShape, Qt::DescendingOrder );
QList<QGraphicsItem *>::iterator itemIt = itemList.begin();

bool foundBelowItem = false;
Expand Down Expand Up @@ -1671,12 +1661,6 @@ void QgsComposition::setGridStyle( GridStyle s )
saveSettings();
}

void QgsComposition::setSelectionTolerance( double tol )
{
mSelectionTolerance = tol;
saveSettings();
}

void QgsComposition::loadSettings()
{
//read grid style, grid color and pen width from settings
Expand Down Expand Up @@ -1705,8 +1689,6 @@ void QgsComposition::loadSettings()
{
mGridStyle = Solid;
}

mSelectionTolerance = s.value( "/qgis/composerSelectionTolerance", 0.0 ).toDouble();
}

void QgsComposition::saveSettings()
Expand All @@ -1729,9 +1711,6 @@ void QgsComposition::saveSettings()
{
s.setValue( "/qgis/composerGridStyle", "Crosses" );
}

//store also selection tolerance
s.setValue( "/qgis/composerSelectionTolerance", mSelectionTolerance );
}

void QgsComposition::beginCommand( QgsComposerItem* item, const QString& commandText, QgsComposerMergeCommand::Context c )
Expand Down
6 changes: 0 additions & 6 deletions src/core/composer/qgscomposition.h
Original file line number Diff line number Diff line change
Expand Up @@ -238,9 +238,6 @@ class CORE_EXPORT QgsComposition : public QGraphicsScene
@note: added in version 1.9*/
void setUseAdvancedEffects( bool effectsEnabled );

double selectionTolerance() const { return mSelectionTolerance; }
void setSelectionTolerance( double tol );

/**Returns pointer to map renderer of qgis map canvas*/
QgsMapRenderer* mapRenderer() {return mMapRenderer;}

Expand Down Expand Up @@ -446,9 +443,6 @@ class CORE_EXPORT QgsComposition : public QGraphicsScene
/**Flag if advanced visual effects such as blend modes should be used. True by default*/
bool mUseAdvancedEffects;

/**Distance tolerance for item selection (in mm)*/
double mSelectionTolerance;

/**Parameters for snap to grid function*/
bool mSnapToGrid;
bool mGridVisible;
Expand Down
32 changes: 0 additions & 32 deletions src/ui/qgscompositionwidgetbase.ui
Original file line number Diff line number Diff line change
Expand Up @@ -276,38 +276,6 @@
</layout>
</widget>
</item>
<item>
<widget class="QgsCollapsibleGroupBoxBasic" name="generalSettingsGroupBox">
<property name="title">
<string>General settings</string>
</property>
<property name="collapsed" stdset="0">
<bool>false</bool>
</property>
<layout class="QFormLayout" name="formLayout_2">
<property name="fieldGrowthPolicy">
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
</property>
<property name="labelAlignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
<item row="0" column="0">
<widget class="QLabel" name="label_5">
<property name="text">
<string>Selection tolerance</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QDoubleSpinBox" name="mSelectionToleranceSpinBox">
<property name="suffix">
<string> mm</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QgsCollapsibleGroupBoxBasic" name="mSnapToGridGroupCheckBox">
<property name="title">
Expand Down

0 comments on commit 247e6c7

Please sign in to comment.