Sayonara Player
Public Types | Signals | Public Member Functions | Public Slots | Protected Member Functions | Protected Attributes | List of all members
ContextMenu Class Reference

#include <ContextMenu.h>

Detailed Description

A context menu with some standard actions.

Public Types

enum  Entry {
  EntryNone =0,
  EntryNew =(1<<0),
  EntryUndo =(1<<1),
  EntrySave =(1<<2),
  EntrySaveAs =(1<<3),
  EntryRename =(1<<4),
  EntryDelete =(1<<5),
  EntryOpen =(1<<6),
  EntryDefault =(1<<7)
}
 The Entry enum.
 

Signals

void sig_new ()
 
void sig_undo ()
 
void sig_save ()
 
void sig_save_as ()
 
void sig_rename ()
 
void sig_delete ()
 
void sig_open ()
 
void sig_default ()
 

Public Member Functions

 ContextMenu (QWidget *parent=nullptr)
 
void register_action (QAction *action)
 register a custom action More...
 
bool has_actions ()
 query, if there are visible actions More...
 
ContextMenuEntries get_entries () const
 get all visible entries More...
 

Public Slots

void show_actions (ContextMenuEntries entries)
 show actions defined by ContextMenuEntry mask. Hide other actions More...
 
void show_action (ContextMenu::Entry entry, bool visible)
 show/hide specific action More...
 
void show_all ()
 show all actions
 

Protected Member Functions

void showEvent (QShowEvent *e) override
 

Protected Attributes

Settings_settings =nullptr
 

Member Function Documentation

§ get_entries()

ContextMenuEntries ContextMenu::get_entries ( ) const

get all visible entries

Returns
ContextMenuEntry mask

§ has_actions()

bool ContextMenu::has_actions ( )

query, if there are visible actions

Returns
true, if at least one action is visible. false else

§ register_action()

void ContextMenu::register_action ( QAction *  action)

register a custom action

Parameters
actionthe action. You have to set up the connection manually

§ show_action

void ContextMenu::show_action ( ContextMenu::Entry  entry,
bool  visible 
)
slot

show/hide specific action

Parameters
entrythe entry of interes
visibleshow/hide

§ show_actions

void ContextMenu::show_actions ( ContextMenuEntries  entries)
slot

show actions defined by ContextMenuEntry mask. Hide other actions

Parameters
maskof ContextMenu::Entry
Inheritance diagram for ContextMenu:
SayonaraClass