Skip to content

Commit

Permalink
Use simpler dock action API
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Oct 16, 2018
1 parent b7b638c commit f8863aa
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 37 deletions.
23 changes: 2 additions & 21 deletions src/app/layout/qgslayoutdesignerdialog.cpp
Expand Up @@ -241,8 +241,6 @@ QgsLayoutDesignerDialog::QgsLayoutDesignerDialog( QWidget *parent, Qt::WindowFla
connect( mActionShowPage, &QAction::triggered, this, &QgsLayoutDesignerDialog::showPages );

connect( mActionPasteInPlace, &QAction::triggered, this, &QgsLayoutDesignerDialog::pasteInPlace );

connect( mActionAtlasSettings, &QAction::triggered, this, &QgsLayoutDesignerDialog::showAtlasSettings );
connect( mActionAtlasPreview, &QAction::triggered, this, &QgsLayoutDesignerDialog::atlasPreviewTriggered );
connect( mActionAtlasNext, &QAction::triggered, this, &QgsLayoutDesignerDialog::atlasNext );
connect( mActionAtlasPrev, &QAction::triggered, this, &QgsLayoutDesignerDialog::atlasPrevious );
Expand All @@ -253,7 +251,6 @@ QgsLayoutDesignerDialog::QgsLayoutDesignerDialog( QWidget *parent, Qt::WindowFla
connect( mActionExportAtlasAsSVG, &QAction::triggered, this, &QgsLayoutDesignerDialog::exportAtlasToSvg );
connect( mActionExportAtlasAsPDF, &QAction::triggered, this, &QgsLayoutDesignerDialog::exportAtlasToPdf );

connect( mActionReportSettings, &QAction::triggered, this, &QgsLayoutDesignerDialog::showReportSettings );
connect( mActionExportReportAsImage, &QAction::triggered, this, &QgsLayoutDesignerDialog::exportReportToRaster );
connect( mActionExportReportAsSVG, &QAction::triggered, this, &QgsLayoutDesignerDialog::exportReportToSvg );
connect( mActionExportReportAsPDF, &QAction::triggered, this, &QgsLayoutDesignerDialog::exportReportToPdf );
Expand Down Expand Up @@ -702,11 +699,11 @@ QgsLayoutDesignerDialog::QgsLayoutDesignerDialog( QWidget *parent, Qt::WindowFla

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

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

const QList<QDockWidget *> docks = findChildren<QDockWidget *>();
for ( QDockWidget *dock : docks )
Expand Down Expand Up @@ -2177,14 +2174,6 @@ void QgsLayoutDesignerDialog::exportToSvg()
mLayout->project()->writeEntry( QStringLiteral( "PAL" ), QStringLiteral( "/DrawOutlineLabels" ), prevSettingLabelsAsOutlines );
}

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

mAtlasDock->setUserVisible( checked );
}

void QgsLayoutDesignerDialog::atlasPreviewTriggered( bool checked )
{
QgsPrintLayout *printLayout = qobject_cast< QgsPrintLayout * >( mLayout );
Expand Down Expand Up @@ -3520,14 +3509,6 @@ void QgsLayoutDesignerDialog::printReport()
mView->setPaintingEnabled( true );
}

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

mReportDock->setUserVisible( checked );
}

void QgsLayoutDesignerDialog::pageSetup()
{
if ( currentLayout() && currentLayout()->pageCollection()->pageCount() > 0 )
Expand Down
2 changes: 0 additions & 2 deletions src/app/layout/qgslayoutdesignerdialog.h
Expand Up @@ -339,7 +339,6 @@ class QgsLayoutDesignerDialog: public QMainWindow, private Ui::QgsLayoutDesigner
void exportToRaster();
void exportToPdf();
void exportToSvg();
void showAtlasSettings( bool checked );
void atlasPreviewTriggered( bool checked );
void atlasPageComboEditingFinished();
void atlasNext();
Expand All @@ -355,7 +354,6 @@ class QgsLayoutDesignerDialog: public QMainWindow, private Ui::QgsLayoutDesigner
void exportReportToSvg();
void exportReportToPdf();
void printReport();
void showReportSettings( bool checked );

void pageSetup();

Expand Down
11 changes: 2 additions & 9 deletions src/app/qgisapp.cpp
Expand Up @@ -873,7 +873,6 @@ QgisApp::QgisApp( QSplashScreen *splash, bool restorePlugins, bool skipVersionCh
showStatsDock->setObjectName( QStringLiteral( "ShowStatisticsPanel" ) );
showStatsDock->setWhatsThis( tr( "Show Statistics Panel" ) );

connect( mStatisticalSummaryDockWidget, &QDockWidget::visibilityChanged, mActionStatisticalSummary, &QAction::setChecked );
endProfile();

// Bookmarks dock
Expand All @@ -885,8 +884,8 @@ QgisApp::QgisApp( QSplashScreen *splash, bool restorePlugins, bool skipVersionCh
connect( showBookmarksDock, &QShortcut::activated, mBookMarksDockWidget, &QgsDockWidget::toggleUserVisible );
showBookmarksDock->setObjectName( QStringLiteral( "ShowBookmarksPanel" ) );
showBookmarksDock->setWhatsThis( tr( "Show Bookmarks Panel" ) );
mBookMarksDockWidget->setLinkedAction( mActionShowBookmarks );

connect( mBookMarksDockWidget, &QDockWidget::visibilityChanged, mActionShowBookmarks, &QAction::setChecked );
endProfile();

startProfile( QStringLiteral( "Snapping utils" ) );
Expand Down Expand Up @@ -2110,15 +2109,14 @@ void QgisApp::createActions()
connect( mActionZoomActualSize, &QAction::triggered, this, &QgisApp::zoomActualSize );
connect( mActionMapTips, &QAction::toggled, this, &QgisApp::toggleMapTips );
connect( mActionNewBookmark, &QAction::triggered, this, &QgisApp::newBookmark );
connect( mActionShowBookmarks, &QAction::toggled, this, &QgisApp::showBookmarks );
connect( mActionDraw, &QAction::triggered, this, &QgisApp::refreshMapCanvas );
connect( mActionTextAnnotation, &QAction::triggered, this, &QgisApp::addTextAnnotation );
connect( mActionFormAnnotation, &QAction::triggered, this, &QgisApp::addFormAnnotation );
connect( mActionHtmlAnnotation, &QAction::triggered, this, &QgisApp::addHtmlAnnotation );
connect( mActionSvgAnnotation, &QAction::triggered, this, &QgisApp::addSvgAnnotation );
connect( mActionAnnotation, &QAction::triggered, this, &QgisApp::modifyAnnotation );
connect( mActionLabeling, &QAction::triggered, this, &QgisApp::labeling );
connect( mActionStatisticalSummary, &QAction::toggled, this, &QgisApp::showStatisticsDockWidget );
mStatisticalSummaryDockWidget->setLinkedAction( mActionStatisticalSummary );

// Layer Menu Items

Expand Down Expand Up @@ -13934,11 +13932,6 @@ void QgisApp::showSystemNotification( const QString &title, const QString &messa
}
}

void QgisApp::showStatisticsDockWidget( bool show )
{
mStatisticalSummaryDockWidget->setUserVisible( show );
}

void QgisApp::onLayerError( const QString &msg )
{
QgsVectorLayer *layer = qobject_cast<QgsVectorLayer *>( sender() );
Expand Down
5 changes: 0 additions & 5 deletions src/app/qgisapp.h
Expand Up @@ -1650,11 +1650,6 @@ class APP_EXPORT QgisApp : public QMainWindow, private Ui::MainWindow
void toggleFilterLegendByExpression( bool );
void updateFilterLegend();

/**
* Shows the statistical summary dock widget and brings it to the foreground
*/
void showStatisticsDockWidget( bool show );

//! Pushes a layer error to the message bar
void onLayerError( const QString &msg );

Expand Down

0 comments on commit f8863aa

Please sign in to comment.