📄 qiconviewitem.3qt
字号:
QIconViewItem *item;.br for ( item = iconview->firstItem(); item; item = item->nextItem() ).br do_something_with( item );.fi.PPTo remove an item from an iconview, just delete the item. The destructor of the QIconViewItem does all the work for removing it from the iconview..PPAs the iconview is designed to use DnD, the iconview item has methods for DnD too which may be reimplemented..PPThe class is designed to be very similar to QListView and QListBox in use, both via instantiation and subclassing..PPExamples:.(liconview/main.cpp.)l.SH MEMBER FUNCTION DOCUMENTATION.SH "QIconViewItem::QIconViewItem ( QIconView * parent )"Constructs an iconview item with no text and a default icon, and inserts it into the iconview \fIparent.\fR.SH "QIconViewItem::QIconViewItem ( QIconView * parent, QIconViewItem * after )"Constructs an iconview item with no text and a default icon, and inserts it into the iconview \fIparent\fR after the iconview item \fIafter.\fR.SH "QIconViewItem::QIconViewItem ( QIconView * parent, QIconViewItem * after, const QString & text )"Constructs an iconview item using \fItext\fR as text and a default icon, and inserts it into the iconview \fIparent\fR after the iconview item \fIafter.\fR.SH "QIconViewItem::QIconViewItem ( QIconView * parent, QIconViewItem * after, const QString & text, const QPixmap & icon )"Constructs an iconview item using \fItext\fR as text and \fIicon\fR as icon, and inserts it into the iconview \fIparent\fR after the iconview item \fIafter.\fR.SH "QIconViewItem::QIconViewItem ( QIconView * parent, const QString & text )"Constructs an iconview item using \fItext\fR as text and a default icon, and inserts it into the iconview \fIparent.\fR.SH "QIconViewItem::QIconViewItem ( QIconView * parent, const QString & text, const QPixmap & icon )"Constructs an iconview item using \fItext\fR as text and \fIicon\fR as icon, and inserts it into the iconview \fIparent.\fR.SH "QIconViewItem::~QIconViewItem () \fC[virtual]\fR"Destructs the iconview item and tells the iconview about it..SH "bool QIconViewItem::acceptDrop ( const QMimeSource * mime ) const \fC[virtual]\fR"Returns TRUE if the item accepts the QMimeSource \fImime\fR (so it could be dropped on the item), and FALSE if it does not..PPThe default implementation does nothing and returns always TRUE. A subclass must reimplement this to accept drops..SH "void QIconViewItem::calcRect ( const QString & text_ = QString::null ) \fC[virtual protected]\fR"This virtual function is responsible for calculating the rectangles returned by rect(), textRect() and pixmapRect(). setRect(), setTextRect() and setPixmapRect() are provided mainly for reimplementations of this function..SH "int QIconViewItem::compare ( QIconViewItem * i ) const \fC[virtual]\fR"Compares this iconview item to \fIi.\fR Returns -1 if this item is less than \fIi,\fR 0 if they are equal and 1 if this iconview item is greater than \fIi.\fR.PPThe default implementation uses QIconViewItem::key() to compare the items. A reimplementation may use different values..PPSee also key()..SH "bool QIconViewItem::contains ( QPoint pnt ) const"Returns TRUE if the item contains the point \fIpnt\fR (in contents coordinates), and FALSE if it does not..SH "bool QIconViewItem::dragEnabled () const"Returns TRUE if the user is allowed to drag the iconview item, or else FALSE..PPSee also setDragEnabled()..SH "void QIconViewItem::dragEntered () \fC[virtual protected]\fR"This method is called, when a drag entered the item's bounding rect..PPThe default implementation does nothing, subclasses should reimplement this method..SH "void QIconViewItem::dragLeft () \fC[virtual protected]\fR"This method is called, when a drag left the item's bounding rect..PPThe default implementation does nothing, subclasses should reimplement this method..SH "bool QIconViewItem::dropEnabled () const"Returns TRUE if the user is allowed to drop something onto the item, otherwise FALSE..PPSee also setDropEnabled()..SH "void QIconViewItem::dropped ( QDropEvent * e, const QValueList<QIconDragItem> & lst ) \fC[virtual protected]\fR"This method is called when something was dropped on the item. \fIe\fR contains all the information about the drop. If the drag object of the drop was a QIconDrag, \fIlst\fR contains the list of the dropped items. You can get the data using QIconDragItem::data() of each item then..PPSo if \fIlst\fR is not empty, use this data for further operations, else the drag was not a QIconDrag, so you have to decode \fIe\fR yourself and work with that..PPThe default implementation does nothing, subclasses should reimplement this method..SH "int QIconViewItem::height () const"Returns the height of the item..SH "QIconView * QIconViewItem::iconView () const"Returns a pointer to this items' iconview parent..SH "int QIconViewItem::index () const"Returns the index of this item in the iconview, or -1 if an error occurred..SH "bool QIconViewItem::intersects ( QRect r ) const"Returns TRUE, if the item intersects the rectangle \fIr\fR (in contents coordinates), and FALSE if it does not..SH "bool QIconViewItem::isSelectable () const"Returns TRUE if the item is selectable, or else FALSE..PPSee also setSelectable()..SH "bool QIconViewItem::isSelected () const"Returns TRUE if the item is selected, or else FALSE..PPSee also setSelected()..SH "QString QIconViewItem::key () const \fC[virtual]\fR"Returns the key of the iconview item..PPSee also setKey() and compareItems()..SH "void QIconViewItem::move ( int x, int y ) \fC[virtual]\fR"Moves the item to \fIx\fR and \fIy\fR in the iconview (these are contents coordinates)..SH "void QIconViewItem::move ( const QPoint & pnt ) \fC[virtual]\fR"This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts..SH "void QIconViewItem::moveBy ( int dx, int dy ) \fC[virtual]\fR"Moves the item by the distance \fIdx\fR and \fIdy.\fR.SH "void QIconViewItem::moveBy ( const QPoint & pnt ) \fC[virtual]\fR"This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts..SH "QIconViewItem * QIconViewItem::nextItem () const"Returns a pointer to the next item, or 0 if this is the last item of the iconview..SH "void QIconViewItem::paintFocus ( QPainter * p, const QColorGroup & cg ) \fC[virtual protected]\fR"Paints the focus rect of the item using the painter \fIp\fR and the color group \fIcg.\fR.SH "void QIconViewItem::paintItem ( QPainter * p, const QColorGroup & cg ) \fC[virtual protected]\fR"Paints the item using the painter \fIp\fR and the color group \fIcg.\fR If you want the item to be drawn with a different font or color, reimplement this method and change the values of the color group or the painter's font, and call then the QIconViewItem::paintItem() with the changed values..SH "QPixmap * QIconViewItem::pixmap () const \fC[virtual]\fR"Returns the icon of the iconview item. Normally you will set the pixmap if the item with setPixmap(), but sometimes it's inconvenient to call setText() for each item, so you can subclass QIconViewItem, reimplement this method and return a pointer to the item's pixmap. If you do this you have to call calcRect() manually each time the size of this pixmap changes!.PPSee also setPixmap()..SH "QRect QIconViewItem::pixmapRect ( bool relative = TRUE ) const"Returns the bounding rectangle of the item's icon..PPIf \fIrelative\fR is FALSE the returned rectangle is relative to the origin of the iconview's contents coordinate system. If \fIrelative\fR is TRUE the rectangle is relative to the origin of the item's rectangle..SH "QPoint QIconViewItem::pos () const"Returns the position of the item (in contents coordinates)..SH "QIconViewItem * QIconViewItem::prevItem () const"Returns a pointer to the previous item, or 0 if this is the first item of the iconview..SH "QRect QIconViewItem::rect () const"Returns the bounding rect of the item (in contents coordinates)..SH "void QIconViewItem::removeRenameBox () \fC[virtual protected]\fR"Removes the editbox which is used for in-place renaming..SH "void QIconViewItem::rename ()"Starts in-place renaming an icon, if allowed..PPThis function sets the icon view up so that the user can edit the item text, and then returns. When the user is done, setText() will be called and QIconView::itemRenamed() be emitted..SH "bool QIconViewItem::renameEnabled () const"Returns TRUE if the item can be renamed by the user with in-place renaming, or else FALSE..PPSee also setRenameEnabled()..SH "void QIconViewItem::repaint () \fC[virtual]\fR"Repaints the item..SH "void QIconViewItem::setDragEnabled ( bool allow ) \fC[virtual]\fR"If \fIallow\fR is TRUE, the iconview lets the user to drag the iconview item (inside the iconview and outside of it). if \fIallow\fR is FALSE, the item cannot be dragged..SH "void QIconViewItem::setDropEnabled ( bool allow ) \fC[virtual]\fR"If \fIallow\fR is TRUE, the iconview lets the user drop something on this iconview item..SH "void QIconViewItem::setItemRect ( const QRect & r ) \fC[protected]\fR"Sets the bounding rectangle of the whole item. This should be only used in subclasses, which reimplement calcRect() to be able to set the calculated rectangle..SH "void QIconViewItem::setKey ( const QString & k ) \fC[virtual]\fR"Sets \fIk\fR as key of the iconview item. This is used for sorting..PPSee also compareItems()..SH "void QIconViewItem::setPixmap ( const QPixmap & icon ) \fC[virtual]\fR"Sets \fIicon\fR as item icon of the iconview item. This method might be a no-op if you reimplement pixmap()..PPSee also pixmap()..SH "void QIconViewItem::setPixmap ( const QPixmap & icon, bool recalc, bool redraw = TRUE ) \fC[virtual]\fR"Sets \fIicon\fR as item icon of the iconview item. If \fIrecalc\fR is TRUE, the iconview's layout is recalculated. If \fIredraw\fR is TRUE (the default), the icon view is repainted..PPSee also pixmap()..SH "void QIconViewItem::setPixmapRect ( const QRect & r ) \fC[protected]\fR"Sets the bounding rectangle of the item icon. This should be only used in subclasses, which reimplement calcRect() to be able to set the calculated rectangle..SH "void QIconViewItem::setRenameEnabled ( bool allow ) \fC[virtual]\fR"If \fIallow\fR is TRUE, the user can rename the iconview item by clicking on the text while the item is selected (in-place renaming). If \fIallow\fR is FALSE, in-place renaming is not possible..PPExamples:.(liconview/main.cpp.)l.SH "void QIconViewItem::setSelectable ( bool enable ) \fC[virtual]\fR"Sets this items to be selectable if \fIenable\fR is TRUE (the default) or not to be selectable if \fIenable\fR is FALSE..PPThe user is not able to select a non-selectable item using either the keyboard or mouse. The application programmer still can, of course..PPSee also isSelectable()..SH "void QIconViewItem::setSelected ( bool s, bool cb ) \fC[virtual]\fR"Selects or unselects the item depending on \fIs,\fR and may also unselect other items, depending on QIconView::selectionMode() and \fIcb.\fR.PPIf \fIs\fR is FALSE, the item is unselected..PPIf \fIs\fR is TRUE and QIconView::selectionMode() is \fCSingle,\fR the item is selected, and the item which was selected is unselected..PPIf \fIs\fR is TRUE and QIconView::selectionMode() is \fCExtended,\fR the item is selected. If \fIcb\fR is TRUE, the other items of the iconview are not touched. If \fIcb\fR is FALSE all other items are unselected..PPIf \fIs\fR is TRUE and QIconView::selectionMode() is \fCMulti\fR the item is selected..PPNote that \fIcb\fR is used only if QIconView::selectionMode() is \fCExtended.\fR.PPAll items whose selection status change repaint themselves..SH "void QIconViewItem::setSelected ( bool s ) \fC[virtual]\fR"This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts..PPThis variant is equivalent to calling the other variant with \fIcb\fR set to FALSE..SH "void QIconViewItem::setText ( const QString & text ) \fC[virtual]\fR"Sets \fItext\fR as text of the iconview item. This method might be a no-op if you reimplement text()..PPSee also text()..SH "void QIconViewItem::setText ( const QString & text, bool recalc, bool redraw = TRUE ) \fC[virtual]\fR"Sets \fItext\fR as text of the iconview item. If \fIrecalc\fR is TRUE, the iconview's layout is recalculated. If \fIredraw\fR is TRUE (the default), the icon view is repainted..PPSee also text()..SH "void QIconViewItem::setTextRect ( const QRect & r ) \fC[protected]\fR"Sets the bounding rectangle of the item text. This should be only used in subclasses, which reimplement calcRect() to be able to set the calculated rectangle..SH "QSize QIconViewItem::size () const"Returns the size of the item..SH "QString QIconViewItem::text () const \fC[virtual]\fR"Returns the text of the iconview item. Normally you will set the text if the item with setText(), but sometimes it's inconvenient to call setText() for each item, so you can subclass QIconViewItem, reimplement this method and return the text of the item. If you do this you have to call calcRect() manually each time the text (and so the size of it) changes..PPSee also setText()..SH "QRect QIconViewItem::textRect ( bool relative = TRUE ) const"Returns the bounding rectangle of the item's text..PPIf \fIrelative\fR is FALSE the returned rectangle is relative to the origin of the iconview's contents coordinate system. If \fIrelative\fR is TRUE the rectangle is relative to the origin of the item's rectangle..SH "int QIconViewItem::width () const"Returns the width of the item..SH "int QIconViewItem::x () const"Returns the X-Coordinate of the item (in contents coordinates)..SH "int QIconViewItem::y () const"Returns the Y-Coordinate of the item (in contents coordinates)..SH "void QIconViewItem::calcTmpText () \fC[protected]\fR"For internal use only..SH "SEE ALSO".BR http://doc.trolltech.com/qiconviewitem.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 make our job much simpler. Thank you..PIn case of content or formattting problems with this manual page, pleasereport them to.BR qt-bugs@trolltech.com .Please include the name of the manual page (qiconviewitem.3qt) and the Qtversion (2.3.10).
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -