QObject wrapper around popup menu. More...
#include <qsmenu.h>
Public Slots | |
| QString | popup () |
| void | reset () |
| void | addItemDef (QString def) |
| void | addItem (const QString &name) |
| void | addSeparator () |
Public Member Functions | |
| QSMenu (Menu *_msys, BaseCore *_base, const QString &name=QString::null) | |
| QString | getAction (int id) |
| virtual | ~QSMenu () |
Private Attributes | |
| Q_PopupMenu * | menu |
| Menu * | msys |
| int | actionId |
| QStringList | actions |
QObject wrapper around popup menu.
Class providing Popup menu functionality to script with functions to create and show these menus
Construct popup menu containing the same items as some other already specified menu (which is used as template)
| _msys | Menu system of window in which this popup menu will be shown | |
| _base | Scripting base | |
| name | Name of the menu as it is stored in settings. If null or not specified, menu will be initially empty |
References actionId, addItem(), debug::DBG_WARN, util::explode(), guiPrintDbg, gui::Menu::isList(), menu, gui::MENUDEF_SEPARATOR, gui::InvalidMenuException::message(), msys, gui::Menu::parseName(), Q_OUT, Q_PopupMenu, and gui::Menu::readItem().
| gui::QSMenu::~QSMenu | ( | ) | [virtual] |
destructor
References menu.
| void gui::QSMenu::addItem | ( | const QString & | name | ) | [slot] |
Append item (or list) to menu using its name (as specified in configuration).
Special: if the name is "-" or "", separator is added to menu
Exceptions are ignored and will result only in the item not added to menu
| name | name of item (item or list) |
References addItemDef(), debug::DBG_DBG, debug::DBG_WARN, guiPrintDbg, gui::Menu::isList(), gui::Menu::loadItem(), menu, gui::InvalidMenuException::message(), msys, Q_OUT, and gui::Menu::readItem().
Referenced by addSeparator(), and QSMenu().
| void gui::QSMenu::addItemDef | ( | QString | def | ) | [slot] |
Append item to menu using its definition.
Exceptions are ignored and will result only in the item not added to menu
You can add items only, not lists in this way. If you want to add list, you must have it defined in configuration first.
| def | Definition of menu item (same format as used in application menus) |
References actionId, actions, debug::DBG_DBG, debug::DBG_WARN, util::explode(), gui::Menu::getIconSet(), guiPrintDbg, pdfobjects::isNull(), menu, gui::MENUDEF_SEPARATOR, gui::InvalidMenuException::message(), msys, gui::Menu::parseName(), Q_OUT, and gui::TMP_OFFSET.
Referenced by addItem().
| void gui::QSMenu::addSeparator | ( | ) | [slot] |
Insert a separator in the menu
References addItem().
| QString gui::QSMenu::getAction | ( | int | id | ) |
For given ID get associated action (script)
| id | ID of menu action |
References actions, gui::Menu::getAction(), msys, and gui::TMP_OFFSET.
Referenced by popup().
| QString gui::QSMenu::popup | ( | ) | [slot] |
Invoke popup menu near position of mouse pointer, return selected action
References debug::DBG_DBG, getAction(), guiPrintDbg, menu, and Q_OUT.
| void gui::QSMenu::reset | ( | ) | [slot] |
int gui::QSMenu::actionId [private] |
last used action ID
Referenced by addItemDef(), QSMenu(), and reset().
QStringList gui::QSMenu::actions [private] |
List of menu actions
Referenced by addItemDef(), getAction(), and reset().
Q_PopupMenu* gui::QSMenu::menu [private] |
Menu* gui::QSMenu::msys [private] |
Menu system of window in which this popup menu will be shown
Referenced by addItem(), addItemDef(), getAction(), and QSMenu().