pub struct ListWidgetItem<'a> { /* private fields */ }
Expand description

Notice these docs are heavy WIP and not very relevent yet

A ListWidgetItem represents a single item in a ListWidget. 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 ListView class with a standard model.

List items can be inserted automatically into a list, when they are constructed, by specifying the list widget:

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 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().

Subclassing

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: ListWidget {Model/View Programming} [TreeWidgetItem] [TableWidgetItem]

Licence

The documentation is an adoption of the original Qt Documentation and provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation.

Implementations

Returns the list widget containing the item.

Sets the selected state of the item to select.

See also: [is_selected()]

Returns true if the item is selected; otherwise returns false.

See also: [set_selected()]

Hides the item if hide is true; otherwise shows the item.

See also: [is_hidden()]

Returns true if the item is hidden; otherwise returns false.

See also: [set_hidden()]

Returns the item flags for this item (see Qt::ItemFlags ).

Sets the item flags for the list item to flags.

See also: [t::item_flags()]

Returns the list item’s text.

See also: [set_text()]

Returns the text alignment for the list item.

See also: [t::alignment_flag()]

Returns the color used to display the list item’s text.

This function is deprecated. Use foreground() instead.

Sets the text for the list widget item’s to the given text.

See also: [text()]

Sets the list item’s text alignment to alignment.

See also: [t::alignment_flag()]

This function is deprecated. Use setForeground() instead.

Returns the list item’s icon.

See also: [set_icon()] {QAbstractItemView::iconSize}{iconSize}

Sets the icon for the list item to the given icon.

See also: [icon()] [text()] {QAbstractItemView::iconSize}{iconSize}

Returns the list item’s status tip.

See also: [set_status_tip()]

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: [status_tip()] [set_tool_tip()] [set_whats_this()] Widget::set_mouse_tracking

Returns the list item’s tooltip.

See also: [set_tool_tip()] [status_tip()] [whats_this()]

Sets the tooltip for the list item to the text specified by toolTip.

See also: [tool_tip()] [set_status_tip()] [set_whats_this()]

Returns the list item’s help text.

See also: [set_whats_this()] [status_tip()] [tool_tip()]

Sets the help for the list item to the text specified by whatsThis.

See also: [whats_this()] [set_status_tip()] [set_tool_tip()]

Returns the font used to display this list item’s text.

Sets the font used when painting the item to the given font.

Returns the text alignment for the list item.

See also: [t::alignment_flag()]

Sets the list item’s text alignment to alignment.

See also: [t::alignment_flag()]

Returns the brush used to display the list item’s background.

See also: [set_background()] [foreground()]

This function is deprecated. Use setBackground() instead.

Sets the background brush of the list item to the given brush.

See also: [background()] [set_foreground()]

Returns the color used to display the list item’s text.

This function is deprecated. Use foreground() instead.

This function is deprecated. Use setForeground() instead.

Returns the brush used to display the list item’s foreground (e.g. text).

See also: [set_foreground()] [background()]

Sets the foreground brush of the list item to the given brush.

See also: [foreground()] [set_background()]

Returns the checked state of the list item (see Qt::CheckState ).

See also: [flags()]

Sets the check state of the list item to state.

See also: [check_state()]

Returns the size hint set for the list item.

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.

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.