Make report/atlas settings actions checkable, so they can also hide the panels

This commit is contained in:
Nyall Dawson 2018-01-05 12:20:55 +10:00
parent a4f854e2c1
commit 4e6a072e49
3 changed files with 16 additions and 7 deletions

View File

@ -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 )
@ -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 )
@ -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()

View File

@ -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();
@ -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();

View File

@ -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">
@ -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>
@ -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>
@ -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>