Ref T189, context menu "Clear highlighting" only if there are highlighted rows

* added customMenu in template
* added hasHighlightedRows
This commit is contained in:
Klaus Basan
2017-11-12 03:38:43 +01:00
parent e24914cc26
commit 3d76eabac5
6 changed files with 32 additions and 4 deletions

View File

@@ -430,9 +430,6 @@ namespace BlackGui
actionInteractiveResize->setChecked(autoResize);
actionInteractiveResize->setEnabled(enabled);
connect(actionInteractiveResize, &QAction::toggled, this, &CViewBaseNonTemplate::ps_toggleResizeMode);
// Clear highlighting
menuActions.addAction(CIcons::refresh16(), "Clear highlighting", CMenuAction::pathViewClearHighlighting(), nullptr , { this, &CViewBaseNonTemplate::clearHighlighting });
}
void CViewBaseNonTemplate::resizeEvent(QResizeEvent *event)
@@ -1422,6 +1419,18 @@ namespace BlackGui
Q_UNUSED(data);
}
template<class ModelClass, class ContainerType, class ObjectType>
void CViewBase<ModelClass, ContainerType, ObjectType>::customMenu(CMenuActions &menuActions)
{
CViewBaseNonTemplate::customMenu(menuActions);
// Clear highlighting
if (this->derivedModel()->hasHighlightedRows())
{
menuActions.addAction(CIcons::refresh16(), "Clear highlighting", CMenuAction::pathViewClearHighlighting(), nullptr , { this, &CViewBaseNonTemplate::clearHighlighting });
}
}
template <class ModelClass, class ContainerType, class ObjectType>
CStatusMessage CViewBase<ModelClass, ContainerType, ObjectType>::ps_loadJson()
{

View File

@@ -706,6 +706,9 @@ namespace BlackGui
//! \remark I cannot use a signal with a template parameter, so this functions serves as callback
virtual void jsonLoadedAndModelUpdated(const ContainerType &data);
//! \copydoc CViewBaseNonTemplate::customMenu
virtual void customMenu(BlackGui::Menus::CMenuActions &menuActions) override;
// --------------------------------------------- SLOTS start here -----------------------------------------
//! \name Slot overrides from base class