1QCustomMenuItem(3qt)                                      QCustomMenuItem(3qt)
2
3
4

NAME

6       QCustomMenuItem - Abstract base class for custom menu items in popup
7       menus
8

SYNOPSIS

10       #include <qmenudata.h>
11
12       Inherits Qt.
13
14   Public Members
15       QCustomMenuItem ()
16       virtual ~QCustomMenuItem ()
17       virtual bool fullSpan () const
18       virtual bool isSeparator () const
19       virtual void setFont ( const QFont & font )
20       virtual void paint ( QPainter * p, const QColorGroup & cg, bool act,
21           bool enabled, int x, int y, int w, int h ) = 0
22       virtual QSize sizeHint () = 0
23

DESCRIPTION

25       The QCustomMenuItem class is an abstract base class for custom menu
26       items in popup menus.
27
28       A custom menu item is a menu item that is defined by two pure virtual
29       functions, paint() and sizeHint(). The size hint tells the menu how
30       much space it needs to reserve for this item, and paint is called
31       whenever the item needs painting.
32
33       This simple mechanism allows you to create all kinds of application
34       specific menu items. Examples are items showing different fonts in a
35       word processor or menus that allow the selection of drawing utilities
36       in a vector drawing program.
37
38       A custom item is inserted into a popup menu with
39       QPopupMenu::insertItem().
40
41       By default, a custom item can also have an icon and a keyboard
42       accelerator. You can reimplement fullSpan() to return TRUE if you want
43       the item to span the entire popup menu width. This is particularly
44       useful for labels.
45
46       If you want the custom item to be treated just as a separator,
47       reimplement isSeparator() to return TRUE.
48
49       Note that you can insert pixmaps or bitmaps as items into a popup menu
50       without needing to create a QCustomMenuItem. However, custom menu items
51       offer more flexibility, and -- especially important with Windows style
52       -- provide the possibility of drawing the item with a different color
53       when it is highlighted.
54
55       menu/menu.cpp shows a simple example how custom menu items can be used.
56
57       Note: the current implementation of QCustomMenuItem will not recognize
58       shortcut keys that are from text with ampersands. Normal accelerators
59       work though.
60
61                                   [Image Omitted]
62
63       See also QMenuData, QPopupMenu, and Miscellaneous Classes.
64

MEMBER FUNCTION DOCUMENTATION

QCustomMenuItem::QCustomMenuItem ()

67       Constructs a QCustomMenuItem
68

QCustomMenuItem::~QCustomMenuItem () [virtual]

70       Destroys a QCustomMenuItem
71

bool QCustomMenuItem::fullSpan () const [virtual]

73       Returns TRUE if this item wants to span the entire popup menu width;
74       otherwise returns FALSE. The default is FALSE, meaning that the menu
75       may show an icon and an accelerator key for this item as well.
76

bool QCustomMenuItem::isSeparator () const [virtual]

78       Returns TRUE if this item is just a separator; otherwise returns FALSE.
79

void QCustomMenuItem::paint ( QPainter * p, const QColorGroup & cg, bool act,

81       bool enabled, int x, int y, int w, int h ) [pure virtual]
82       Paints this item. When this function is invoked, the painter p is set
83       to a font and foreground color suitable for a menu item text using
84       color group cg. The item is active if act is TRUE and enabled if
85       enabled is TRUE. The geometry values x, y, w and h specify where to
86       draw the item.
87
88       Do not draw any background, this has already been done by the popup
89       menu according to the current GUI style.
90

void QCustomMenuItem::setFont ( const QFont & font ) [virtual]

92       Sets the font of the custom menu item to font.
93
94       This function is called whenever the font in the popup menu changes.
95       For menu items that show their own individual font entry, you want to
96       ignore this.
97

QSize QCustomMenuItem::sizeHint () [pure virtual]

99       Returns the item's size hint.
100
101

SEE ALSO

103       http://doc.trolltech.com/qcustommenuitem.html
104       http://www.trolltech.com/faq/tech.html
105
107       Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com.  See the
108       license file included in the distribution for a complete license
109       statement.
110

AUTHOR

112       Generated automatically from the source code.
113

BUGS

115       If you find a bug in Qt, please report it as described in
116       http://doc.trolltech.com/bughowto.html.  Good bug reports help us to
117       help you. Thank you.
118
119       The definitive Qt documentation is provided in HTML format; it is
120       located at $QTDIR/doc/html and can be read using Qt Assistant or with a
121       web browser. This man page is provided as a convenience for those users
122       who prefer man pages, although this format is not officially supported
123       by Trolltech.
124
125       If you find errors in this manual page, please report them to qt-
126       bugs@trolltech.com.  Please include the name of the manual page
127       (qcustommenuitem.3qt) and the Qt version (3.3.8).
128
129
130
131Trolltech AS                    2 February 2007           QCustomMenuItem(3qt)
Impressum