• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdelibs API Reference
  • KDE Home
  • Contact Us
 

KDEUI

Signals | Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
KMenu Class Reference

#include <kmenu.h>

Inheritance diagram for KMenu:
Inheritance graph
[legend]

Signals

void aboutToShowContextMenu (KMenu *menu, QAction *menuAction, QMenu *ctxMenu)
 

Public Member Functions

 KMenu (QWidget *parent=0L)
 
 KMenu (const QString &title, QWidget *parent=0L)
 
 ~KMenu ()
 
QAction * addTitle (const QString &text, QAction *before=0L)
 
QAction * addTitle (const QIcon &icon, const QString &text, QAction *before=0L)
 
QMenu * contextMenu ()
 
const QMenu * contextMenu () const
 
void hideContextMenu ()
 
Qt::KeyboardModifiers keyboardModifiers () const
 
Qt::MouseButtons mouseButtons () const
 
void setKeyboardShortcutsEnabled (bool enable)
 
void setKeyboardShortcutsExecute (bool enable)
 

Static Public Member Functions

static KMenu * contextMenuFocus ()
 
static QAction * contextMenuFocusAction ()
 

Protected Member Functions

virtual void closeEvent (QCloseEvent *)
 
virtual void contextMenuEvent (QContextMenuEvent *e)
 
virtual bool focusNextPrevChild (bool next)
 
virtual void hideEvent (QHideEvent *)
 
virtual void keyPressEvent (QKeyEvent *e)
 
virtual void mousePressEvent (QMouseEvent *e)
 
virtual void mouseReleaseEvent (QMouseEvent *e)
 

Detailed Description

A menu with keyboard searching.

KMenu is a class for menus with keyboard accessibility for popups with many options and/or varying options. It acts identically to QMenu, with the addition of setKeyboardShortcutsEnabled() and setKeyboardShortcutsExecute() methods.

The keyboard search algorithm is incremental with additional underlining for user feedback.

Author
Daniel M. Duley mosfe.nosp@m.t@kd.nosp@m.e.org
Hamish Rodda rodda.nosp@m.@kde.nosp@m..org

Definition at line 42 of file kmenu.h.

Constructor & Destructor Documentation

KMenu::KMenu ( QWidget *  parent = 0L)
explicit

Constructs a KMenu.

Definition at line 151 of file kmenu.cpp.

KMenu::KMenu ( const QString &  title,
QWidget *  parent = 0L 
)
explicit

Constructs a KMenu.

Parameters
titleThe text displayed in a parent menu when it is inserted into another menu as a submenu.
parentthe parent QWidget object

Definition at line 158 of file kmenu.cpp.

KMenu::~KMenu ( )

Destructs the object.

Definition at line 165 of file kmenu.cpp.

Member Function Documentation

void KMenu::aboutToShowContextMenu ( KMenu *  menu,
QAction *  menuAction,
QMenu *  ctxMenu 
)
signal

connect to this signal to be notified when a context menu is about to be shown

Parameters
menuThe menu that the context menu is about to be shown for
menuActionThe action that the context menu is currently on
ctxMenuThe context menu itself
QAction * KMenu::addTitle ( const QString &  text,
QAction *  before = 0L 
)

Inserts a title item with no icon.

Definition at line 170 of file kmenu.cpp.

QAction * KMenu::addTitle ( const QIcon &  icon,
const QString &  text,
QAction *  before = 0L 
)

Inserts a title item with the given icon and title.

Definition at line 175 of file kmenu.cpp.

void KMenu::closeEvent ( QCloseEvent *  e)
protectedvirtual

This is re-implemented for keyboard navigation.

Definition at line 200 of file kmenu.cpp.

QMenu * KMenu::contextMenu ( )

Returns the context menu associated with this menu The data property of all actions inserted into the context menu is modified all the time to point to the action and menu it has been shown for.

Definition at line 467 of file kmenu.cpp.

const QMenu * KMenu::contextMenu ( ) const

Returns the context menu associated with this menu.

Definition at line 478 of file kmenu.cpp.

void KMenu::contextMenuEvent ( QContextMenuEvent *  e)
protectedvirtual

Definition at line 566 of file kmenu.cpp.

KMenu * KMenu::contextMenuFocus ( )
static

Returns the KMenu associated with the current context menu.

Definition at line 546 of file kmenu.cpp.

QAction * KMenu::contextMenuFocusAction ( )
static

returns the QAction associated with the current context menu

Definition at line 551 of file kmenu.cpp.

bool KMenu::focusNextPrevChild ( bool  next)
protectedvirtual

Definition at line 381 of file kmenu.cpp.

void KMenu::hideContextMenu ( )

Hides the context menu if shown.

Definition at line 483 of file kmenu.cpp.

void KMenu::hideEvent ( QHideEvent *  e)
protectedvirtual

Definition at line 586 of file kmenu.cpp.

Qt::KeyboardModifiers KMenu::keyboardModifiers ( ) const

Return the state of the keyboard modifiers when the last menuitem was activated.

Definition at line 212 of file kmenu.cpp.

void KMenu::keyPressEvent ( QKeyEvent *  e)
protectedvirtual

Definition at line 217 of file kmenu.cpp.

Qt::MouseButtons KMenu::mouseButtons ( ) const

Return the state of the mouse buttons when the last menuitem was activated.

Definition at line 207 of file kmenu.cpp.

void KMenu::mousePressEvent ( QMouseEvent *  e)
protectedvirtual

End keyboard navigation.

RMB menus on menus

Definition at line 429 of file kmenu.cpp.

void KMenu::mouseReleaseEvent ( QMouseEvent *  e)
protectedvirtual

Definition at line 443 of file kmenu.cpp.

void KMenu::setKeyboardShortcutsEnabled ( bool  enable)

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.
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. In addition, where text already contains ampersands, the underline produced is likely to confuse the user (as this feature uses underlining of text to indicate the current key selection sequence).

Definition at line 412 of file kmenu.cpp.

void KMenu::setKeyboardShortcutsExecute ( bool  enable)

Enables execution of the menu item once it is uniquely specified.

Defaults to off.

Definition at line 417 of file kmenu.cpp.


The documentation for this class was generated from the following files:
  • kmenu.h
  • kmenu.cpp
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:49:17 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KDEUI

Skip menu "KDEUI"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Modules
  • Related Pages

kdelibs API Reference

Skip menu "kdelibs API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  • kjsembed
  •   WTF
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Nepomuk-Core
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal