kwave  18.07.70
Kwave::MenuList Class Reference

#include <MenuList.h>

Inheritance diagram for Kwave::MenuList:
Inheritance graph
Collaboration diagram for Kwave::MenuList:
Collaboration graph

Public Member Functions

 MenuList (Kwave::MenuNode *parent, const QString &command, const QString &uid)
 
virtual ~MenuList () Q_DECL_OVERRIDE
 
virtual bool isBranch () const Q_DECL_OVERRIDE
 
virtual void clear () Q_DECL_OVERRIDE
 
virtual Kwave::MenuNodeinsertLeaf (const QString &name, const QString &command, const QKeySequence &shortcut, const QString &uid) Q_DECL_OVERRIDE
 
- Public Member Functions inherited from Kwave::MenuNode
 MenuNode (Kwave::MenuNode *parent, const QString &name, const QString &command, const QKeySequence &shortcut, const QString &uid)
 
virtual ~MenuNode ()
 
const QString path () const
 
const QString & name () const
 
const QString & command () const
 
virtual QAction * action ()
 
const QString & uid () const
 
void setUID (const QString &uid)
 
const QKeySequence & shortcut () const
 
virtual void setShortcut (const QKeySequence &shortcut)
 
virtual const QIcon icon ()
 
virtual void setIcon (const QIcon &icon)
 
virtual Kwave::MenuNodeparentNode () const
 
virtual void setVisible (bool visible)
 
virtual bool isEnabled ()
 
virtual void setEnabled (bool enable)
 
virtual void setChecked (bool check)
 
virtual void setText (const QString &text)
 
Kwave::MenuNodefindUID (const QString &uid)
 
Kwave::MenuNodefindChild (const QString &name)
 
virtual void removeChild (Kwave::MenuNode *child)
 
virtual Kwave::MenuSubinsertBranch (const QString &name, const QString &command, const QKeySequence &shortcut, const QString &uid)
 
virtual void insertChild (Kwave::MenuNode *node, Kwave::MenuNode *before)
 
virtual void insertNode (const QString &name, const QString &position, const QString &command, const QKeySequence &shortcut, const QString &uid)
 
virtual Kwave::MenuNodeleafToBranch (Kwave::MenuNode *node)
 
virtual bool specialCommand (const QString &command)
 
virtual void actionSelected ()
 
virtual QHash< QString, Kwave::MenuGroup * > & groupList ()
 
void joinGroup (const QString &group, Kwave::MenuGroup::Mode mode)
 
void leaveGroup (const QString &group)
 

Additional Inherited Members

- Signals inherited from Kwave::MenuNode
void sigCommand (const QString &command)
 
- Protected Member Functions inherited from Kwave::MenuNode
Kwave::MenuNoderootNode ()
 
void emitCommand (const QString &command)
 
- Protected Attributes inherited from Kwave::MenuNode
QList< Kwave::MenuNode * > m_children
 
QStringList m_groups
 

Detailed Description

Container for a group of entries that belong to a list of menu entries, which contains a number of list entries. It is normally owned by a sub menu.

Definition at line 37 of file MenuList.h.

Constructor & Destructor Documentation

◆ MenuList()

Kwave::MenuList::MenuList ( Kwave::MenuNode parent,
const QString &  command,
const QString &  uid 
)

Constructor.

Parameters
parentpointer to the node's parent (might be 0)
commandthe command to be sent when the entry is selected, should contain a wildcard (%1)
uidunique id string (optional, default=0)

Definition at line 25 of file MenuList.cpp.

28  :MenuNode(parent, _("LISTENTRY[") + uid + _("]"), command, 0, uid)
29 {
30  /* NOTE: the "name" of this node is the uid of the list entries */
31 }
const QString & command() const
Definition: MenuNode.h:77
MenuNode(Kwave::MenuNode *parent, const QString &name, const QString &command, const QKeySequence &shortcut, const QString &uid)
Definition: MenuNode.cpp:35
#define _(m)
Definition: memcpy.c:66
const QString & uid() const
Definition: MenuNode.h:85

◆ ~MenuList()

Kwave::MenuList::~MenuList ( )
virtual

Destructor

Definition at line 34 of file MenuList.cpp.

35 {
36 }

Member Function Documentation

◆ clear()

void Kwave::MenuList::clear ( )
virtual

Removes all entries from the list menu.

Reimplemented from Kwave::MenuNode.

Definition at line 39 of file MenuList.cpp.

References Kwave::MenuNode::findUID(), Kwave::MenuNode::name(), Kwave::MenuNode::parentNode(), and Kwave::MenuNode::removeChild().

Referenced by isBranch().

40 {
41  Kwave::MenuNode *parent = parentNode();
42  Q_ASSERT(parent);
43  if (!parent) return;
44 
45  QString list_uid = name();
46  Kwave::MenuNode *child;
47  while ((child = parent->findUID(list_uid)) != Q_NULLPTR)
48  parent->removeChild(child);
49 }
virtual Kwave::MenuNode * parentNode() const
Definition: MenuNode.cpp:103
Kwave::MenuNode * findUID(const QString &uid)
Definition: MenuNode.cpp:198
virtual void removeChild(Kwave::MenuNode *child)
Definition: MenuNode.cpp:223
const QString & name() const
Definition: MenuNode.h:74
Here is the call graph for this function:
Here is the caller graph for this function:

◆ insertLeaf()

Kwave::MenuNode * Kwave::MenuList::insertLeaf ( const QString &  name,
const QString &  command,
const QKeySequence &  shortcut,
const QString &  uid 
)
virtual

Inserts a new leaf node under the corresponding submenu. The new node normally is (derived from) MenuItem.

Parameters
namenon-localized name of the node
commandthe command to be sent when the node is selected (might be 0)
shortcutkeyboard shortcut, 0 if unused
uidunique id string (might be 0)
Returns
pointer to the new leaf node

Reimplemented from Kwave::MenuNode.

Definition at line 52 of file MenuList.cpp.

References Kwave::MenuNode::insertLeaf(), Kwave::MenuNode::name(), and Kwave::MenuNode::parentNode().

Referenced by isBranch().

56 {
57  Q_UNUSED(uid);
58 
59  Kwave::MenuNode *parent = parentNode();
60  Q_ASSERT(parent);
61  QString list_uid = this->name();
62  return (parent) ?
63  parent->insertLeaf(name, command, shortcut, list_uid) : Q_NULLPTR;
64 }
virtual Kwave::MenuNode * parentNode() const
Definition: MenuNode.cpp:103
const QKeySequence & shortcut() const
Definition: MenuNode.h:95
const QString & name() const
Definition: MenuNode.h:74
const QString & command() const
Definition: MenuNode.h:77
const QString & uid() const
Definition: MenuNode.h:85
virtual Kwave::MenuNode * insertLeaf(const QString &name, const QString &command, const QKeySequence &shortcut, const QString &uid)
Definition: MenuNode.cpp:243
Here is the call graph for this function:
Here is the caller graph for this function:

◆ isBranch()

virtual bool Kwave::MenuList::isBranch ( ) const
inlinevirtual

Always returns true, as the nodes of this type are no branches.

Reimplemented from Kwave::MenuNode.

Definition at line 59 of file MenuList.h.

References clear(), insertLeaf(), Kwave::MenuNode::name(), and Kwave::MenuNode::shortcut().

59 { return false; }
Here is the call graph for this function:

The documentation for this class was generated from the following files: