Struct qt_core::ItemDataRole

source ·
pub struct ItemDataRole(/* private fields */);
Expand description

Each item in the model has a set of data elements associated with it, each with its own role. The roles are used by the view to indicate to the model which type of data it needs. Custom models should return data in these types.

C++ enum: Qt::ItemDataRole.

C++ documentation:

Each item in the model has a set of data elements associated with it, each with its own role. The roles are used by the view to indicate to the model which type of data it needs. Custom models should return data in these types.

The general purpose roles (and the associated types) are:

Roles describing appearance and meta data (with associated types):

Accessibility roles (with associated types):

User roles:

For user roles, it is up to the developer to decide which types to use and ensure that components use the correct types when accessing and setting data.

Implementations§

source§

impl ItemDataRole

source

pub fn to_int(&self) -> c_int

source§

impl ItemDataRole

source

pub const DisplayRole: ItemDataRole = _

The key data to be rendered in the form of text. (QString) (C++ enum variant: DisplayRole = 0)

source

pub const DecorationRole: ItemDataRole = _

The data to be rendered as a decoration in the form of an icon. (QColor, QIcon or QPixmap) (C++ enum variant: DecorationRole = 1)

source

pub const EditRole: ItemDataRole = _

The data in a form suitable for editing in an editor. (QString) (C++ enum variant: EditRole = 2)

source

pub const ToolTipRole: ItemDataRole = _

The data displayed in the item’s tooltip. (QString) (C++ enum variant: ToolTipRole = 3)

source

pub const StatusTipRole: ItemDataRole = _

The data displayed in the status bar. (QString) (C++ enum variant: StatusTipRole = 4)

source

pub const WhatsThisRole: ItemDataRole = _

The data displayed for the item in “What’s This?” mode. (QString) (C++ enum variant: WhatsThisRole = 5)

source

pub const FontRole: ItemDataRole = _

The font used for items rendered with the default delegate. (QFont) (C++ enum variant: FontRole = 6)

source

pub const TextAlignmentRole: ItemDataRole = _

The alignment of the text for items rendered with the default delegate. (Qt::Alignment) (C++ enum variant: TextAlignmentRole = 7)

source

pub const BackgroundColorRole: ItemDataRole = _

This role is obsolete. Use BackgroundRole instead. (C++ enum variant: BackgroundColorRole = 8)

source

pub const BackgroundRole: ItemDataRole = _

The background brush used for items rendered with the default delegate. (QBrush) (C++ enum variant: BackgroundRole = 8)

source

pub const TextColorRole: ItemDataRole = _

This role is obsolete. Use ForegroundRole instead. (C++ enum variant: TextColorRole = 9)

source

pub const ForegroundRole: ItemDataRole = _

The foreground brush (text color, typically) used for items rendered with the default delegate. (QBrush) (C++ enum variant: ForegroundRole = 9)

source

pub const CheckStateRole: ItemDataRole = _

This role is used to obtain the checked state of an item. (Qt::CheckState) (C++ enum variant: CheckStateRole = 10)

source

pub const AccessibleTextRole: ItemDataRole = _

The text to be used by accessibility extensions and plugins, such as screen readers. (QString) (C++ enum variant: AccessibleTextRole = 11)

source

pub const AccessibleDescriptionRole: ItemDataRole = _

A description of the item for accessibility purposes. (QString) (C++ enum variant: AccessibleDescriptionRole = 12)

source

pub const SizeHintRole: ItemDataRole = _

The size hint for the item that will be supplied to views. (QSize) (C++ enum variant: SizeHintRole = 13)

source

pub const InitialSortOrderRole: ItemDataRole = _

This role is used to obtain the initial sort order of a header view section. (Qt::SortOrder). This role was introduced in Qt 4.8. (C++ enum variant: InitialSortOrderRole = 14)

source

pub const DisplayPropertyRole: ItemDataRole = _

C++ enum variant: DisplayPropertyRole = 27

source

pub const DecorationPropertyRole: ItemDataRole = _

C++ enum variant: DecorationPropertyRole = 28

source

pub const ToolTipPropertyRole: ItemDataRole = _

C++ enum variant: ToolTipPropertyRole = 29

source

pub const StatusTipPropertyRole: ItemDataRole = _

C++ enum variant: StatusTipPropertyRole = 30

source

pub const WhatsThisPropertyRole: ItemDataRole = _

C++ enum variant: WhatsThisPropertyRole = 31

source

pub const UserRole: ItemDataRole = _

The first role that can be used for application-specific purposes. (C++ enum variant: UserRole = 256)

Trait Implementations§

source§

impl Clone for ItemDataRole

source§

fn clone(&self) -> ItemDataRole

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for ItemDataRole

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl From<ItemDataRole> for c_int

source§

fn from(value: ItemDataRole) -> Self

Converts to this type from the input type.
source§

impl From<i32> for ItemDataRole

source§

fn from(value: c_int) -> Self

Converts to this type from the input type.
source§

impl PartialEq for ItemDataRole

source§

fn eq(&self, other: &ItemDataRole) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Copy for ItemDataRole

source§

impl Eq for ItemDataRole

source§

impl StructuralEq for ItemDataRole

source§

impl StructuralPartialEq for ItemDataRole

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T, U> CastInto<U> for T
where U: CastFrom<T>,

source§

unsafe fn cast_into(self) -> U

Performs the conversion. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

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

source§

impl<T> StaticUpcast<T> for T

source§

unsafe fn static_upcast(ptr: Ptr<T>) -> Ptr<T>

Convert type of a const pointer. Read more
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.