Skip to content

Commit

Permalink
Make report/atlas settings actions checkable, so they can also hide t…
Browse files Browse the repository at this point in the history
…he panels
  • Loading branch information
nyalldawson committed Jan 5, 2018
1 parent a4f854e commit 4e6a072
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 7 deletions.
10 changes: 6 additions & 4 deletions src/app/layout/qgslayoutdesignerdialog.cpp
Expand Up @@ -659,9 +659,11 @@ QgsLayoutDesignerDialog::QgsLayoutDesignerDialog( QWidget *parent, Qt::WindowFla

mAtlasDock = new QgsDockWidget( tr( "Atlas" ), this );
mAtlasDock->setObjectName( QStringLiteral( "AtlasDock" ) );
connect( mAtlasDock, &QDockWidget::visibilityChanged, mActionAtlasSettings, &QAction::setChecked );

mReportDock = new QgsDockWidget( tr( "Report" ), this );
mReportDock->setObjectName( QStringLiteral( "ReportDock" ) );
connect( mReportDock, &QDockWidget::visibilityChanged, mActionReportSettings, &QAction::setChecked );

const QList<QDockWidget *> docks = findChildren<QDockWidget *>();
for ( QDockWidget *dock : docks )
Expand Down Expand Up @@ -1992,12 +1994,12 @@ void QgsLayoutDesignerDialog::exportToSvg()
QApplication::restoreOverrideCursor();
}

void QgsLayoutDesignerDialog::showAtlasSettings()
void QgsLayoutDesignerDialog::showAtlasSettings( bool checked )
{
if ( !mAtlasDock )
return;

mAtlasDock->setUserVisible( true );
mAtlasDock->setUserVisible( checked );
}

void QgsLayoutDesignerDialog::atlasPreviewTriggered( bool checked )
Expand Down Expand Up @@ -3274,12 +3276,12 @@ void QgsLayoutDesignerDialog::printReport()
QApplication::restoreOverrideCursor();
}

void QgsLayoutDesignerDialog::showReportSettings()
void QgsLayoutDesignerDialog::showReportSettings( bool checked )
{
if ( !mReportDock )
return;

mReportDock->setUserVisible( true );
mReportDock->setUserVisible( checked );
}

void QgsLayoutDesignerDialog::pageSetup()
Expand Down
4 changes: 2 additions & 2 deletions src/app/layout/qgslayoutdesignerdialog.h
Expand Up @@ -309,7 +309,7 @@ class QgsLayoutDesignerDialog: public QMainWindow, private Ui::QgsLayoutDesigner
void exportToRaster();
void exportToPdf();
void exportToSvg();
void showAtlasSettings();
void showAtlasSettings( bool checked );
void atlasPreviewTriggered( bool checked );
void atlasPageComboEditingFinished();
void atlasNext();
Expand All @@ -325,7 +325,7 @@ class QgsLayoutDesignerDialog: public QMainWindow, private Ui::QgsLayoutDesigner
void exportReportToSvg();
void exportReportToPdf();
void printReport();
void showReportSettings();
void showReportSettings( bool checked );

void pageSetup();

Expand Down
9 changes: 8 additions & 1 deletion src/ui/layout/qgslayoutdesignerbase.ui
Expand Up @@ -99,7 +99,7 @@
<x>0</x>
<y>0</y>
<width>2180</width>
<height>42</height>
<height>25</height>
</rect>
</property>
<widget class="QMenu" name="mLayoutMenu">
Expand Down Expand Up @@ -1369,6 +1369,9 @@
</property>
</action>
<action name="mActionAtlasSettings">
<property name="checkable">
<bool>true</bool>
</property>
<property name="icon">
<iconset resource="../../../images/images.qrc">
<normaloff>:/images/themes/default/mActionAtlasSettings.svg</normaloff>:/images/themes/default/mActionAtlasSettings.svg</iconset>
Expand Down Expand Up @@ -1429,6 +1432,9 @@
</property>
</action>
<action name="mActionReportSettings">
<property name="checkable">
<bool>true</bool>
</property>
<property name="icon">
<iconset resource="../../../images/images.qrc">
<normaloff>:/images/themes/default/mActionAtlasSettings.svg</normaloff>:/images/themes/default/mActionAtlasSettings.svg</iconset>
Expand Down Expand Up @@ -1510,6 +1516,7 @@
<include location="../../../images/images.qrc"/>
<include location="../../../images/images.qrc"/>
<include location="../../../images/images.qrc"/>
<include location="../../../images/images.qrc"/>
</resources>
<connections/>
</ui>

0 comments on commit 4e6a072

Please sign in to comment.