com.trolltech.qt.gui
Class QStyleOptionMenuItem

java.lang.Object
  extended by com.trolltech.qt.internal.QSignalEmitterInternal
      extended by com.trolltech.qt.QSignalEmitter
          extended by com.trolltech.qt.QtJambiObject
              extended by com.trolltech.qt.gui.QStyleOption
                  extended by com.trolltech.qt.gui.QStyleOptionMenuItem
All Implemented Interfaces:
QtJambiInterface, java.lang.Cloneable

public class QStyleOptionMenuItem
extends QStyleOption
implements java.lang.Cloneable

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 Styles example.

See also:
QStyleOption.


Nested Class Summary
static class 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.
static class QStyleOptionMenuItem.MenuItemType
          This enum indicates the type of menu item that the structure describes.
static class QStyleOptionMenuItem.StyleOptionType
          This enum is used to hold information about the type of the style option, and is defined for each QStyleOption subclass.
static class QStyleOptionMenuItem.StyleOptionVersion
          This enum is used to hold information about the version of the style option, and is defined for each QStyleOption subclass.
 
Nested classes/interfaces inherited from class com.trolltech.qt.gui.QStyleOption
QStyleOption.OptionType
 
Nested classes/interfaces inherited from class com.trolltech.qt.QSignalEmitter
QSignalEmitter.AbstractSignal, QSignalEmitter.PrivateSignal0, QSignalEmitter.PrivateSignal1, QSignalEmitter.PrivateSignal2, QSignalEmitter.PrivateSignal3, QSignalEmitter.PrivateSignal4, QSignalEmitter.PrivateSignal5, QSignalEmitter.PrivateSignal6, QSignalEmitter.PrivateSignal7, QSignalEmitter.PrivateSignal8, QSignalEmitter.PrivateSignal9, QSignalEmitter.Signal0, QSignalEmitter.Signal1, QSignalEmitter.Signal2, QSignalEmitter.Signal3, QSignalEmitter.Signal4, QSignalEmitter.Signal5, QSignalEmitter.Signal6, QSignalEmitter.Signal7, QSignalEmitter.Signal8, QSignalEmitter.Signal9
 
Nested classes/interfaces inherited from class com.trolltech.qt.internal.QSignalEmitterInternal
com.trolltech.qt.internal.QSignalEmitterInternal.AbstractSignalInternal
 
Field Summary
 
Fields inherited from class com.trolltech.qt.internal.QSignalEmitterInternal
currentSender
 
Constructor Summary
QStyleOptionMenuItem()
          Constructs a QStyleOptionMenuItem, initializing the members variables to their default values.
QStyleOptionMenuItem(QStyleOptionMenuItem other)
          Constructs a copy of the other style option.
 
Method Summary
 boolean checked()
          This variable holds whether the menu item is checked or not.
 QStyleOptionMenuItem.CheckType checkType()
          This variable holds the type of checkmark of the menu item.
 QStyleOptionMenuItem clone()
          This method is reimplemented for internal reasons
 QFont font()
          This variable holds the font used for the menu item text.
 QIcon icon()
          This variable holds the icon for the menu item.
 int maxIconWidth()
          This variable holds the maximum icon width for the icon in the menu item.
 boolean menuHasCheckableItems()
          This variable holds whether the menu as a whole has checkable items or not.
 QStyleOptionMenuItem.MenuItemType menuItemType()
          This variable holds the type of menu item.
 QRect menuRect()
          This variable holds the rectangle for the entire menu.
 void setChecked(boolean checked)
          This variable holds whether the menu item is checked or not.
 void setCheckType(QStyleOptionMenuItem.CheckType checkType)
          This variable holds the type of checkmark of the menu item.
 void setFont(QFont font)
          This variable holds the font used for the menu item text.
 void setIcon(QIcon icon)
          This variable holds the icon for the menu item.
 void setMaxIconWidth(int maxIconWidth)
          This variable holds the maximum icon width for the icon in the menu item.
 void setMenuHasCheckableItems(boolean menuHasCheckableItems)
          This variable holds whether the menu as a whole has checkable items or not.
 void setMenuItemType(QStyleOptionMenuItem.MenuItemType menuItemType)
          This variable holds the type of menu item.
 void setMenuRect(QRect menuRect)
          This variable holds the rectangle for the entire menu.
 void setTabWidth(int tabWidth)
          This variable holds the tab width for the menu item.
 void setText(java.lang.String text)
          This variable holds the text for the menu item.
 int tabWidth()
          This variable holds the tab width for the menu item.
 java.lang.String text()
          This variable holds the text for the menu item.
 
Methods inherited from class com.trolltech.qt.gui.QStyleOption
direction, fontMetrics, initFrom, palette, rect, setDirection, setFontMetrics, setPalette, setRect, setState, setState, setType, setVersion, state, type, version
 
Methods inherited from class com.trolltech.qt.QtJambiObject
dispose, disposed, equals, finalize, reassignNativeResources, tr, tr, tr
 
Methods inherited from class com.trolltech.qt.QSignalEmitter
blockSignals, disconnect, disconnect, signalsBlocked, signalSender, thread
 
Methods inherited from class com.trolltech.qt.internal.QSignalEmitterInternal
__qt_signalInitialization
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.trolltech.qt.QtJambiInterface
disableGarbageCollection, nativeId, nativePointer, reenableGarbageCollection, setJavaOwnership
 

Constructor Detail

QStyleOptionMenuItem

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


QStyleOptionMenuItem

public QStyleOptionMenuItem(QStyleOptionMenuItem other)
Constructs a copy of the other style option.

Method Detail

setMenuHasCheckableItems

public final void setMenuHasCheckableItems(boolean menuHasCheckableItems)
This variable holds whether the menu as a whole has checkable items or not. The default value is true.

If this option is set to false, then the menu has no checkable items. This makes it possible for GUI styles to save some horizontal space that would normally be used for the check column.


menuHasCheckableItems

public final boolean menuHasCheckableItems()
This variable holds whether the menu as a whole has checkable items or not. The default value is true.

If this option is set to false, then the menu has no checkable items. This makes it possible for GUI styles to save some horizontal space that would normally be used for the check column.


setMenuRect

public final void setMenuRect(QRect menuRect)
This variable holds the rectangle for the entire menu. The default value is a null rectangle, i.e. a rectangle with both the width and the height set to 0.


menuRect

public final QRect menuRect()
This variable holds the rectangle for the entire menu. The default value is a null rectangle, i.e. a rectangle with both the width and the height set to 0.


setCheckType

public final void setCheckType(QStyleOptionMenuItem.CheckType checkType)
This variable holds the type of checkmark of the menu item. The default value is NotCheckable .

See also:
CheckType .


checkType

public final QStyleOptionMenuItem.CheckType checkType()
This variable holds the type of checkmark of the menu item. The default value is NotCheckable .

See also:
CheckType .


setIcon

public final void setIcon(QIcon icon)
This variable holds the icon for the menu item. The default value is an empty icon, i.e. an icon with neither a pixmap nor a filename.


icon

public final QIcon icon()
This variable holds the icon for the menu item. The default value is an empty icon, i.e. an icon with neither a pixmap nor a filename.


setChecked

public final void setChecked(boolean checked)
This variable holds whether the menu item is checked or not. The default value is false.


checked

public final boolean checked()
This variable holds whether the menu item is checked or not. The default value is false.


setMaxIconWidth

public final void setMaxIconWidth(int maxIconWidth)
This variable 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. The variable must be set regardless of whether or not the menu item has an icon. The default value is 0.


maxIconWidth

public final int maxIconWidth()
This variable 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. The variable must be set regardless of whether or not the menu item has an icon. The default value is 0.


setTabWidth

public final void setTabWidth(int tabWidth)
This variable holds the tab width for the menu item. The tab width is the distance between the text of the menu item and the shortcut. The default value is 0.


tabWidth

public final int tabWidth()
This variable holds the tab width for the menu item. The tab width is the distance between the text of the menu item and the shortcut. The default value is 0.


setText

public final void setText(java.lang.String text)
This variable holds the text for the menu item. Note that the text format is something like this "Menu text\tShortcut".

If the menu item doesn't have a shortcut, it will just contain the menu item's text. The default value is an empty string.


text

public final java.lang.String text()
This variable holds the text for the menu item. Note that the text format is something like this "Menu text\tShortcut".

If the menu item doesn't have a shortcut, it will just contain the menu item's text. The default value is an empty string.


setFont

public final void setFont(QFont font)
This variable 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. By default, the application's default font is used.


font

public final QFont font()
This variable 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. By default, the application's default font is used.


setMenuItemType

public final void setMenuItemType(QStyleOptionMenuItem.MenuItemType menuItemType)
This variable holds the type of menu item. The default value is Normal .

See also:
MenuItemType .


menuItemType

public final QStyleOptionMenuItem.MenuItemType menuItemType()
This variable holds the type of menu item. The default value is Normal .

See also:
MenuItemType .


clone

public QStyleOptionMenuItem clone()
This method is reimplemented for internal reasons

Overrides:
clone in class QStyleOption