Struct rute::auto::list_widget_item::ListWidgetItem
source · 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
sourceimpl<'a> ListWidgetItem<'a>
impl<'a> ListWidgetItem<'a>
pub fn new() -> ListWidgetItem<'a>
sourcepub fn list_widget(&self) -> Option<ListWidget<'_>>
pub fn list_widget(&self) -> Option<ListWidget<'_>>
Returns the list widget containing the item.
sourcepub fn set_selected(&self, select: bool) -> &Self
pub fn set_selected(&self, select: bool) -> &Self
Sets the selected state of the item to select.
See also: [is_selected()
]
sourcepub fn is_selected(&self) -> bool
pub fn is_selected(&self) -> bool
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()
]
sourcepub fn flags(&self) -> ItemFlags
pub fn flags(&self) -> ItemFlags
Returns the item flags for this item (see Qt::ItemFlags ).
sourcepub fn set_flags(&self, flags: ItemFlags) -> &Self
pub fn set_flags(&self, flags: ItemFlags) -> &Self
Sets the item flags for the list item to flags.
See also: [t::item_flags()
]
sourcepub fn text(&self) -> String
pub fn text(&self) -> String
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.
sourcepub fn set_text(&self, text: &str) -> &Self
pub fn set_text(&self, text: &str) -> &Self
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.
sourcepub fn icon(&self) -> Icon<'_>
pub fn icon(&self) -> Icon<'_>
Returns the list item’s icon.
See also: [set_icon()
]
{QAbstractItemView::iconSize}{iconSize}
sourcepub fn set_icon<I: IconTrait<'a>>(&self, icon: &I) -> &Self
pub fn set_icon<I: IconTrait<'a>>(&self, icon: &I) -> &Self
Sets the icon for the list item to the given icon.
See also: [icon()
]
[text()
]
{QAbstractItemView::iconSize}{iconSize}
sourcepub fn status_tip(&self) -> String
pub fn status_tip(&self) -> String
Returns the list item’s status tip.
See also: [set_status_tip()
]
sourcepub fn set_status_tip(&self, status_tip: &str) -> &Self
pub fn set_status_tip(&self, status_tip: &str) -> &Self
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
sourcepub fn tool_tip(&self) -> String
pub fn tool_tip(&self) -> String
Returns the list item’s tooltip.
See also: [set_tool_tip()
]
[status_tip()
]
[whats_this()
]
sourcepub fn set_tool_tip(&self, tool_tip: &str) -> &Self
pub fn set_tool_tip(&self, tool_tip: &str) -> &Self
Sets the tooltip for the list item to the text specified by toolTip.
See also: [tool_tip()
]
[set_status_tip()
]
[set_whats_this()
]
sourcepub fn whats_this(&self) -> String
pub fn whats_this(&self) -> String
Returns the list item’s help text.
See also: [set_whats_this()
]
[status_tip()
]
[tool_tip()
]
sourcepub fn set_whats_this(&self, whats_this: &str) -> &Self
pub fn set_whats_this(&self, whats_this: &str) -> &Self
Sets the help for the list item to the text specified by whatsThis.
See also: [whats_this()
]
[set_status_tip()
]
[set_tool_tip()
]
sourcepub fn set_font<F: FontTrait<'a>>(&self, font: &F) -> &Self
pub fn set_font<F: FontTrait<'a>>(&self, font: &F) -> &Self
Sets the font used when painting the item to the given font.
sourcepub fn text_alignment(&self) -> i32
pub fn text_alignment(&self) -> i32
Returns the text alignment for the list item.
See also: [t::alignment_flag()
]
sourcepub fn set_text_alignment(&self, alignment: i32) -> &Self
pub fn set_text_alignment(&self, alignment: i32) -> &Self
Sets the list item’s text alignment to alignment.
See also: [t::alignment_flag()
]
sourcepub fn background(&self) -> Brush<'_>
pub fn background(&self) -> Brush<'_>
Returns the brush used to display the list item’s background.
See also: [set_background()
]
[foreground()
]
sourcepub fn set_background<B: BrushTrait<'a>>(&self, brush: &B) -> &Self
pub fn set_background<B: BrushTrait<'a>>(&self, brush: &B) -> &Self
This function is deprecated. Use setBackground() instead.
Sets the background brush of the list item to the given brush.
See also: [background()
]
[set_foreground()
]
sourcepub fn text_color(&self) -> Color<'_>
pub fn text_color(&self) -> Color<'_>
Returns the color used to display the list item’s text.
This function is deprecated. Use foreground() instead.
sourcepub fn set_text_color<C: ColorTrait<'a>>(&self, color: &C) -> &Self
pub fn set_text_color<C: ColorTrait<'a>>(&self, color: &C) -> &Self
This function is deprecated. Use setForeground() instead.
sourcepub fn foreground(&self) -> Brush<'_>
pub fn foreground(&self) -> Brush<'_>
Returns the brush used to display the list item’s foreground (e.g. text).
See also: [set_foreground()
]
[background()
]
sourcepub fn set_foreground<B: BrushTrait<'a>>(&self, brush: &B) -> &Self
pub fn set_foreground<B: BrushTrait<'a>>(&self, brush: &B) -> &Self
Sets the foreground brush of the list item to the given brush.
See also: [foreground()
]
[set_background()
]
sourcepub fn check_state(&self) -> CheckState
pub fn check_state(&self) -> CheckState
Returns the checked state of the list item (see Qt::CheckState ).
See also: [flags()
]
sourcepub fn set_check_state(&self, state: CheckState) -> &Self
pub fn set_check_state(&self, state: CheckState) -> &Self
Sets the check state of the list item to state.
See also: [check_state()
]
sourcepub fn set_size_hint<S: SizeTrait<'a>>(&self, size: &S) -> &Self
pub fn set_size_hint<S: SizeTrait<'a>>(&self, size: &S) -> &Self
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.
pub fn build(&self) -> Self
Trait Implementations
sourceimpl<'a> Clone for ListWidgetItem<'a>
impl<'a> Clone for ListWidgetItem<'a>
sourcefn clone(&self) -> ListWidgetItem<'a>
fn clone(&self) -> ListWidgetItem<'a>
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more