mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-24 07:55:35 +08:00
refs #855, use Qt5 isSignalConnected feature to hide menus not used
This commit is contained in:
committed by
Mathew Sutcliffe
parent
5f7c3f0e9c
commit
0a611890e8
@@ -83,6 +83,7 @@
|
||||
#include <QShortcut>
|
||||
#include <QVariant>
|
||||
#include <QWidget>
|
||||
#include <QMetaMethod>
|
||||
#include <limits>
|
||||
|
||||
using namespace BlackConfig;
|
||||
@@ -238,8 +239,18 @@ namespace BlackGui
|
||||
CMenuActions ma;
|
||||
switch (menu)
|
||||
{
|
||||
case MenuRefresh: { ma.addAction(BlackMisc::CIcons::refresh16(), "Update", CMenuAction::pathViewUpdates(), { this, &CViewBaseNonTemplate::ps_triggerReload }); break; }
|
||||
case MenuBackend: { ma.addAction(BlackMisc::CIcons::refresh16(), "Reload from backend", CMenuAction::pathViewUpdates(), { this, &CViewBaseNonTemplate::ps_triggerReloadFromBackend }); break; }
|
||||
case MenuRefresh:
|
||||
{
|
||||
static const QMetaMethod requestSignal = QMetaMethod::fromSignal(&CViewBaseNonTemplate::requestUpdate);
|
||||
if (!this->isSignalConnected(requestSignal)) break;
|
||||
ma.addAction(BlackMisc::CIcons::refresh16(), "Update", CMenuAction::pathViewUpdates(), { this, &CViewBaseNonTemplate::ps_triggerReload }); break;
|
||||
}
|
||||
case MenuBackend:
|
||||
{
|
||||
static const QMetaMethod requestSignal = QMetaMethod::fromSignal(&CViewBaseNonTemplate::requestNewBackendData);
|
||||
if (!this->isSignalConnected(requestSignal)) break;
|
||||
ma.addAction(BlackMisc::CIcons::refresh16(), "Reload from backend", CMenuAction::pathViewUpdates(), { this, &CViewBaseNonTemplate::ps_triggerReloadFromBackend }); break;
|
||||
}
|
||||
case MenuDisplayAutomatically:
|
||||
{
|
||||
QAction *a = ma.addAction(CIcons::appMappings16(), "Automatically display (when loaded)", CMenuAction::pathViewUpdates(), { this, &CViewBaseNonTemplate::ps_toggleAutoDisplay });
|
||||
|
||||
Reference in New Issue
Block a user