refs #618, adjusted menus

* new signal slot syntax
* sub menu
This commit is contained in:
Klaus Basan
2016-03-26 23:40:04 +01:00
parent ccbad71f7f
commit 2515c8235d
2 changed files with 15 additions and 5 deletions

View File

@@ -265,27 +265,37 @@ namespace BlackGui
void CAircraftModelView::customMenu(QMenu &menu) const
{
QMenu *stashMenu = new QMenu("Stash", &menu);
if (this->m_menus.testFlag(MenuCanStashModels))
{
menu.addAction(CIcons::appDbStash16(), "Stash", this, SLOT(ps_requestStash()));
QAction *a = menu.addAction(CIcons::appDbStash16(), "Stashing clears selection (on/off)", this, SLOT(ps_stashingClearsSelection()));
stashMenu->addAction(CIcons::appDbStash16(), "Stash", this, &CAircraftModelView::ps_requestStash);
QAction *a = stashMenu->addAction(CIcons::appDbStash16(), "Stashing clears selection (on/off)", this, &CAircraftModelView::ps_stashingClearsSelection);
a->setCheckable(true);
a->setChecked(m_stashingClearsSelection);
}
if (this->m_menus.testFlag(MenuHighlightStashed))
{
// this function requires that someone provides the model strings to be highlighted
QAction *a = menu.addAction(CIcons::appDbStash16(), "Highlight stashed (on/off)", this, SLOT(ps_toggleHighlightStashedModels()));
QAction *a = stashMenu->addAction(CIcons::appDbStash16(), "Highlight stashed (on/off)", this, &CAircraftModelView::ps_toggleHighlightStashedModels);
a->setCheckable(true);
a->setChecked(this->derivedModel()->highlightModelStrings());
}
if (this->m_menus.testFlag(MenuHighlightInvalid))
{
// this function requires that someone provides the model strings to be highlighted
QAction *a = menu.addAction(CIcons::appDbStash16(), "Highlight invalid models (on/off)", this, SLOT(ps_toggleHighlightDbData()));
QAction *a = stashMenu->addAction(CIcons::appDbStash16(), "Highlight invalid models (on/off)", this, &CAircraftModelView::ps_toggleHighlightDbData);
a->setCheckable(true);
a->setChecked(this->derivedModel()->highlightDbData());
}
if (stashMenu->isEmpty())
{
stashMenu->deleteLater();
}
else
{
menu.addMenu(stashMenu);
stashMenu->setIcon(CIcons::appDbStash16());
}
CViewWithDbObjects::customMenu(menu);
}

View File

@@ -86,7 +86,7 @@ namespace BlackGui
{
if (this->m_menus.testFlag(CViewBase<ModelClass, ContainerType, ObjectType>::MenuHighlightDbData))
{
QAction *a = menu.addAction(CIcons::database16(), "Highlight DB data", this, SLOT(ps_toggleHighlightDbData()));
QAction *a = menu.addAction(CIcons::database16(), "Highlight DB data", this, &CViewWithDbObjects<ModelClass, ContainerType, ObjectType, KeyType>::ps_toggleHighlightDbData);
a->setCheckable(true);
a->setChecked(this->derivedModel()->highlightDbData());
}