|
|
KPopupMenu is a class for menus with standard title items and keyboard accessibility for popups with many options and/or varying options. It acts identically to QPopupMenu, with the addition of insertTitle(), changeTitle(), setKeyboardShortcutsEnabled() and setKeyboardShortcutsExecute() methods.
The titles support a text string, an icon, plus user defined gradients, colors, and background pixmaps.
The keyboard search algorithm is incremental with additional underlining for user feedback.
KPopupMenu (QWidget *parent=0, const char *name=0)
| KPopupMenu |
Constructs a KPopupMenu.
~KPopupMenu ()
| ~KPopupMenu |
Destructs the object
int insertTitle (const QString &text, int id=-1, int index=-1)
| insertTitle |
Inserts a title item with no icon.
int insertTitle (const QPixmap &icon, const QString &text, int id=-1,
int index=-1)
| insertTitle |
Inserts a title item with the given icon and title.
void changeTitle (int id, const QString &text)
| changeTitle |
Changes the title of the item at the specified id. If a icon was previously set it is cleared.
void changeTitle (int id, const QPixmap &icon, const QString &text)
| changeTitle |
Changes the title and icon of the title item at the specified id.
QString title (int id=-1)
| title |
[const]
Returns the title of the title item at the specified id. The default id of -1 is for backwards compatibility only, you should always specify the id.
QPixmap titlePixmap (int id)
| titlePixmap |
[const]
Returns the icon of the title item at the specified id.
void setKeyboardShortcutsEnabled (bool enable)
| setKeyboardShortcutsEnabled |
Enables keyboard navigation by searching for the entered key sequence. Also underlines the currently selected item, providing feedback on the search.
Defaults to off.
WARNING: calls to text() of currently keyboard-selected items will contain additional ampersand characters.
WARNING: though pre-existing keyboard shortcuts will not interfere with the operation of this feature, they may be confusing to the user as the existing shortcuts will not work.
void setKeyboardShortcutsExecute (bool enable)
| setKeyboardShortcutsExecute |
Enables execution of the menu item once it is uniquely specified. Defaults to off.
KPopupMenu (const QString &title, QWidget *parent=0, const char *name=0)
| KPopupMenu |
Obsolete method provided for backwards compatibility only. Use the normal constructor and insertTitle instead.
void setTitle (const QString &title)
| setTitle |
Obsolete method provided for backwards compatibility only. Use insertTitle and changeTitle instead.
void closeEvent (QCloseEvent *)
| closeEvent |
[protected virtual]
void keyPressEvent (QKeyEvent* e)
| keyPressEvent |
[protected virtual]
void virtual_hook ( int id, void* data )
| virtual_hook |
[protected virtual]
QString underlineText (const QString& text, uint length)
| underlineText |
[protected slots slot]
void resetKeyboardVars (bool noMatches = false)
| resetKeyboardVars |
[protected slots slot]