Skip to content
Permalink
Browse files

Add a clear all guides button to guide manager

  • Loading branch information
nyalldawson committed Aug 7, 2017
1 parent 33aa352 commit c43a173ef8e4e5209acce2b0ecbb82b609fae9f5
@@ -51,6 +51,8 @@ QgsLayoutGuideWidget::QgsLayoutGuideWidget( QWidget *parent, QgsLayout *layout,
connect( mDeleteHozGuideButton, &QPushButton::clicked, this, &QgsLayoutGuideWidget::deleteHorizontalGuide );
connect( mDeleteVertGuideButton, &QPushButton::clicked, this, &QgsLayoutGuideWidget::deleteVerticalGuide );

connect( mClearAllButton, &QPushButton::clicked, this, &QgsLayoutGuideWidget::clearAll );

connect( layoutView, &QgsLayoutView::pageChanged, this, &QgsLayoutGuideWidget::pageChanged );
pageChanged( 0 );
}
@@ -110,6 +112,22 @@ void QgsLayoutGuideWidget::pageChanged( int page )
mPageLabel->setText( tr( "Guides for page %1" ).arg( page + 1 ) );
}

void QgsLayoutGuideWidget::clearAll()
{
// qt - y u no do this for me?
Q_FOREACH ( const QModelIndex &index, mHozGuidesTableView->selectionModel()->selectedIndexes() )
{
mHozGuidesTableView->closePersistentEditor( index );
}
Q_FOREACH ( const QModelIndex &index, mVertGuidesTableView->selectionModel()->selectedIndexes() )
{
mVertGuidesTableView->closePersistentEditor( index );
}

mVertProxyModel->removeRows( 0, mVertProxyModel->rowCount() );
mHozProxyModel->removeRows( 0, mHozProxyModel->rowCount() );
}


QgsLayoutGuidePositionDelegate::QgsLayoutGuidePositionDelegate( QgsLayout *layout, QAbstractItemModel *model )
: mLayout( layout )
@@ -42,6 +42,8 @@ class QgsLayoutGuideWidget: public QgsPanelWidget, private Ui::QgsLayoutGuideWid

void pageChanged( int page );

void clearAll();

private:

QgsLayout *mLayout = nullptr;
@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>377</width>
<height>629</height>
<width>231</width>
<height>518</height>
</rect>
</property>
<property name="windowTitle">
@@ -54,8 +54,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>349</width>
<height>675</height>
<width>231</width>
<height>518</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
@@ -103,6 +103,12 @@
</item>
<item row="0" column="0" colspan="2">
<widget class="QTableView" name="mHozGuidesTableView">
<property name="minimumSize">
<size>
<width>0</width>
<height>120</height>
</size>
</property>
<property name="selectionBehavior">
<enum>QAbstractItemView::SelectRows</enum>
</property>
@@ -160,6 +166,12 @@
</item>
<item row="0" column="0" colspan="2">
<widget class="QTableView" name="mVertGuidesTableView">
<property name="minimumSize">
<size>
<width>0</width>
<height>120</height>
</size>
</property>
<property name="selectionBehavior">
<enum>QAbstractItemView::SelectRows</enum>
</property>
@@ -180,6 +192,13 @@
</layout>
</widget>
</item>
<item>
<widget class="QPushButton" name="mClearAllButton">
<property name="text">
<string>Clear All Guides</string>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">

0 comments on commit c43a173

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