Skip to content
Permalink
Browse files

[FEATURE] Add clear guides action to composer view menu

  • Loading branch information
nyalldawson authored and mhugent committed Oct 29, 2013
1 parent 616588e commit 46009c695038f14c80e0076d8cb4a8038ab38560
@@ -52,6 +52,9 @@ class QgsComposition : QGraphicsScene

void setGridVisible( bool b );
bool gridVisible() const;

/**Removes all snap lines*/
void clearSnapLines();

void setSnapGridResolution( double r );
double snapGridResolution() const;
@@ -265,6 +265,7 @@ QgsComposer::QgsComposer( QgisApp *qgis, const QString& title )
viewMenu->addAction( mActionShowGuides );
viewMenu->addAction( mActionSnapGuides );
viewMenu->addAction( mActionSmartGuides );
viewMenu->addAction( mActionClearGuides );

// Panel and toolbar submenus
mPanelMenu = new QMenu( tr( "Panels" ), this );
@@ -727,6 +728,15 @@ void QgsComposer::on_mActionSmartGuides_triggered( bool checked )
}
}

void QgsComposer::on_mActionClearGuides_triggered()
{
//clear guide lines
if ( mComposition )
{
mComposition->clearSnapLines();
}
}

void QgsComposer::on_mActionExportAsPDF_triggered()
{
if ( !mComposition || !mView )
@@ -300,6 +300,9 @@ class QgsComposer: public QMainWindow, private Ui::QgsComposerBase
//!Enable or disable smart guides
void on_mActionSmartGuides_triggered( bool checked );

//!Clear guides
void on_mActionClearGuides_triggered();

//! Save window state
void saveWindowState();

@@ -1428,6 +1428,17 @@ void QgsComposition::removeSnapLine( QGraphicsLineItem* line )
delete line;
}

void QgsComposition::clearSnapLines()
{
QList< QGraphicsLineItem* >::iterator it = mSnapLines.begin();
for ( ; it != mSnapLines.end(); ++it )
{
removeItem(( *it ) );
delete( *it );
}
mSnapLines.clear();
}

void QgsComposition::setSnapLinesVisible( bool visible )
{
mGuidesVisible = visible;
@@ -124,6 +124,9 @@ class CORE_EXPORT QgsComposition : public QGraphicsScene
void setSmartGuidesEnabled( bool b ) { mSmartGuides = b; };
bool smartGuidesEnabled() const {return mSmartGuides;}

/**Removes all snap lines*/
void clearSnapLines();

void setSnapGridResolution( double r );
double snapGridResolution() const {return mSnapGridResolution;}

@@ -339,7 +339,15 @@
<property name="shortcut">
<string>Ctrl+Alt+;</string>
</property>
</action>
</action>
<action name="mActionClearGuides">
<property name="text">
<string>Clear Guides</string>
</property>
<property name="toolTip">
<string>Clear guides</string>
</property>
</action>
<action name="mActionAddImage">
<property name="icon">
<iconset resource="../../images/images.qrc">

0 comments on commit 46009c6

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