QStyleOptionMenuItem Class Reference

#include <qstyleoption.h>

Inheritance diagram for QStyleOptionMenuItem:

Inheritance graph
[legend]
Collaboration diagram for QStyleOptionMenuItem:

Collaboration graph
[legend]
List of all members.

Detailed Description

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

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.

See also:
QStyleOption

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)


Member Enumeration Documentation

enum QStyleOptionMenuItem::StyleOptionType

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.

See also:
StyleOptionVersion

Reimplemented from QStyleOption.

Definition at line 343 of file qstyleoption.h.

00343 { Type = SO_MenuItem };

enum QStyleOptionMenuItem::StyleOptionVersion

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.

See also:
StyleOptionType

Reimplemented from QStyleOption.

Definition at line 344 of file qstyleoption.h.

00344 { Version = 1 };

enum QStyleOptionMenuItem::MenuItemType

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.

See also:
menuItemType

Definition at line 346 of file qstyleoption.h.

enum QStyleOptionMenuItem::CheckType

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).

See also:
checkType, QAction::checkable, QAction::checked, QActionGroup::exclusive

Definition at line 348 of file qstyleoption.h.


Constructor & Destructor Documentation

QStyleOptionMenuItem::QStyleOptionMenuItem (  ) 

Constructs a QStyleOptionMenuItem, initializing the members variables to their default values.

Definition at line 2040 of file qstyleoption.cpp.

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.


Member Data Documentation

MenuItemType QStyleOptionMenuItem::menuItemType

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().

CheckType QStyleOptionMenuItem::checkType

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().

bool QStyleOptionMenuItem::checked

Definition at line 352 of file qstyleoption.h.

Referenced by QMenuPrivate::getStyleOption(), and QComboMenuDelegate::getStyleOption().

bool QStyleOptionMenuItem::menuHasCheckableItems

Definition at line 353 of file qstyleoption.h.

Referenced by QMenuPrivate::getStyleOption().

QRect QStyleOptionMenuItem::menuRect

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().

QString QStyleOptionMenuItem::text

Definition at line 355 of file qstyleoption.h.

Referenced by QPlastiqueStyle::drawControl(), QCleanlooksStyle::drawControl(), QMenuBarPrivate::getStyleOption(), QMenuPrivate::getStyleOption(), and QComboMenuDelegate::getStyleOption().

QIcon QStyleOptionMenuItem::icon

Definition at line 356 of file qstyleoption.h.

Referenced by QMenuBarPrivate::getStyleOption(), QMenuPrivate::getStyleOption(), and QComboMenuDelegate::getStyleOption().

int QStyleOptionMenuItem::maxIconWidth

Definition at line 357 of file qstyleoption.h.

Referenced by QPlastiqueStyle::drawControl(), QMenuPrivate::getStyleOption(), QComboMenuDelegate::getStyleOption(), QComboBoxPrivateScroller::paintEvent(), and QMenu::paintEvent().

int QStyleOptionMenuItem::tabWidth

Definition at line 358 of file qstyleoption.h.

Referenced by QPlastiqueStyle::drawControl(), QCleanlooksStyle::drawControl(), QMenuPrivate::getStyleOption(), QComboMenuDelegate::getStyleOption(), QComboBoxPrivateScroller::paintEvent(), and QMenu::paintEvent().

QFont QStyleOptionMenuItem::font

Definition at line 359 of file qstyleoption.h.

Referenced by QPlastiqueStyle::drawControl(), QCleanlooksStyle::drawControl(), QMenuPrivate::getStyleOption(), and QComboMenuDelegate::getStyleOption().


The documentation for this class was generated from the following files:
Generated on Thu Mar 15 19:10:31 2007 for Qt 4.2 User's Guide by  doxygen 1.5.1