⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 qcustommenuitem.3qt

📁 linux下GUI编程工具qt的在线连接帮助手册
💻 3QT
字号:
'\" t.TH QCustomMenuItem 3qt "11 October 2001" "Trolltech AS" \" -*- nroff -*-.\" Copyright 1992-2001 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.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, and paint is called whenever the item needs painting..PPThis simple mechanism allows you 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()..PPBy default, a custom item can also have an icon set and a keyboard accelerator. You can reimplement fullSpan() to return TRUE if you want the item to span the entire popup menu width. This is particularly useful for labels..PPIf you want the custom item to be treated just as a separator, reimplement isSeparator() to return TRUE..PPNote that you can insert pixmaps or bitmaps as items into a popup menu without needing to create a QCustomMenuItem. However, custom menu items offer more flexibility, and -- especially important with windows style -- provide the possibility of drawing 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.ce 1.B "[Image Omitted]".PPSee also QMenuData, QPopupMenu and Miscellaneous Classes..SH MEMBER FUNCTION DOCUMENTATION.SH "QCustomMenuItem::QCustomMenuItem ()"Constructs a QCustomMenuItem.SH "QCustomMenuItem::~QCustomMenuItem ()\fC [virtual]\fR"Destroys a QCustomMenuItem.SH "bool QCustomMenuItem::fullSpan () const\fC [virtual]\fR"Returns TRUE if this item wants to span the entire popup menu width. The default is FALSE, meaning that the menu may show an icon and an accelerator key for this item as well..SH "bool QCustomMenuItem::isSeparator () const\fC [virtual]\fR"Returns TRUE if this item is just a separator; otherwise returns FALSE..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 using color group \fIcg\fR. The item is active if \fIact\fR is TRUE and enabled if \fIenabled\fR is TRUE. The geometry values \fIx\fR, \fIy\fR, \fIw\fR and \fIh\fR 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 & font )\fC [virtual]\fR"Sets the font of the custom menu item to \fIfont\fR..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.BR http://www.trolltech.com/faq/tech.html.SH COPYRIGHTCopyright 1992-2001 Trolltech AS, http://www.trolltech.com.  See thelicense file included in the distribution for a complete licensestatement..SH AUTHORGenerated automatically from the source code..SH BUGSIf you find a bug in Qt, please report it as described in.BR http://doc.trolltech.com/bughowto.html .Good bug reports help us to help you. Thank you..PThe definitive Qt documentation is provided in HTML format; it islocated at $QTDIR/doc/html and can be read using Qt Assistant or witha web browser. This man page is provided as a convenience for thoseusers who prefer man pages, although this format is not officiallysupported by Trolltech. .PIf you find errors in this manual page, please report them to.BR qt-bugs@trolltech.com .Please include the name of the manual page (qcustommenuitem.3qt) and the Qtversion (3.0.0).

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -