@@ -203,9 +203,17 @@ QgsStyleManagerDialog::QgsStyleManagerDialog( QgsStyle *style, QWidget *parent,
203
203
shareMenu->addAction ( importAction );
204
204
connect ( importAction, &QAction::triggered, this , &QgsStyleManagerDialog::importItems );
205
205
}
206
+ if ( mStyle != QgsStyle::defaultStyle () )
207
+ {
208
+ mActionCopyToDefault = new QAction ( tr ( " Copy Item(s) to Default Style…" ), this );
209
+ shareMenu->addAction ( mActionCopyToDefault );
210
+ connect ( mActionCopyToDefault , &QAction::triggered, this , &QgsStyleManagerDialog::copyItemsToDefault );
211
+ }
212
+
206
213
shareMenu->addSeparator ();
207
214
shareMenu->addAction ( actnExportAsPNG );
208
215
shareMenu->addAction ( actnExportAsSVG );
216
+
209
217
connect ( actnExportAsPNG, &QAction::triggered, this , &QgsStyleManagerDialog::exportItemsPNG );
210
218
connect ( actnExportAsSVG, &QAction::triggered, this , &QgsStyleManagerDialog::exportItemsSVG );
211
219
connect ( exportAction, &QAction::triggered, this , &QgsStyleManagerDialog::exportItems );
@@ -320,6 +328,10 @@ QgsStyleManagerDialog::QgsStyleManagerDialog( QgsStyle *style, QWidget *parent,
320
328
btnAddTag->setVisible ( false );
321
329
btnManageGroups->setVisible ( false );
322
330
}
331
+ if ( mActionCopyToDefault )
332
+ {
333
+ mGroupMenu ->addAction ( mActionCopyToDefault );
334
+ }
323
335
mGroupMenu ->addAction ( actnExportAsPNG );
324
336
mGroupMenu ->addAction ( actnExportAsSVG );
325
337
@@ -410,6 +422,18 @@ void QgsStyleManagerDialog::tabItemType_currentChanged( int )
410
422
populateList ();
411
423
}
412
424
425
+ void QgsStyleManagerDialog::copyItemsToDefault ()
426
+ {
427
+ const QList< ItemDetails > items = selectedItems ();
428
+ if ( !items.empty () )
429
+ {
430
+ auto cursorOverride = qgis::make_unique< QgsTemporaryCursorOverride >( Qt::WaitCursor );
431
+ copyItems ( items, mStyle , QgsStyle::defaultStyle (), this , cursorOverride, true , QStringList (), false , false );
432
+ QMessageBox::information ( this , tr ( " Import Symbols" ),
433
+ tr ( " Symbols successfully imported." ) );
434
+ }
435
+ }
436
+
413
437
int QgsStyleManagerDialog::selectedItemType ()
414
438
{
415
439
QModelIndex index = listItems->selectionModel ()->currentIndex ();
@@ -1556,6 +1580,8 @@ void QgsStyleManagerDialog::selectedSymbolsChanged( const QItemSelection &select
1556
1580
actnDetag->setDisabled ( nothingSelected || mReadOnly );
1557
1581
actnExportAsPNG->setDisabled ( nothingSelected );
1558
1582
actnExportAsSVG->setDisabled ( nothingSelected );
1583
+ if ( mActionCopyToDefault )
1584
+ mActionCopyToDefault ->setDisabled ( nothingSelected );
1559
1585
actnEditItem->setDisabled ( nothingSelected || mReadOnly );
1560
1586
}
1561
1587
0 commit comments