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

📄 qlistviewitem.3qt

📁 Linux下的基于X11的图形开发环境。
💻 3QT
📖 第 1 页 / 共 3 页
字号:
.PPThis function assumes that all parents of this item are open (i.e. that this item is visible or can be made visible by scrolling)..PPSee also itemAbove() and QListView::itemRect()..PPExample: dirview/dirview.cpp..SH "int QListViewItem::itemPos () const"Returns the y coordinate of this item in the list view's coordinate system. This function is normally much slower than QListView::itemAt(), but it works for all items whereas QListView::itemAt() normally only works for items on the screen..PPSee also QListView::itemAt(), QListView::itemRect(), and QListView::itemPos()..SH "QString QListViewItem::key ( int column, bool ascending ) const\fC [virtual]\fR"Returns a key that can be used for sorting by column \fIcolumn\fR. The default implementation returns text(). Derived classes may also incorporate the order indicated by \fIascending\fR into this key, although this is not recommended..PPIf you want to sort on non-alphabetical data, e.g. dates, numbers, etc., reimplement compare()..PPSee also compare() and sortChildItems()..SH "QListView * QListViewItem::listView () const"Returns a pointer to the list view containing this item..SH "void QListViewItem::moveItem ( QListViewItem * after )"Moves this item after the item \fIafter\fR. This means it will get the sibling exactly after the item \fIafter\fR. To move an item in the hierarchy, use takeItem() and insertItem()..SH "bool QListViewItem::multiLinesEnabled () const"Returns TRUE if the item can display multiple lines of text in its columns; otherwise returns FALSE..SH "QListViewItem * QListViewItem::nextSibling () const"Returns the sibling item below this item, or 0 if there is no sibling item after this item..PPNote that the siblings are not guaranteed to be sorted properly. QListView and QListViewItem try to postpone or avoid sorting to the greatest degree possible, in order to keep the user interface snappy..PPSee also firstChild()..PPExample: xml/tagreader-with-features/structureparser.cpp..SH "void QListViewItem::okRename ( int col )\fC [virtual protected]\fR"This function is called if the user presses Enter during in-place renaming of the item in column \fIcol\fR..PPSee also cancelRename()..SH "void QListViewItem::paintBranches ( QPainter * p, const QColorGroup & cg, int w, int y, int h )\fC [virtual]\fR"Paints a set of branches from this item to (some of) its children..PPPainter \fIp\fR is set up with clipping and translation so that you can draw only in the rectangle you need to; \fIcg\fR is the color group to use; the update rectangle is at (0, 0) and has size width \fIw\fR by height \fIh\fR. The top of the rectangle you own is at \fIy\fR (which is never greater than 0 but can be outside the window system's allowed coordinate range)..PPThe update rectangle is in an undefined state when this function is called; this function must draw on \fIall\fR of the pixels..PPSee also paintCell() and QListView::drawContentsOffset()..SH "void QListViewItem::paintCell ( QPainter * p, const QColorGroup & cg, int column, int width, int align )\fC [virtual]\fR"This virtual function paints the contents of one column of an item and aligns it as described by \fIalign\fR..PP\fIp\fR is a QPainter open on the relevant paint device. \fIp\fR is translated so (0, 0) is the top-left pixel in the cell and \fIwidth-1\fR, height()-1 is the bottom-right pixel \fIin\fR the cell. The other properties of \fIp\fR (pen, brush, etc) are undefined. \fIcg\fR is the color group to use. \fIcolumn\fR is the logical column number within the item that is to be painted; 0 is the column which may contain a tree..PPThis function may use QListView::itemMargin() for readability spacing on the left and right sides of data such as text, and should honor isSelected() and QListView::allColumnsShowFocus()..PPIf you reimplement this function, you should also reimplement width()..PPThe rectangle to be painted is in an undefined state when this function is called, so you \fImust\fR draw on all the pixels. The painter \fIp\fR has the right font on entry..PPSee also paintBranches() and QListView::drawContentsOffset()..PPExample: listviews/listviews.cpp..PPReimplemented in QCheckListItem..SH "void QListViewItem::paintFocus ( QPainter * p, const QColorGroup & cg, const QRect & r )\fC [virtual]\fR"Paints a focus indicator on the rectangle \fIr\fR using painter \fIp\fR and colors \fIcg\fR..PP\fIp\fR is already clipped..PPSee also paintCell(), paintBranches(), and QListView::allColumnsShowFocus..PPReimplemented in QCheckListItem..SH "QListViewItem * QListViewItem::parent () const"Returns the parent of this item, or 0 if this item has no parent..PPSee also firstChild() and nextSibling()..PPExample: dirview/dirview.cpp..SH "const QPixmap * QListViewItem::pixmap ( int column ) const\fC [virtual]\fR"Returns the pixmap for \fIcolumn\fR, or 0 if there is no pixmap for \fIcolumn\fR..PPSee also setText() and setPixmap()..PPExample: dirview/dirview.cpp..SH "void QListViewItem::removeItem ( QListViewItem * item )\fC [virtual]\fR"\fBThis function is obsolete.\fR It is provided to keep old source working. We strongly advise against using it in new code..PPThis function has been renamed takeItem()..SH "bool QListViewItem::renameEnabled ( int col ) const"Returns TRUE if this item can be in-place renamed in column \fIcol\fR; otherwise returns FALSE..SH "void QListViewItem::repaint () const"Repaints this item on the screen if it is currently visible..PPExample: addressbook/centralwidget.cpp..SH "int QListViewItem::rtti () const\fC [virtual]\fR"Returns 0..PPMake your derived classes return their own values for rtti(), and you can distinguish between listview items. You should use values greater than 1000, preferably a large random number, to allow for extensions to this class..PPReimplemented in QCheckListItem..SH "void QListViewItem::setDragEnabled ( bool allow )\fC [virtual]\fR"If \fIallow\fR is TRUE, the listview starts a drag (see QListView::dragObject()) when the user presses and moves the mouse on this item..SH "void QListViewItem::setDropEnabled ( bool allow )\fC [virtual]\fR"If \fIallow\fR is TRUE, the listview accepts drops onto the item; otherwise drops are not allowed..SH "void QListViewItem::setEnabled ( bool b )\fC [virtual]\fR"If \fIb\fR is TRUE the item is enabled; otherwise it is disabled. Disabled items are drawn differently (e.g. grayed-out) and are not accessible by the user..SH "void QListViewItem::setExpandable ( bool enable )\fC [virtual]\fR"Sets this item to be expandable even if it has no children if \fIenable\fR is TRUE, and to be expandable only if it has children if \fIenable\fR is FALSE (the default)..PPThe dirview example uses this in the canonical fashion. It checks whether the directory is empty in setup() and calls setExpandable(TRUE) if not; in setOpen() it reads the contents of the directory and inserts items accordingly. This strategy means that dirview can display the entire file system without reading very much at startup..PPNote that root items are not expandable by the user unless QListView::setRootIsDecorated() is set to TRUE..PPSee also setSelectable()..SH "void QListViewItem::setHeight ( int height )\fC [virtual protected]\fR"Sets this item's height to \fIheight\fR pixels. This implicitly changes totalHeight(), too..PPNote that a font change causes this height to be overwritten unless you reimplement setup()..PPFor best results in Windows style we suggest using an even number of pixels..PPSee also height(), totalHeight(), and isOpen()..SH "void QListViewItem::setMultiLinesEnabled ( bool b )\fC [virtual]\fR"If \fIb\fR is TRUE each of the item's columns may contain multiple lines of text; otherwise they may only contain a single line..SH "void QListViewItem::setOpen ( bool o )\fC [virtual]\fR"Opens or closes an item, i.e. shows or hides an item's children..PPIf \fIo\fR is TRUE all child items are shown initially. The user can hide them by clicking the \fB-\fR icon to the left of the item. If \fIo\fR is FALSE, the children of this item are initially hidden. The user can show them by clicking the \fB+\fR icon to the left of the item..PPSee also height(), totalHeight(), and isOpen()..PPExamples:.)l checklists/checklists.cpp, dirview/dirview.cpp, dirview/main.cpp, fileiconview/mainwindow.cpp, and xml/tagreader-with-features/structureparser.cpp..SH "void QListViewItem::setPixmap ( int column, const QPixmap & pm )\fC [virtual]\fR"Sets the pixmap in column \fIcolumn\fR to \fIpm\fR, if \fIpm\fR is non-null and different from the current pixmap, and if \fIcolumn\fR is non-negative..PPSee also pixmap() and setText()..PPExample: dirview/dirview.cpp..SH "void QListViewItem::setRenameEnabled ( int col, bool b )\fC [virtual]\fR"If \fIb\fR is TRUE, this item can be in-place renamed in the column \fIcol\fR by the user; otherwise it cannot be renamed in-place..SH "void QListViewItem::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, e.g. using setSelected()..PPSee also isSelectable()..SH "void QListViewItem::setSelected ( bool s )\fC [virtual]\fR"If \fIs\fR is TRUE this item is selected; otherwise it is deselected..PPThis function does not maintain any invariants or repaint anything -- QListView::setSelected() does that..PPSee also height() and totalHeight()..PPExample: addressbook/centralwidget.cpp..SH "void QListViewItem::setText ( int column, const QString & text )\fC [virtual]\fR"Sets the text in column \fIcolumn\fR to \fItext\fR, if \fIcolumn\fR is a valid column number and \fItext\fR is different from the existing text..PPIf \fItext()\fR has been reimplemented, this function may be a no-op..PPSee also text() and key()..PPExamples:.)l addressbook/centralwidget.cpp and xml/outliner/outlinetree.cpp..SH "void QListViewItem::setVisible ( bool b )"If \fIb\fR is TRUE, the item is made visible; otherwise it is hidden..PPIf the item is not visible, itemAbove() and itemBelow() will never return this item, although you still can reach it by using e.g. QListViewItemIterator..SH "void QListViewItem::setup ()\fC [virtual]\fR"This virtual function is called before the first time QListView needs to know the height or any other graphical attribute of this object, and whenever the font, GUI style, or colors of the list view change..PPThe default calls widthChanged() and sets the item's height to the height of a single line of text in the list view's font. (If you use icons, multi-line text, etc., you will probably need to call setHeight() yourself or reimplement it.).PPExample: dirview/dirview.cpp..SH "void QListViewItem::sort ()\fC [virtual]\fR"(Re)sorts all child items of this item using the last sorting configuration (sort column and direction)..PPSee also enforceSortOrder()..SH "void QListViewItem::sortChildItems ( int column, bool ascending )\fC [virtual]\fR"Sorts this item's children using column \fIcolumn\fR. This is done in ascending order if \fIascending\fR is TRUE and in descending order if \fIascending\fR is FALSE..PPAsks some of the children to sort their children. (QListView and QListViewItem ensure that all on-screen objects are properly sorted but may avoid or defer sorting other objects in order to be more responsive.).PPSee also key() and compare()..SH "void QListViewItem::startRename ( int col )\fC [virtual]\fR"If in-place renaming of this item is enabled (see renameEnabled()), this function starts renaming the item in cloumn \fIcol\fR, by creating and initializing an edit box..SH "void QListViewItem::takeItem ( QListViewItem * item )\fC [virtual]\fR"Removes \fIitem\fR from this object's list of children and causes an update of the screen display. The item is not deleted. You should not normally need to call this function because QListViewItem::~QListViewItem() calls it..PPThe normal way to delete an item is to use \fCdelete\fR..PPIf you need to move an item from one place in the hierarchy to another you can use takeItem() to remove the item from the list view and then insertItem() to put the item back in its new position..PP\fBWarning:\fR This function leaves \fIitem\fR and its children in a state where most member functions are unsafe. Only a few functions work correctly on an item in this state, most notably insertItem(). The functions that work on detached items are explicitly documented as such..PPSee also QListViewItem::insertItem()..SH "QString QListViewItem::text ( int column ) const\fC [virtual]\fR"Returns the text in column \fIcolumn\fR, or QString::null if there is no text in that column..PPSee also key() and paintCell()..PPExamples:.)l addressbook/centralwidget.cpp, dirview/dirview.cpp, and network/ftpclient/ftpmainwindow.ui.h..SH "int QListViewItem::totalHeight () const"Returns the total height of this object, including any visible children. This height is recomputed lazily and cached for as long as possible..PPFunctions which can affect the total height are, setHeight() which is used to set an item's height, setOpen() to show or hide an item's children, and invalidateHeight() to invalidate the cached height..PPSee also height()..SH "int QListViewItem::width ( const QFontMetrics & fm, const QListView * lv, int c ) const\fC [virtual]\fR"Returns the number of pixels of width required to draw column \fIc\fR of list view \fIlv\fR, using the metrics \fIfm\fR without cropping. The list view containing this item may use this information depending on the QListView::WidthMode settings for the column..PPThe default implementation returns the width of the bounding rectangle of the text of column \fIc\fR..PPSee also listView(), widthChanged(), QListView::setColumnWidthMode(), and QListView::itemMargin..SH "void QListViewItem::widthChanged ( int c = -1 ) const"Call this function when the value of width() may have changed for column \fIc\fR. Normally, you should call this if text(c) changes. Passing -1 for \fIc\fR indicates that all columns may have changed. For efficiency, you should do this if more than one call to widthChanged() is required..PPSee also width()..SH "SEE ALSO".BR http://doc.trolltech.com/qlistviewitem.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 (qlistviewitem.3qt) and the Qtversion (3.1.1).

⌨️ 快捷键说明

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