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

📄 qiconviewitem.3qt

📁 Linux下的基于X11的图形开发环境。
💻 3QT
📖 第 1 页 / 共 2 页
字号:
.PPExamples:.)l fileiconview/qfileiconview.cpp and iconview/simple_dd/main.cpp..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..PP\fItext_\fR is an internal parameter which defaults to QString::null..SH "int QIconViewItem::compare ( QIconViewItem * i ) const\fC [virtual]\fR"Compares this icon view item to \fIi\fR. Returns -1 if this item is less than \fIi\fR, 0 if they are equal, and 1 if this icon view item is greater than \fIi\fR..PPThe default implementation compares the item keys (key()) using QString::localeAwareCompare(). A reimplementation may use different values and a different comparison function. Here is a reimplementation that uses plain Unicode comparison:.PP.nf.br        int MyIconViewItem::compare( QIconViewItem *i ) const.br        {.br            return key().compare( i->key() );.br        }.br.fi.PPSee also key(), QString::localeAwareCompare(), and QString::compare()..SH "bool QIconViewItem::contains ( const QPoint & pnt ) const"Returns TRUE if the item contains the point \fIpnt\fR (in contents coordinates); otherwise returns FALSE..SH "bool QIconViewItem::dragEnabled () const"Returns TRUE if the user is allowed to drag the icon view item; otherwise returns FALSE..PPSee also setDragEnabled()..SH "void QIconViewItem::dragEntered ()\fC [virtual protected]\fR"This function is called when a drag enters the item's bounding rectangle..PPThe default implementation does nothing; subclasses may reimplement this function..PPExample: fileiconview/qfileiconview.cpp..SH "void QIconViewItem::dragLeft ()\fC [virtual protected]\fR"This function is called when a drag leaves the item's bounding rectangle..PPThe default implementation does nothing; subclasses may reimplement this function..PPExample: fileiconview/qfileiconview.cpp..SH "bool QIconViewItem::dropEnabled () const"Returns TRUE if the user is allowed to drop something onto the item; otherwise returns FALSE..PPSee also setDropEnabled()..SH "void QIconViewItem::dropped ( QDropEvent * e, const QValueList<QIconDragItem> & lst )\fC [virtual protected]\fR"This function is called when something is dropped on the item. \fIe\fR provides 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 by calling QIconDragItem::data() on each item. If the \fIlst\fR is empty, i.e. the drag was not a QIconDrag, you must decode the data in \fIe\fR and work with that..PPThe default implementation does nothing; subclasses may reimplement this function..PPExamples:.)l fileiconview/qfileiconview.cpp and iconview/simple_dd/main.cpp..SH "int QIconViewItem::height () const"Returns the height of the item..SH "QIconView * QIconViewItem::iconView () const"Returns a pointer to this item's icon view parent..SH "int QIconViewItem::index () const"Returns the index of this item in the icon view, or -1 if an error occurred..SH "bool QIconViewItem::intersects ( const QRect & r ) const"Returns TRUE if the item intersects the rectangle \fIr\fR (in contents coordinates); otherwise returns FALSE..SH "bool QIconViewItem::isSelectable () const"Returns TRUE if the item is selectable; otherwise returns FALSE..PPSee also setSelectable()..SH "bool QIconViewItem::isSelected () const"Returns TRUE if the item is selected; otherwise returns FALSE..PPSee also setSelected()..PPExample: fileiconview/qfileiconview.cpp..SH "QString QIconViewItem::key () const\fC [virtual]\fR"Returns the key of the icon view item or text() if no key has been explicitly set..PPSee also setKey() and compare()..SH "bool QIconViewItem::move ( int x, int y )\fC [virtual]\fR"Moves the item to position (\fIx\fR, \fIy\fR) in the icon view (these are contents coordinates)..SH "bool QIconViewItem::move ( const QPoint & pnt )\fC [virtual]\fR"This is an overloaded member function, provided for convenience. It behaves essentially like the above function..PPMoves the item to the point \fIpnt\fR..SH "void QIconViewItem::moveBy ( int dx, int dy )\fC [virtual]\fR"Moves the item \fIdx\fR pixels in the x-direction and \fIdy\fR pixels in the y-direction..SH "void QIconViewItem::moveBy ( const QPoint & pnt )\fC [virtual]\fR"This is an overloaded member function, provided for convenience. It behaves essentially like the above function..PPMoves the item by the x, y values in point \fIpnt\fR..SH "QIconViewItem * QIconViewItem::nextItem () const"Returns a pointer to the next item, or 0 if this is the last item in the icon view..PPTo find the first item use QIconView::firstItem()..PPExample:.PP.nf.br    QIconViewItem *item;.br    for ( item = iconView->firstItem(); item; item = item->nextItem() ).br        do_something_with( item );.br.fi.PPSee also prevItem()..PPExample: fileiconview/qfileiconview.cpp..SH "void QIconViewItem::paintFocus ( QPainter * p, const QColorGroup & cg )\fC [virtual protected]\fR"Paints the focus rectangle 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 function, change the values of the color group or the painter's font, and then call the QIconViewItem::paintItem() with the changed values..PPExample: fileiconview/qfileiconview.cpp..SH "QPicture * QIconViewItem::picture () const\fC [virtual]\fR"Returns the icon of the icon view item if it is a picture, or 0 if it is a pixmap. In the latter case use pixmap() instead. Normally you set the picture of the item with setPicture(), but sometimes it's inconvenient to call setPicture() for every item. So you can subclass QIconViewItem, reimplement this function and return a pointer to the item's picture. If you do this, you \fImust\fR call calcRect() manually each time the size of this picture changes..PPSee also setPicture()..SH "QPixmap * QIconViewItem::pixmap () const\fC [virtual]\fR"Returns the icon of the icon view item if it is a pixmap, or 0 if it is a picture. In the latter case use picture() instead. Normally you set the pixmap of the item with setPixmap(), but sometimes it's inconvenient to call setPixmap() for every item. So you can subclass QIconViewItem, reimplement this function and return a pointer to the item's pixmap. If you do this, you \fImust\fR call calcRect() manually each time the size of this pixmap changes..PPSee also setPixmap()..PPExample: fileiconview/qfileiconview.cpp..SH "QRect QIconViewItem::pixmapRect ( bool relative = TRUE ) const"Returns the bounding rectangle of the item's icon..PPIf \fIrelative\fR is TRUE, (the default), the rectangle is relative to the origin of the item's rectangle. If \fIrelative\fR is FALSE, the returned rectangle is relative to the origin of the icon view's contents coordinate system..PPExample: fileiconview/qfileiconview.cpp..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 in the icon view..PPSee also nextItem() and QIconView::firstItem()..SH "QRect QIconViewItem::rect () const"Returns the bounding rectangle of the item (in contents coordinates)..SH "void QIconViewItem::removeRenameBox ()\fC [virtual protected]\fR"Removes the editbox that is used for in-place renaming..SH "void QIconViewItem::rename ()"Starts in-place renaming of an icon, if allowed..PPThis function sets up the icon view so that the user can edit the item text, and then returns. When the user is done, setText() will be called and QIconView::itemRenamed() will be emitted (unless the user cancelled, e.g. by pressing the Escape key)..PPSee also setRenameEnabled()..PPExample: fileiconview/qfileiconview.cpp..SH "bool QIconViewItem::renameEnabled () const"Returns TRUE if the item can be renamed by the user with in-place renaming; otherwise returns FALSE..PPSee also setRenameEnabled()..PPExample: fileiconview/qfileiconview.cpp..SH "void QIconViewItem::repaint ()\fC [virtual]\fR"Repaints the item..SH "int QIconViewItem::rtti () const\fC [virtual]\fR"Returns 0..PPMake your derived classes return their own values for rtti(), so that you can distinguish between icon view item types. You should use values greater than 1000, preferably a large random number, to allow for extensions to this class..SH "void QIconViewItem::setDragEnabled ( bool allow )\fC [virtual]\fR"If \fIallow\fR is TRUE, the icon view permits the user to drag the icon view item either to another position within the icon view or to somewhere 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 icon view lets the user drop something on this icon view item..SH "void QIconViewItem::setItemRect ( const QRect & r )\fC [protected]\fR"Sets the bounding rectangle of the whole item to \fIr\fR. This function is provided for subclasses which reimplement calcRect(), so that they can set the calculated rectangle. \fIAny other use is discouraged.\fR.PPSee also calcRect(), textRect(), setTextRect(), pixmapRect(), and setPixmapRect()..SH "void QIconViewItem::setKey ( const QString & k )\fC [virtual]\fR"Sets \fIk\fR as the sort key of the icon view item. By default text() is used for sorting..PPSee also compare()..PPExample: fileiconview/qfileiconview.cpp..SH "void QIconViewItem::setPicture ( const QPicture & icon )\fC [virtual]\fR"Sets \fIicon\fR as the item's icon in the icon view. This function might be a no-op if you reimplement picture()..PPSee also picture()..SH "void QIconViewItem::setPixmap ( const QPixmap & icon )\fC [virtual]\fR"Sets \fIicon\fR as the item's icon in the icon view. This function 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"This is an overloaded member function, provided for convenience. It behaves essentially like the above function..PPSets \fIicon\fR as the item's icon in the icon view. If \fIrecalc\fR is TRUE, the icon view'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's icon to \fIr\fR. This function is provided for subclasses which reimplement calcRect(), so that they can set the calculated rectangle. \fIAny other use is discouraged.\fR.PPSee also calcRect(), pixmapRect(), setItemRect(), and setTextRect()..SH "void QIconViewItem::setRenameEnabled ( bool allow )\fC [virtual]\fR"If \fIallow\fR is TRUE, the user can rename the icon view item by clicking on the text (or pressing F2) while the item is selected (in-place renaming). If \fIallow\fR is FALSE, in-place renaming is not possible..PPExamples:.)l fileiconview/qfileiconview.cpp, iconview/main.cpp, and iconview/simple_dd/main.cpp..SH "void QIconViewItem::setSelectable ( bool enable )\fC [virtual]\fR"Sets this item to be selectable if \fIenable\fR is TRUE (the default) or unselectable if \fIenable\fR is FALSE..PPThe user is unable to select a non-selectable item using either the keyboard or the mouse. (The application programmer can select an item in code regardless of this setting.).PPSee also isSelectable()..SH "void QIconViewItem::setSelected ( bool s, bool cb )\fC [virtual]\fR"Selects or unselects the item, depending on \fIs\fR; it 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 previously selected is unselected..PPIf \fIs\fR is TRUE and QIconView::selectionMode() is \fCExtended\fR, the item is selected. If \fIcb\fR is TRUE, the selection state of the other items is left unchanged. If \fIcb\fR is FALSE (the default) 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; cb defaults to FALSE..PPAll items whose selection status changes repaint themselves..PPExample: fileiconview/qfileiconview.cpp..SH "void QIconViewItem::setSelected ( bool s )\fC [virtual]\fR"This is an overloaded member function, provided for convenience. It behaves essentially like the above function..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 the text of the icon view item. This function might be a no-op if you reimplement text()..PPSee also text()..PPExample: fileiconview/qfileiconview.cpp..SH "void QIconViewItem::setText ( const QString & text, bool recalc, bool redraw = TRUE )\fC [virtual]\fR"This is an overloaded member function, provided for convenience. It behaves essentially like the above function..PPSets \fItext\fR as the text of the icon view item. If \fIrecalc\fR is TRUE, the icon view'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's text to \fIr\fR. This function is provided for subclasses which reimplement calcRect(), so that they can set the calculated rectangle. \fIAny other use is discouraged.\fR.PPSee also calcRect(), textRect(), setItemRect(), and setPixmapRect()..SH "QSize QIconViewItem::size () const"Returns the size of the item..SH "QString QIconViewItem::text () const\fC [virtual]\fR"Returns the text of the icon view item. Normally you set the text of the item with setText(), but sometimes it's inconvenient to call setText() for every item; so you can subclass QIconViewItem, reimplement this function, and return the text of the item. If you do this, you must call calcRect() manually each time the text (and therefore its size) changes..PPSee also setText()..PPExample: fileiconview/qfileiconview.cpp..SH "QRect QIconViewItem::textRect ( bool relative = TRUE ) const"Returns the bounding rectangle of the item's text..PPIf \fIrelative\fR is TRUE, (the default), the returned rectangle is relative to the origin of the item's rectangle. If \fIrelative\fR is FALSE, the returned rectangle is relative to the origin of the icon view's contents coordinate system..PPExample: fileiconview/qfileiconview.cpp..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 "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 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 (qiconviewitem.3qt) and the Qtversion (3.1.1).

⌨️ 快捷键说明

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