@@ -435,16 +435,30 @@ QgsLayoutDesignerDialog::QgsLayoutDesignerDialog( QWidget *parent, Qt::WindowFla
435
435
resizeToolButton->setDefaultAction ( mActionResizeNarrowest );
436
436
mActionsToolbar ->addWidget ( resizeToolButton );
437
437
438
- QToolButton *atlasExportToolButton = new QToolButton ( mAtlasToolbar );
439
- atlasExportToolButton->setIcon ( QgsApplication::getThemeIcon ( QStringLiteral ( " mActionExport.svg" ) ) );
440
- atlasExportToolButton->setPopupMode ( QToolButton::InstantPopup );
441
- atlasExportToolButton->setAutoRaise ( true );
442
- atlasExportToolButton->setToolButtonStyle ( Qt::ToolButtonIconOnly );
443
- atlasExportToolButton->addAction ( mActionExportAtlasAsImage );
444
- atlasExportToolButton->addAction ( mActionExportAtlasAsSVG );
445
- atlasExportToolButton->addAction ( mActionExportAtlasAsPDF );
446
- atlasExportToolButton->setToolTip ( tr ( " Export Atlas" ) );
447
- mAtlasToolbar ->insertWidget ( mActionAtlasSettings , atlasExportToolButton );
438
+ QToolButton *bt = new QToolButton ( mAtlasToolbar );
439
+ bt->setPopupMode ( QToolButton::MenuButtonPopup );
440
+ bt->addAction ( mActionExportAtlasAsImage );
441
+ bt->addAction ( mActionExportAtlasAsSVG );
442
+ bt->addAction ( mActionExportAtlasAsPDF );
443
+
444
+ QAction *defAtlasExportAction = mActionExportAtlasAsImage ;
445
+ switch ( settings.value ( QStringLiteral ( " LayoutDesigner/atlasExportAction" ), 0 ).toInt () )
446
+ {
447
+ case 0 :
448
+ defAtlasExportAction = mActionExportAtlasAsImage ;
449
+ break ;
450
+ case 1 :
451
+ defAtlasExportAction = mActionExportAtlasAsSVG ;
452
+ break ;
453
+ case 2 :
454
+ defAtlasExportAction = mActionExportAtlasAsPDF ;
455
+ break ;
456
+ }
457
+ bt->setDefaultAction ( defAtlasExportAction );
458
+ QAction *atlasExportAction = mAtlasToolbar ->insertWidget ( mActionAtlasSettings , bt );
459
+ atlasExportAction->setObjectName ( QStringLiteral ( " AtlasExport" ) );
460
+ connect ( bt, &QToolButton::triggered, this , &QgsLayoutDesignerDialog::toolButtonActionTriggered );
461
+
448
462
mAtlasPageComboBox = new QComboBox ();
449
463
mAtlasPageComboBox ->setEditable ( true );
450
464
mAtlasPageComboBox ->addItem ( QString::number ( 1 ) );
@@ -4787,4 +4801,19 @@ void QgsLayoutDesignerDialog::setSectionTitle( const QString &title )
4787
4801
mView ->setSectionLabel ( title );
4788
4802
}
4789
4803
4804
+ void QgsLayoutDesignerDialog::toolButtonActionTriggered ( QAction *action )
4805
+ {
4806
+ QToolButton *bt = qobject_cast<QToolButton *>( sender () );
4807
+ if ( !bt )
4808
+ return ;
4809
+
4810
+ QgsSettings settings;
4811
+ if ( action == mActionExportAtlasAsImage )
4812
+ settings.setValue ( QStringLiteral ( " LayoutDesigner/atlasExportAction" ), 0 );
4813
+ else if ( action == mActionExportAtlasAsSVG )
4814
+ settings.setValue ( QStringLiteral ( " LayoutDesigner/atlasExportAction" ), 2 );
4815
+ else if ( action == mActionExportAtlasAsPDF )
4816
+ settings.setValue ( QStringLiteral ( " LayoutDesigner/atlasExportAction" ), 3 );
4790
4817
4818
+ bt->setDefaultAction ( action );
4819
+ }
0 commit comments