KDE 4.9 PyKDE API Reference

- KDE's Python API

# KActionMenu Class Reference

`from PyKDE4.kdeui import *`

Inherits: KAction → QWidgetAction → QAction → QObject

## Detailed Description

A KActionMenu is an action that has several properties specific to holding a sub-menu of other actions.

Any QAction can be used to create a submenu.

Plugged in a popupmenu, it will create a submenu. Plugged in a toolbar, it will create a button with a popup menu.

This is the action used by the XMLGUI since it holds other actions. If you want a submenu for selecting one tool among many (without icons), see KSelectAction. See also setDelayed about the main action.

## Methods

| __init__ (self, QObject parent)
| __init__ (self, QString text, QObject parent)
| __init__ (self, KIcon icon, QString text, QObject parent)
| addAction (self, QAction action)
QAction | addSeparator (self)
QWidget | createWidget (self, QWidget parent)
bool | delayed (self)
| insertAction (self, QAction before, QAction action)
QAction | insertSeparator (self, QAction before)
KMenu | menu (self)
KMenu | popupMenu (self)
| remove (self, KAction a0)
| removeAction (self, QAction action)
| setDelayed (self, bool delayed)
| setMenu (self, KMenu menu)
| setStickyMenu (self, bool sticky)
bool | stickyMenu (self)

## Method Documentation

__init__ | ( | self, |
|  | QObject | parent
| ) |  |  |

__init__ | ( | self, |
|  | QString | text,
|  | QObject | parent
| ) |  |  |

__init__ | ( | self, |
|  | KIcon | icon,
|  | QString | text,
|  | QObject | parent
| ) |  |  |

addAction | ( | self, |
|  | QAction | action
| ) |  |  |

QAction addSeparator | ( |  | self ) |

QWidget createWidget | ( | self, |
|  | QWidget | parent
| ) |  |  |

bool delayed | ( |  | self ) |

Returns true if this action creates a delayed popup menu when plugged in a KToolBar.

insertAction | ( | self, |
|  | QAction | before,
|  | QAction | action
| ) |  |  |

QAction insertSeparator | ( | self, |
|  | QAction | before
| ) |  |  |

KMenu menu | ( |  | self ) |

Returns this action's menu as a KMenu, if it is one. If none exists, one will be created.

KMenu popupMenu | ( |  | self ) |

Returns this action's menu as a KMenu, if it is one. If none exists, one will be created.

Deprecated:
  use menu() instead.

remove | ( | self, |
|  | KAction | a0
| ) |  |  |

Deprecated:

removeAction | ( | self, |
|  | QAction | action
| ) |  |  |

setDelayed | ( | self, |
|  | bool | delayed
| ) |  |  |

If set to true, this action will create a delayed popup menu when plugged in a KToolBar. Otherwise it creates a normal popup. Default: delayed

Remember that if the "main" action (the toolbar button itself) cannot be clicked, then you should call setDelayed(false).

In the other case, if the main action can be clicked, it can only happen in a toolbar: in a menu, the parent of a submenu can't be activated. To get a "normal" menu item when plugged a menu (and no submenu) use KToolBarPopupAction.

setMenu | ( | self, |
|  | KMenu | menu
| ) |  |  |

setStickyMenu | ( | self, |
|  | bool | sticky
| ) |  |  |

If set to true, this action will create a sticky popup menu when plugged in a KToolBar. "Sticky", means it's visible until a selection is made or the mouse is clicked elsewhere. This feature allows you to make a selection without having to press and hold down the mouse while making a selection. Default: sticky.

bool stickyMenu | ( |  | self ) |

Returns true if this action creates a sticky popup menu.

See also:
  setStickyMenu().