Qt Jambi Home

com.trolltech.qt.gui
Class QStyleOptionMenuItem

java.lang.Object
  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

public class QStyleOptionMenuItem
extends QStyleOption

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.Signal0, QSignalEmitter.Signal1<A>, QSignalEmitter.Signal2<A,B>, QSignalEmitter.Signal3<A,B,C>, QSignalEmitter.Signal4<A,B,C,D>, QSignalEmitter.Signal5<A,B,C,D,E>, QSignalEmitter.Signal6<A,B,C,D,E,F>, QSignalEmitter.Signal7<A,B,C,D,E,F,G>, QSignalEmitter.Signal8<A,B,C,D,E,F,G,H>, QSignalEmitter.Signal9<A,B,C,D,E,F,G,H,I>
 
Constructor Summary
  QStyleOptionMenuItem()
          Constructs a QStyleOptionMenuItem, initializing the members variables to their default values.
protected QStyleOptionMenuItem(int version)
          
  QStyleOptionMenuItem(QStyleOptionMenuItem other)
          Constructs a copy of the other style option.
 
Method Summary
 boolean checked()
          Returns whether the menu item is checked or not.
 QStyleOptionMenuItem.CheckType checkType()
          Returns the type of checkmark of the menu item.
 QFont font()
          Returns the font used for the menu item text.
static QStyleOptionMenuItem fromNativePointer(QNativePointer nativePointer)
          This function returns the QStyleOptionMenuItem instance pointed to by nativePointer
 QIcon icon()
          Returns the icon for the menu item.
 int maxIconWidth()
          Returns the maximum icon width for the icon in the menu item.
 boolean menuHasCheckableItems()
          Returns whether the menu as a whole has checkable items or not.
 QStyleOptionMenuItem.MenuItemType menuItemType()
          Returns the type of menu item.
 QRect menuRect()
          Returns the rectangle for the entire menu.
static QNativePointer nativePointerArray(QStyleOptionMenuItem[] array)
          This function returns a QNativePointer that is pointing to the specified QStyleOptionMenuItem array.
 void setChecked(boolean checked)
          Sets whether the menu item is checked or not to checked.
 void setCheckType(QStyleOptionMenuItem.CheckType checkType)
          Sets the type of checkmark of the menu item to checkType.
 void setFont(QFont font)
          Sets the font used for the menu item text to font.
 void setIcon(QIcon icon)
          Sets the icon for the menu item to icon.
 void setMaxIconWidth(int maxIconWidth)
          Sets the maximum icon width for the icon in the menu item to maxIconWidth.
 void setMenuHasCheckableItems(boolean menuHasCheckableItems)
          Sets whether the menu as a whole has checkable items or not to menuHasCheckableItems.
 void setMenuItemType(QStyleOptionMenuItem.MenuItemType menuItemType)
          Sets the type of menu item to menuItemType.
 void setMenuRect(QRect menuRect)
          Sets the rectangle for the entire menu to menuRect.
 void setTabWidth(int tabWidth)
          Sets the tab width for the menu item to tabWidth.
 void setText(java.lang.String text)
          Sets the text for the menu item to text.
 int tabWidth()
          Returns the tab width for the menu item.
 java.lang.String text()
          Returns the text for the menu item.
 
Methods inherited from class com.trolltech.qt.gui.QStyleOption
direction, fontMetrics, initFrom, nativePointerArray, palette, rect, setDirection, setFontMetrics, setPalette, setRect, setState, setState, setType, setVersion, state, type, version
 
Methods inherited from class com.trolltech.qt.QtJambiObject
dispose, disposed, finalize, reassignNativeResources, tr, tr, tr
 
Methods inherited from class com.trolltech.qt.QSignalEmitter
blockSignals, disconnect, disconnect, signalsBlocked, signalSender, thread
 
Methods inherited from class java.lang.Object
clone, equals, 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(QStyleOptionMenuItem other)

Constructs a copy of the other style option.


QStyleOptionMenuItem

public QStyleOptionMenuItem()

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


QStyleOptionMenuItem

protected QStyleOptionMenuItem(int version)

Method Detail

setMenuHasCheckableItems

public final void setMenuHasCheckableItems(boolean menuHasCheckableItems)

Sets whether the menu as a whole has checkable items or not to menuHasCheckableItems.

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.

See Also:
menuHasCheckableItems

menuHasCheckableItems

public final boolean menuHasCheckableItems()

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

See Also:
setMenuHasCheckableItems

setMenuRect

public final void setMenuRect(QRect menuRect)

Sets the rectangle for the entire menu to menuRect.

The default value is a null rectangle, i.e. a rectangle with both the width and the height set to 0.

See Also:
menuRect

menuRect

public final QRect menuRect()

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

See Also:
setMenuRect

setCheckType

public final void setCheckType(QStyleOptionMenuItem.CheckType checkType)

Sets the type of checkmark of the menu item to checkType.

The default value is NotCheckable.

See Also:
checkType, CheckType

checkType

public final QStyleOptionMenuItem.CheckType checkType()

Returns the type of checkmark of the menu item.

The default value is NotCheckable.

See Also:
setCheckType, CheckType

setIcon

public final void setIcon(QIcon icon)

Sets the icon for the menu item to icon.

The default value is an empty icon, i.e. an icon with neither a pixmap nor a filename.

See Also:
icon

icon

public final QIcon icon()

Returns the icon for the menu item.

The default value is an empty icon, i.e. an icon with neither a pixmap nor a filename.

See Also:
setIcon

setChecked

public final void setChecked(boolean checked)

Sets whether the menu item is checked or not to checked.

The default value is false.

See Also:
checked

checked

public final boolean checked()

Returns whether the menu item is checked or not.

The default value is false.

See Also:
setChecked

setMaxIconWidth

public final void setMaxIconWidth(int maxIconWidth)

Sets the maximum icon width for the icon in the menu item to maxIconWidth.

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.

See Also:
maxIconWidth

maxIconWidth

public final int maxIconWidth()

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

See Also:
setMaxIconWidth

setTabWidth

public final void setTabWidth(int tabWidth)

Sets the tab width for the menu item to tabWidth.

The tab width is the distance between the text of the menu item and the shortcut. The default value is 0.

See Also:
tabWidth

tabWidth

public final int tabWidth()

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

See Also:
setTabWidth

setText

public final void setText(java.lang.String text)

Sets the text for the menu item to text.

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.

See Also:
text

text

public final java.lang.String text()

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

See Also:
setText

setFont

public final void setFont(QFont font)

Sets the font used for the menu item text to font.

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.

See Also:
font

font

public final QFont font()

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

See Also:
setFont

setMenuItemType

public final void setMenuItemType(QStyleOptionMenuItem.MenuItemType menuItemType)

Sets the type of menu item to menuItemType.

The default value is Normal.

See Also:
menuItemType, MenuItemType

menuItemType

public final QStyleOptionMenuItem.MenuItemType menuItemType()

Returns the type of menu item.

The default value is Normal.

See Also:
setMenuItemType, MenuItemType

fromNativePointer

public static QStyleOptionMenuItem fromNativePointer(QNativePointer nativePointer)
This function returns the QStyleOptionMenuItem instance pointed to by nativePointer

Parameters:
nativePointer - the QNativePointer of which object should be returned.

nativePointerArray

public static QNativePointer nativePointerArray(QStyleOptionMenuItem[] array)
This function returns a QNativePointer that is pointing to the specified QStyleOptionMenuItem array.

Parameters:
array - the array that the returned pointer will point to.
Returns:
a QNativePointer that is pointing to the specified array.

Qt Jambi Home