#include <qstyleoption.h>
Inheritance diagram for QStyleOptionMenuItem:


QStyleOptionMenuItem contains all the information that QStyle functions need to draw the menu items from QMenu. It is also used for drawing other menu-related widgets.
For performance reasons, the access to the member variables is direct (i.e., using the . or -> operator). This low-level feel makes the structures straightforward to use and emphasizes that these are simply parameters used by the style functions.
For an example demonstrating how style options can be used, see the {widgets/styles}{Styles} example.
Definition at line 340 of file qstyleoption.h.
Public Types | |
| enum | StyleOptionType |
| enum | StyleOptionVersion |
| enum | MenuItemType |
| enum | CheckType |
Public Member Functions | |
| QStyleOptionMenuItem () | |
| QStyleOptionMenuItem (const QStyleOptionMenuItem &other) | |
Public Attributes | |
| MenuItemType | menuItemType |
| CheckType | checkType |
| bool | checked |
| bool | menuHasCheckableItems |
| QRect | menuRect |
| QString | text |
| QIcon | icon |
| int | maxIconWidth |
| int | tabWidth |
| QFont | font |
Protected Member Functions | |
| QStyleOptionMenuItem (int version) | |
This enum is used to hold information about the type of the style option, and is defined for each QStyleOption subclass.
Type The type of style option provided ({SO_MenuItem} for this class).
The type is used internally by QStyleOption, its subclasses, and qstyleoption_cast() to determine the type of style option. In general you do not need to worry about this unless you want to create your own QStyleOption subclass and your own styles.
Reimplemented from QStyleOption.
Definition at line 343 of file qstyleoption.h.
00343 { Type = SO_MenuItem };
This enum is used to hold information about the version of the style option, and is defined for each QStyleOption subclass.
Version 1
The version is used by QStyleOption subclasses to implement extensions without breaking compatibility. If you use qstyleoption_cast(), you normally don't need to check it.
Reimplemented from QStyleOption.
Definition at line 344 of file qstyleoption.h.
00344 { Version = 1 };
This enum indicates the type of menu item that the structure describes.
Normal A normal menu item. DefaultItem A menu item that is the default action as specified with QMenu::defaultAction(). Separator A menu separator. SubMenu Indicates the menu item points to a sub-menu. Scroller A popup menu scroller (currently only used on Mac OS X). TearOff A tear-off handle for the menu. Margin The margin of the menu. EmptyArea The empty area of the menu.
Definition at line 346 of file qstyleoption.h.
This enum is used to indicate whether or not a check mark should be drawn for the item, or even if it should be drawn at all.
NotCheckable The item is not checkable. Exclusive The item is an exclusive check item (like a radio button). NonExclusive The item is a non-exclusive check item (like a check box).
Definition at line 348 of file qstyleoption.h.
00348 { NotCheckable, Exclusive, NonExclusive };
| QStyleOptionMenuItem::QStyleOptionMenuItem | ( | ) |
Constructs a QStyleOptionMenuItem, initializing the members variables to their default values.
Definition at line 2040 of file qstyleoption.cpp.
02041 : QStyleOption(QStyleOptionMenuItem::Version, SO_MenuItem), menuItemType(Normal), 02042 checkType(NotCheckable), checked(false), menuHasCheckableItems(true), maxIconWidth(0), tabWidth(0) 02043 { 02044 }
| QStyleOptionMenuItem::QStyleOptionMenuItem | ( | const QStyleOptionMenuItem & | other | ) | [inline] |
Constructs a copy of the other style option.
Definition at line 362 of file qstyleoption.h.
00362 : QStyleOption(Version, Type) { *this = other; }
| QStyleOptionMenuItem::QStyleOptionMenuItem | ( | int | version | ) | [protected] |
Definition at line 2049 of file qstyleoption.cpp.
02050 : QStyleOption(version, SO_MenuItem), menuItemType(Normal), 02051 checkType(NotCheckable), checked(false), menuHasCheckableItems(true), maxIconWidth(0), tabWidth(0) 02052 { 02053 }
Definition at line 350 of file qstyleoption.h.
Referenced by QPlastiqueStyle::drawControl(), QCleanlooksStyle::drawControl(), QMenuBarPrivate::getStyleOption(), QMenuPrivate::getStyleOption(), QComboMenuDelegate::getStyleOption(), QMenuBar::heightForWidth(), QMenuBar::minimumSizeHint(), QMenuBar::paintEvent(), QComboBoxPrivateScroller::paintEvent(), QMenu::paintEvent(), and QMenuBar::sizeHint().
Definition at line 351 of file qstyleoption.h.
Referenced by QMenuBarPrivate::getStyleOption(), QMenuPrivate::getStyleOption(), QComboMenuDelegate::getStyleOption(), QMenuBar::heightForWidth(), QMenuBar::minimumSizeHint(), QMenuBar::paintEvent(), QComboBoxPrivateScroller::paintEvent(), QMenu::paintEvent(), and QMenuBar::sizeHint().
Definition at line 352 of file qstyleoption.h.
Referenced by QMenuPrivate::getStyleOption(), and QComboMenuDelegate::getStyleOption().
Definition at line 354 of file qstyleoption.h.
Referenced by QMenuBarPrivate::getStyleOption(), QMenuPrivate::getStyleOption(), QComboMenuDelegate::getStyleOption(), QMenuBar::heightForWidth(), QMenuBar::minimumSizeHint(), QMenuBar::paintEvent(), QComboBoxPrivateScroller::paintEvent(), QMenu::paintEvent(), and QMenuBar::sizeHint().
Definition at line 355 of file qstyleoption.h.
Referenced by QPlastiqueStyle::drawControl(), QCleanlooksStyle::drawControl(), QMenuBarPrivate::getStyleOption(), QMenuPrivate::getStyleOption(), and QComboMenuDelegate::getStyleOption().
Definition at line 356 of file qstyleoption.h.
Referenced by QMenuBarPrivate::getStyleOption(), QMenuPrivate::getStyleOption(), and QComboMenuDelegate::getStyleOption().
Definition at line 357 of file qstyleoption.h.
Referenced by QPlastiqueStyle::drawControl(), QMenuPrivate::getStyleOption(), QComboMenuDelegate::getStyleOption(), QComboBoxPrivateScroller::paintEvent(), and QMenu::paintEvent().
Definition at line 358 of file qstyleoption.h.
Referenced by QPlastiqueStyle::drawControl(), QCleanlooksStyle::drawControl(), QMenuPrivate::getStyleOption(), QComboMenuDelegate::getStyleOption(), QComboBoxPrivateScroller::paintEvent(), and QMenu::paintEvent().
Definition at line 359 of file qstyleoption.h.
Referenced by QPlastiqueStyle::drawControl(), QCleanlooksStyle::drawControl(), QMenuPrivate::getStyleOption(), and QComboMenuDelegate::getStyleOption().
1.5.1