QListWidgetItem Class ReferenceThe QListWidgetItem class provides an item for use with the QListWidget item view class. Далее... #include <QListWidgetItem>
Открытые типы
Открытые функции
Связанные нечлены класса
Подробное описаниеThe QListWidgetItem class provides an item for use with the QListWidget item view class. A QListWidgetItem represents a single item in a QListWidget. Each item can hold several pieces of information, and will display them appropriately. The item view convenience classes use a classic item-based interface rather than a pure model/view approach. For a more flexible list view widget, consider using the QListView class with a standard model. List items can be inserted automatically into a list, when they are constructed, by specifying the list widget: new QListWidgetItem(tr("Hazel"), listWidget); Alternatively, list items can also be created without a parent widget, and later inserted into a list using QListWidget::insertItem(). List items are typically used to display text() and an icon(). These are set with the setText() and setIcon() functions. The appearance of the text can be customized with setFont(), setForeground(), and setBackground(). Text in list items can be aligned using the setTextAlignment() function. Tooltips, status tips and "What's This?" help can be added to list items with setToolTip(), setStatusTip(), and setWhatsThis(). By default, items are enabled, selectable, checkable, and can be the source of drag and drop operations. Each item's flags can be changed by calling setFlags() with the appropriate value (see Qt::ItemFlags). Checkable items can be checked, unchecked and partially checked with the setCheckState() function. The corresponding checkState() function indicates the item's current check state. The isHidden() function can be used to determine whether the item is hidden. To hide an item, use setHidden(). НаследованиеWhen subclassing QListWidgetItem to provide custom items, it is possible to define new types for them enabling them to be distinguished from standard items. For subclasses that require this feature, ensure that you call the base class constructor with a new type value equal to or greater than UserType, within your constructor. See also QListWidget, Model/View Programming, QTreeWidgetItem, and QTableWidgetItem. Описание типов-членовenum QListWidgetItem::ItemTypeThis enum describes the types that are used to describe list widget items.
You can define new user types in QListWidgetItem subclasses to ensure that custom items are treated specially. See also type(). Описание функций-членовQListWidgetItem::QListWidgetItem ( QListWidget * parent = 0, int type = Type )Constructs an empty list widget item of the specified type with the given parent. If parent is not specified, the item will need to be inserted into a list widget with QListWidget::insertItem(). This constructor inserts the item into the model of the parent that is passed to the constructor. If the model is sorted then the behavior of the insert is undetermined since the model will call the '<' operator method on the item which, at this point, is not yet constructed. To avoid the undetermined behavior, we recommend not to specify the parent and use QListWidget::insertItem() instead. See also type(). QListWidgetItem::QListWidgetItem ( const QString & text, QListWidget * parent = 0, int type = Type )Constructs an empty list widget item of the specified type with the given text and parent. If the parent is not specified, the item will need to be inserted into a list widget with QListWidget::insertItem(). This constructor inserts the item into the model of the parent that is passed to the constructor. If the model is sorted then the behavior of the insert is undetermined since the model will call the '<' operator method on the item which, at this point, is not yet constructed. To avoid the undetermined behavior, we recommend not to specify the parent and use QListWidget::insertItem() instead. See also type(). QListWidgetItem::QListWidgetItem ( const QIcon & icon, const QString & text, QListWidget * parent = 0, int type = Type )Constructs an empty list widget item of the specified type with the given icon, text and parent. If the parent is not specified, the item will need to be inserted into a list widget with QListWidget::insertItem(). This constructor inserts the item into the model of the parent that is passed to the constructor. If the model is sorted then the behavior of the insert is undetermined since the model will call the '<' operator method on the item which, at this point, is not yet constructed. To avoid the undetermined behavior, we recommend not to specify the parent and use QListWidget::insertItem() instead. See also type(). QListWidgetItem::QListWidgetItem ( const QListWidgetItem & other )Создаёт копию other. Note that type() and listWidget() are not copied. This function is useful when reimplementing clone(). Эта функция была введена в Qt 4.1. QListWidgetItem::~QListWidgetItem () [virtual]Destroys the list item. QBrush QListWidgetItem::background () constReturns the brush used to display the list item's background. Эта функция была введена в Qt 4.2. See also setBackground() and foreground(). Qt::CheckState QListWidgetItem::checkState () constReturns the checked state of the list item (see Qt::CheckState). See also setCheckState() and flags(). QListWidgetItem * QListWidgetItem::clone () const [virtual]Creates an exact copy of the item. QVariant QListWidgetItem::data ( int role ) const [virtual]Returns the item's data for a given role. Reimplement this function if you need extra roles or special behavior for certain roles. See also Qt::ItemDataRole and setData(). Qt::ItemFlags QListWidgetItem::flags () constReturns the item flags for this item (see Qt::ItemFlags). See also setFlags(). QFont QListWidgetItem::font () constReturns the font used to display this list item's text. Смотрите также setFont(). QBrush QListWidgetItem::foreground () constReturns the brush used to display the list item's foreground (e.g. text). Эта функция была введена в Qt 4.2. See also setForeground() and background(). QIcon QListWidgetItem::icon () constReturns the list item's icon. See also setIcon() and iconSize. bool QListWidgetItem::isHidden () constReturns true if the item is hidden; otherwise returns false. Эта функция была введена в Qt 4.2. See also setHidden(). bool QListWidgetItem::isSelected () constReturns true if the item is selected; otherwise returns false. Эта функция была введена в Qt 4.2. Смотрите также setSelected(). QListWidget * QListWidgetItem::listWidget () constReturns the list widget containing the item. void QListWidgetItem::read ( QDataStream & in ) [virtual]Reads the item from stream in. Смотрите также write(). void QListWidgetItem::setBackground ( const QBrush & brush )Sets the background brush of the list item to the given brush. Эта функция была введена в Qt 4.2. See also background() and setForeground(). void QListWidgetItem::setCheckState ( Qt::CheckState state )Sets the check state of the list item to state. See also checkState(). void QListWidgetItem::setData ( int role, const QVariant & value ) [virtual]Sets the data for a given role to the given value. Reimplement this function if you need extra roles or special behavior for certain roles. See also Qt::ItemDataRole and data(). void QListWidgetItem::setFlags ( Qt::ItemFlags flags )Sets the item flags for the list item to flags. See also flags() and Qt::ItemFlags. void QListWidgetItem::setFont ( const QFont & font )Sets the font used when painting the item to the given font. Смотрите также font(). void QListWidgetItem::setForeground ( const QBrush & brush )Sets the foreground brush of the list item to the given brush. Эта функция была введена в Qt 4.2. See also foreground() and setBackground(). void QListWidgetItem::setHidden ( bool hide )Hides the item if hide is true; otherwise shows the item. Эта функция была введена в Qt 4.2. See also isHidden(). void QListWidgetItem::setIcon ( const QIcon & icon )Sets the icon for the list item to the given icon. See also icon(), text(), and iconSize. void QListWidgetItem::setSelected ( bool select )Sets the selected state of the item to select. Эта функция была введена в Qt 4.2. See also isSelected(). void QListWidgetItem::setSizeHint ( const QSize & size )Sets the size hint for the list item to be size. If no size hint is set, the item delegate will compute the size hint based on the item data. Эта функция была введена в Qt 4.1. Смотрите также sizeHint(). void QListWidgetItem::setStatusTip ( const QString & statusTip )Sets the status tip for the list item to the text specified by statusTip. QListWidget mouseTracking needs to be enabled for this feature to work. See also statusTip(), setToolTip(), setWhatsThis(), and QWidget::setMouseTracking(). void QListWidgetItem::setText ( const QString & text )Sets the text for the list widget item's to the given text. Смотрите также text(). void QListWidgetItem::setTextAlignment ( int alignment )Sets the list item's text alignment to alignment. See also textAlignment() and Qt::AlignmentFlag. void QListWidgetItem::setToolTip ( const QString & toolTip )Sets the tooltip for the list item to the text specified by toolTip. See also toolTip(), setStatusTip(), and setWhatsThis(). void QListWidgetItem::setWhatsThis ( const QString & whatsThis )Sets the "What's This?" help for the list item to the text specified by whatsThis. See also whatsThis(), setStatusTip(), and setToolTip(). QSize QListWidgetItem::sizeHint () constReturns the size hint set for the list item. Эта функция была введена в Qt 4.1. See also setSizeHint(). QString QListWidgetItem::statusTip () constReturns the list item's status tip. See also setStatusTip(). QString QListWidgetItem::text () constReturns the list item's text. Смотрите также setText(). int QListWidgetItem::textAlignment () constReturns the text alignment for the list item. See also setTextAlignment() and Qt::AlignmentFlag. QString QListWidgetItem::toolTip () constReturns the list item's tooltip. See also setToolTip(), statusTip(), and whatsThis(). int QListWidgetItem::type () constReturns the type passed to the QListWidgetItem constructor. QString QListWidgetItem::whatsThis () constReturns the list item's "What's This?" help text. See also setWhatsThis(), statusTip(), and toolTip(). void QListWidgetItem::write ( QDataStream & out ) const [virtual]Writes the item to stream out. Смотрите также read(). bool QListWidgetItem::operator< ( const QListWidgetItem & other ) const [virtual]Returns true if this item's text is less then other item's text; otherwise returns false. QListWidgetItem & QListWidgetItem::operator= ( const QListWidgetItem & other )Assigns other's data and flags to this item. Note that type() and listWidget() are not copied. This function is useful when reimplementing clone(). Связанные нечлены классаQDataStream & operator<< ( QDataStream & out, const QListWidgetItem & item )Writes the list widget item item to stream out. This operator uses QListWidgetItem::write(). Смотрите также Преобразование типов данных Qt в последовательный вид. QDataStream & operator>> ( QDataStream & in, QListWidgetItem & item )Reads a list widget item from stream in into item. This operator uses QListWidgetItem::read(). Смотрите также Преобразование типов данных Qt в последовательный вид. |
Попытка перевода Qt документации. Если есть желание присоединиться, или если есть замечания или пожелания, то заходите на форум: Перевод Qt документации на русский язык... Люди внесшие вклад в перевод: Команда переводчиков |