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

📄 qlistviewitem.3qt

📁 Qt/Embedded是一个多平台的C++图形用户界面应用程序框架
💻 3QT
📖 第 1 页 / 共 2 页
字号:
.TH QListViewItem 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 NAMEQListViewItem \- Implements a list view item.SH SYNOPSIS.br.PP\fC#include <qlistview.h>\fR.PPInherits Qt..PPInherited by QCheckListItem..PP.SS "Public Members".in +1c.ti -1c.BI "\fBQListViewItem\fR ( QListView * parent ) ".br.ti -1c.BI "\fBQListViewItem\fR ( QListViewItem * parent ) ".br.ti -1c.BI "\fBQListViewItem\fR ( QListView * " "parent" ", QListViewItem * after ) ".br.ti -1c.BI "\fBQListViewItem\fR ( QListViewItem * " "parent" ", QListViewItem * after ) ".br.ti -1c.BI "\fBQListViewItem\fR ( QListView * " "parent" ", QString, QString = QString::null, QString = QString::null, QString = QString::null, QString = QString::null, QString = QString::null, QString = QString::null, QString = QString::null ) ".br.ti -1c.BI "\fBQListViewItem\fR ( QListViewItem * " "parent" ", QString, QString = QString::null, QString = QString::null, QString = QString::null, QString = QString::null, QString = QString::null, QString = QString::null, QString = QString::null ) ".br.ti -1c.BI "\fBQListViewItem\fR ( QListView * " "parent" ", QListViewItem * " "after" ", QString, QString = QString::null, QString = QString::null, QString = QString::null, QString = QString::null, QString = QString::null, QString = QString::null, QString = QString::null ) ".br.ti -1c.BI "\fBQListViewItem\fR ( QListViewItem * " "parent" ", QListViewItem * " "after" ", QString, QString = QString::null, QString = QString::null, QString = QString::null, QString = QString::null, QString = QString::null, QString = QString::null, QString = QString::null ) ".br.ti -1c.BI "virtual \fB~QListViewItem\fR () ".br.ti -1c.BI "virtual void \fBinsertItem\fR ( QListViewItem * ) ".br.ti -1c.BI "virtual void \fBtakeItem\fR ( QListViewItem * ) ".br.ti -1c.BI "virtual void removeItem ( QListViewItem * ) \fI(obsolete)\fR".br.ti -1c.BI "int \fBheight\fR () const".br.ti -1c.BI "virtual void \fBinvalidateHeight\fR () ".br.ti -1c.BI "int \fBtotalHeight\fR () const".br.ti -1c.BI "virtual int \fBwidth\fR ( const QFontMetrics &, const QListView *, int column ) const".br.ti -1c.BI "void \fBwidthChanged\fR ( int " "column" "=-1 ) const".br.ti -1c.BI "int \fBdepth\fR () const".br.ti -1c.BI "virtual void \fBsetText\fR ( int, const QString & ) ".br.ti -1c.BI "virtual QString \fBtext\fR ( int ) const".br.ti -1c.BI "virtual void \fBsetPixmap\fR ( int, const QPixmap & ) ".br.ti -1c.BI "virtual const QPixmap* \fBpixmap\fR ( int ) const".br.ti -1c.BI "virtual QString \fBkey\fR ( int, bool ) const".br.ti -1c.BI "virtual void \fBsortChildItems\fR ( int, bool ) ".br.ti -1c.BI "int \fBchildCount\fR () const".br.ti -1c.BI "bool \fBisOpen\fR () const".br.ti -1c.BI "virtual void \fBsetOpen\fR ( bool ) ".br.ti -1c.BI "virtual void \fBsetup\fR () ".br.ti -1c.BI "virtual void \fBsetSelected\fR ( bool ) ".br.ti -1c.BI "bool \fBisSelected\fR () const".br.ti -1c.BI "virtual void \fBpaintCell\fR ( QPainter *, const QColorGroup & " "cg" ", int " "column" ", int " "width" ", int alignment ) ".br.ti -1c.BI "virtual void \fBpaintBranches\fR ( QPainter * " "p" ", const QColorGroup & " "cg" ", int " "w" ", int " "y" ", int " "h" ", GUIStyle s ) ".br.ti -1c.BI "virtual void \fBpaintFocus\fR ( QPainter *, const QColorGroup & " "cg" ", const QRect & r ) ".br.ti -1c.BI "QListViewItem* \fBfirstChild\fR () const".br.ti -1c.BI "QListViewItem* \fBnextSibling\fR () const".br.ti -1c.BI "QListViewItem* \fBparent\fR () const".br.ti -1c.BI "QListViewItem* \fBitemAbove\fR () ".br.ti -1c.BI "QListViewItem* \fBitemBelow\fR () ".br.ti -1c.BI "int \fBitemPos\fR () const".br.ti -1c.BI "QListView* \fBlistView\fR () const".br.ti -1c.BI "virtual void \fBsetSelectable\fR ( bool enable ) ".br.ti -1c.BI "bool \fBisSelectable\fR () const".br.ti -1c.BI "virtual void \fBsetExpandable\fR ( bool ) ".br.ti -1c.BI "bool \fBisExpandable\fR () const".br.ti -1c.BI "void \fBrepaint\fR () const".br.ti -1c.BI "void \fBsort\fR () ".br.ti -1c.BI "void \fBmoveItem\fR ( QListViewItem * after ) ".br.in -1c.SS "Protected Members".in +1c.ti -1c.BI "virtual void \fBenforceSortOrder\fR () const".br.ti -1c.BI "virtual void \fBsetHeight\fR ( int ) ".br.ti -1c.BI "virtual void \fBactivate\fR () ".br.ti -1c.BI "bool \fBactivatedPos\fR ( QPoint & ) ".br.in -1c.SH DESCRIPTIONThe QListViewItem class implements a list view item..PPA list viev item is a multi-column object capable of displaying itself. Its design has the following main goals: .TPWork quickly and well for \fIlarge\fR sets of data. .TPBe easy to use in the simple case. .PPThe simplest way to use QListViewItem is to construct one with a few constant strings. This creates an item which is a child of \fIparent,\fR with two fixed-content strings, and discards the pointer to it:.PP.nf.br     (void) new QListViewItem( parent, "first column", "second column" );.fi.PPThis object will be deleted when \fIparent\fR is deleted, as for QObjects..PPThe parent is either another QListViewItem or a QListView. If the parent is a QListView, this item is a top-level item within that QListView. If the parent is another QListViewItem, this item becomes a child of the parent item..PPIf you keep the pointer, you can set or change the texts using setText(), add pixmaps using setPixmap(), change its mode using setSelectable(), setSelected(), setOpen() and setExpandable(), change its height using setHeight(), and do much tree traversal. The set* functions in QListView also affect QListViewItem, of course..PPYou can traverse the tree as if it were a doubly linked list using itemAbove() and itemBelow(); they return pointers to the items directly above and below this item on the screen (even if none of the three are actually visible at the moment)..PPYou can also traverse it as a tree, using parent(), firstChild() and nextSibling(). This code does something to each of an item's children:.PP.nf.br    QListViewItem * myChild = myItem->firstChild();.br    while( myChild ) {.br        doSomething( myChild );.br        myChild = myChild->nextSibling();.br    }.fi.PPAlso there is now an iterator class to traverse a tree of list view items. To iterate over all items of a list view, do:.PP.nf.br    QListViewItemIterator it( listview );.br    for ( ; it.current(); ++it ).br      do_something_with_the_item( it.current() );.fi.PPNote that the order of the children will change when the sorting order changes, and is undefined if the items are not visible. You can however call enforceSortOrder() at any time, and QListView will always call it before it needs to show an item..PPMany programs will need to reimplement QListViewItem. The most commonly reimplemented functions are: .TPtext() returns the text in a column. Many subclasses will compute that on the fly. .TPkey() is used for sorting. The default key() simply calls text(), but judicious use of key can be used to sort by e.g. date (as QFileDialog does). .TPsetup() is called before showing the item, and whenever e.g. the font changes. .TPactivate() is called whenever the user clicks on the item or presses space when the item is the currently highlighted item..PPSome subclasses call setExpandable( TRUE ) even when they have no children, and populate themselves when setup() or setOpen( TRUE ) is called. The dirview/dirview.cpp example program uses precisely this technique to start up quickly: The files and subdirectories in a directory aren't entered into the tree until they need to..SH MEMBER FUNCTION DOCUMENTATION.SH "QListViewItem::QListViewItem ( QListView * parent )"Constructs a new top-level list view item in the QListView \fIparent.\fR.SH "QListViewItem::QListViewItem ( QListView * parent, QString label1, QString label2 = QString::null, QString label3 = QString::null, QString label4 = QString::null, QString label5 = QString::null, QString label6 = QString::null, QString label7 = QString::null, QString label8 = QString::null )"Constructs a new list view item in the QListView \fIparent, parent,\fR with at most 8 constant strings as contents..PP.nf.br     (void)new QListViewItem( lv, "/", "Root directory" );.fi.PPSee also setText()..SH "QListViewItem::QListViewItem ( QListView * parent, QListViewItem * after )"Constructs an empty list view item which is a child of \fIparent\fR and is after \fIafter\fR in the parent's list of children..SH "QListViewItem::QListViewItem ( QListView * parent, QListViewItem * after, QString label1, QString label2 = QString::null, QString label3 = QString::null, QString label4 = QString::null, QString label5 = QString::null, QString label6 = QString::null, QString label7 = QString::null, QString label8 = QString::null )"Constructs a new list view item in the QListView \fIparent,\fR after item \fIafter,\fR with at most 8 constant strings as contents..PPNote that the order is changed according to QListViewItem::key() unless the list view's sorting is disabled using QListView::setSorting( -1 )..PPSee also setText()..SH "QListViewItem::QListViewItem ( QListViewItem * parent )"Constructs a new list view item which is a child of \fIparent\fR and first in the parent's list of children..SH "QListViewItem::QListViewItem ( QListViewItem * parent, QString label1, QString label2 = QString::null, QString label3 = QString::null, QString label4 = QString::null, QString label5 = QString::null, QString label6 = QString::null, QString label7 = QString::null, QString label8 = QString::null )"Constructs a new list view item that's a child of the QListViewItem \fIparent,\fR with at most 8 constant strings as contents. Possible example in a threaded news or e-mail reader:.PP.nf.br     (void)new QListViewItem( parentMessage, author, subject );.fi.PP

⌨️ 快捷键说明

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