📄 qcustommenuitem.3qt
字号:
.TH QCustomMenuItem 3qt "10 November 2000" "Trolltech AS" \" -*- nroff -*-.\" Copyright 1992-2000 Trolltech AS. All rights reserved. See the.\" license file included in the distribution for a complete license.\" statement..\".ad l.nh.SH NAMEQCustomMenuItem \- Abstract base class for custom menu items in popup menus.SH SYNOPSIS.br.PP\fC#include <qmenudata.h>\fR.PPInherits Qt..PP.SS "Public Members".in +1c.ti -1c.BI "\fBQCustomMenuItem\fR () ".br.ti -1c.BI "virtual \fB~QCustomMenuItem\fR () ".br.ti -1c.BI "virtual bool \fBfullSpan\fR () const".br.ti -1c.BI "virtual bool \fBisSeparator\fR () const".br.ti -1c.BI "virtual void \fBsetFont\fR ( const QFont & font ) ".br.ti -1c.BI "virtual void \fBpaint\fR ( QPainter * " "p" ", const QColorGroup & " "cg" ", bool " "act" ", bool " "enabled" ", int " "x" ", int " "y" ", int " "w" ", int h ) ".br.ti -1c.BI "virtual QSize \fBsizeHint\fR () ".br.in -1c.SH DESCRIPTIONThe QCustomMenuItem class is an abstract base class for custom menu items in popup menus..PPA custom menu item is a menu item that is defined by two purely virtual functions, paint() and sizeHint(). The size hint tells the menu how much space it needs to reserve for this item, whereas paint is called whenever the item needs painting..PPThis simply mechanism gives applications the possibility to create all kinds of application specific menu items. Examples are items showing different fonts in a word processor, or menus that allow the selection of drawing utilities in a vector drawing program..PPA custom item is inserted into a popup menu with QPopupMenu::insertItem()..PPPer default, a custom item can also have an icon set and/or an accelerator key. You can, however, reimplement fullSpan() to return TRUE if you want the item to span the entire popup menu width. This is in particular useful for labels..PPIf you want the custom item to be treated as a separator only, reimplement isSeparator() to return TRUE..PPNote that you can also insert pixmaps or bitmaps as items into a popup menu. A custom menu item, however, offers even more flexibility and - which is especially important under windows style - the possibility to draw the item with a different color when it is highlighted..PPmenu/menu.cpp shows a simply example how custom menu items can be used..PP<img src=qpopmenu-fancy.png>.PPSee also QMenuData and QPopupMenu..SH MEMBER FUNCTION DOCUMENTATION.SH "QCustomMenuItem::QCustomMenuItem ()"Constructs a QCustomMenuItem..SH "QCustomMenuItem::~QCustomMenuItem () \fC[virtual]\fR"Destructs a QCustomMenuItem..SH "bool QCustomMenuItem::fullSpan () const \fC[virtual]\fR"Returns whether this item wants to span the entire popup menu width. The default is FALSE, meaning that the menu may show an icon and/or an accelerator key for this item as well..SH "bool QCustomMenuItem::isSeparator () const \fC[virtual]\fR"Returns whether this item is just a separator..SH "void QCustomMenuItem::paint ( QPainter * p, const QColorGroup & cg, bool act, bool enabled, int x, int y, int w, int h ) \fC[virtual]\fR"Paints this item. When this function is invoked, the painter \fIp\fR is set to the right font and the right foreground color suitable for a menu item text. The item is active according to \fIact\fR and enabled/disabled according to \fIenabled.\fR The geometry values \fIx, y, w\fR and h specify where to draw the item..PPDo not draw any background, this has already been done by the popup menu according to the current gui style..SH "void QCustomMenuItem::setFont ( const QFont & ) \fC[virtual]\fR"Sets the font of the custom menu item..PPThis function is called whenever the font in the popup menu changes. For menu items that show their own individual font entry, you want to ignore this..SH "QSize QCustomMenuItem::sizeHint () \fC[virtual]\fR"Returns the size hint of this item..SH "SEE ALSO".BR http://doc.trolltech.com/qcustommenuitem.html.SH COPYRIGHTCopyright 1992-2000 Trolltech AS, http://www.trolltech.com/. See thelicense file included in the distribution for a complete licensestatement..SH AUTHORGenerated automatically from the source code.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -