Wiki Markup |
---|
{alias:qmenu}
h2. Name
*qmenu* — pulldown or right-click menu
h2. Syntax
{panel:|borderStyle=solid|borderWidth=1|bgColor=#FFFFAA}
*qmenu* \[_title_]
{panel}
h2. Description
The *qmenu* command creates a QMenu object. The command may take an optional title argument. A QMenu object may appear as a pulldown menu, a rightclick menu, or a submenu. Menus may be attached to actions, menubars, toolbuttons, other menus, or set as right-click menus in QTreeWidget objects. The QMenu becomes the current widget.
h2. Arguments
_title
{indent}_
The text at the point where the menu is attached. If the menu is a pulldown menu along a menubar, the text will appear in the menubar. If the menu is a submenu, the text will appear at the point in the parent menu where the submenu is attached. The argument should be omitted when creating a right-click menu.
{indent}
h2. Examples
h3. Ex.1: QMenu
{anchor:QMenu}
{noformat:|borderWidth=1|bgColor=#eeeeee}
# Create QMainWindow with built-in menubar
set w [qmainwindow]
qsetwindowtitle QMenu
# Get menubar from mainwindow
set menubar [qmenubar $w]
# Create 'File' action and add to menubar
set fileaction [qaction File]
qaddaction $menubar $fileaction
# Create pulldown menu and add to file action
set menu [qmenu]
qsetmenu $fileaction $menu
# Populate file menu
set openaction [qaction Open qopenfilename]
qaddaction $menu $openaction
qshow $w
{noformat}
!att:_img_cmd^qmenu.png!
Example +QMenu+ shows a QMainWindow with a 'File' pulldown menu.
See [qtoolbar] for information on how to attach a pulldown menu to a toolbutton.
{pagebreak} |
Content Comparison
General
Content
Integrations