@@ -491,7 +491,7 @@ void QgsCustomizationDialog::showHelp()
491
491
492
492
void QgsCustomization::addTreeItemActions ( QTreeWidgetItem *parentItem, const QList<QAction *> &actions )
493
493
{
494
- Q_FOREACH ( QAction *action, actions )
494
+ for ( const QAction *action : actions )
495
495
{
496
496
if ( action->isSeparator () )
497
497
{
@@ -500,27 +500,29 @@ void QgsCustomization::addTreeItemActions( QTreeWidgetItem *parentItem, const QL
500
500
if ( action->menu () )
501
501
{
502
502
// it is a submenu
503
- addTreeItemMenu ( parentItem, action->menu () );
503
+ addTreeItemMenu ( parentItem, action->menu (), action );
504
504
}
505
505
else
506
506
{
507
507
// it is an ordinary action
508
508
QStringList strs;
509
509
strs << action->objectName () << action->text ();
510
- QTreeWidgetItem *myItem = new QTreeWidgetItem ( parentItem, strs );
511
- myItem ->setIcon ( 0 , action->icon () );
512
- myItem ->setFlags ( Qt::ItemIsEnabled | Qt::ItemIsUserCheckable | Qt::ItemIsSelectable );
513
- myItem ->setCheckState ( 0 , Qt::Checked );
510
+ QTreeWidgetItem *item = new QTreeWidgetItem ( parentItem, strs );
511
+ item ->setIcon ( 0 , action->icon () );
512
+ item ->setFlags ( Qt::ItemIsEnabled | Qt::ItemIsUserCheckable | Qt::ItemIsSelectable );
513
+ item ->setCheckState ( 0 , Qt::Checked );
514
514
}
515
515
}
516
516
}
517
517
518
- void QgsCustomization::addTreeItemMenu ( QTreeWidgetItem *parentItem, QMenu *menu )
518
+ void QgsCustomization::addTreeItemMenu ( QTreeWidgetItem *parentItem, const QMenu *menu, const QAction *action )
519
519
{
520
520
QStringList menustrs;
521
521
// remove '&' which are used to mark shortcut key
522
522
menustrs << menu->objectName () << menu->title ().remove ( ' &' );
523
523
QTreeWidgetItem *menuItem = new QTreeWidgetItem ( parentItem, menustrs );
524
+ if ( action )
525
+ menuItem->setIcon ( 0 , action->icon () );
524
526
menuItem->setFlags ( Qt::ItemIsEnabled | Qt::ItemIsUserCheckable | Qt::ItemIsSelectable );
525
527
menuItem->setCheckState ( 0 , Qt::Checked );
526
528
@@ -921,7 +923,7 @@ void QgsCustomization::preNotify( QObject *receiver, QEvent *event, bool *done )
921
923
}
922
924
}
923
925
924
- QString QgsCustomization::splashPath ()
926
+ QString QgsCustomization::splashPath () const
925
927
{
926
928
if ( isEnabled () )
927
929
{
0 commit comments