Skip to content
Permalink
Browse files

[layouts] sort panels and toolbars sub-menus

  • Loading branch information
nirvn committed Feb 19, 2018
1 parent 007009f commit 2f70dd0a422fa21d4fb44ff89e284a44fa9cc0ca
Showing with 14 additions and 5 deletions.
  1. +14 −5 src/app/layout/qgslayoutdesignerdialog.cpp
@@ -131,6 +131,12 @@ void QgsAppLayoutDesignerInterface::close()
}


static bool cmpByText_( QAction *a, QAction *b )
{
return QString::localeAwareCompare( a->text(), b->text() ) < 0;
}


QgsLayoutDesignerDialog::QgsLayoutDesignerDialog( QWidget *parent, Qt::WindowFlags flags )
: QMainWindow( parent, flags )
, mInterface( new QgsAppLayoutDesignerInterface( this ) )
@@ -729,6 +735,14 @@ QgsLayoutDesignerDialog::QgsLayoutDesignerDialog( QWidget *parent, Qt::WindowFla
mLayoutsMenu->setObjectName( QStringLiteral( "mLayoutsMenu" ) );
connect( mLayoutsMenu, &QMenu::aboutToShow, this, &QgsLayoutDesignerDialog::populateLayoutsMenu );

QList<QAction *> actions = mPanelsMenu->actions();
std::sort( actions.begin(), actions.end(), cmpByText_ );
mPanelsMenu->insertActions( nullptr, actions );

actions = mToolbarMenu->actions();
std::sort( actions.begin(), actions.end(), cmpByText_ );
mToolbarMenu->insertActions( nullptr, actions );

restoreWindowState();

//listen out to status bar updates from the view
@@ -740,11 +754,6 @@ QgsAppLayoutDesignerInterface *QgsLayoutDesignerDialog::iface()
return mInterface;
}

static bool cmpByText_( QAction *a, QAction *b )
{
return QString::localeAwareCompare( a->text(), b->text() ) < 0;
}

QMenu *QgsLayoutDesignerDialog::createPopupMenu()
{
QMenu *menu = QMainWindow::createPopupMenu();

0 comments on commit 2f70dd0

Please sign in to comment.
You can’t perform that action at this time.