Home | All Classes | Main Classes | Annotated | Grouped Classes | Functions

QStyleOptionMenuItem Class Reference

The QStyleOptionMenuItem class is used to describe the parameter necessary for drawing a menu item. More...

#include <QStyleOptionMenuItem>

Inherits QStyleOption.

List of all members.

Public Types

Read-Only Properties

Public Functions


Detailed Description

The QStyleOptionMenuItem class is used to describe the parameter necessary for drawing a menu item.

The QStyleOptionMenuItem is used for drawing menu items from QMenu. It is also used for drawing a variety of other menu related things.


Member Type Documentation

enum QStyleOptionMenuItem::CheckState

These enums are used to indicate whether or not a check mark should be drawn for the item, or even if it should be drawn at all.

QStyleOptionMenuItem::NotCheckableThe item is not checkable.
QStyleOptionMenuItem::CheckedThe item is checked.
QStyleOptionMenuItem::UncheckedThe item can be checked, but currently is not checked.

See also QAction::checkable and QAction::checked.

enum QStyleOptionMenuItem::MenuItemType

These values indicate the type of menu item that the structure describes.

QStyleOptionMenuItem::NormalA normal menu item.
QStyleOptionMenuItem::SeparatorA menu separator.
QStyleOptionMenuItem::SubMenuIndicates the menu item points to a sub-menu.
QStyleOptionMenuItem::ScrollerA popup menu scroller (currently only used on Mac OS X).
QStyleOptionMenuItem::TearOffA tear-off handle for the menu.
QStyleOptionMenuItem::MarginThe margin of the menu.
QStyleOptionMenuItem::EmptyAreaThe empty area of the menu.

Property Documentation

checkState : CheckState

This property holds the checkmark state for the structure.

See also CheckState.

font : QFont

This property holds the font used for the menu item text.

This is the font that should be used for drawing the menu text minus the shortcut. The shortcut is usually drawn using the painter's font.

icon : QIconSet

This property holds the icon (if any) for the menu item.

maxIconWidth : int

This property holds the maximum icon width for the icon in the menu item.

This can be used for drawing the icon into the correct place or properly aligning items. maxIconWidth is set regardless of whether or not the menu item has an icon or not.

menuItemType : MenuItemType

This property holds the current menuItemType for the structure.

See also MenuItemType.

menuRect : QRect

This property holds the rect for the entire menu.

tabWidth : int

This property holds the tab width for the menu item.

The tab width is the distance between the text of the menu item and the shortcut if it contains one.

text : QString

This property holds the text (if any) for the menu item.

Note that the text format is something like this: MenuText<Tab>MenuShortCut

If the menu item does not have a shortcut it will just contain the menu item's text.


Member Function Documentation

QStyleOptionMenuItem::QStyleOptionMenuItem ( int version )

Constructs a QStyleOptionMenuItem with version version. The values of the structure are either zero, null, or empty. It is the responsibilty of the developer to make sure these have proper values.


Copyright © 2004 Trolltech. Trademarks
Qt 4.0.0-tp1