Struct qt_gui::QStandardItem

source ·
#[repr(C)]
pub struct QStandardItem { /* private fields */ }
Expand description

The QStandardItem class provides an item for use with the QStandardItemModel class.

C++ class: QStandardItem.

C++ documentation:

The QStandardItem class provides an item for use with the QStandardItemModel class.

Items usually contain text, icons, or checkboxes.

Each item can have its own background brush which is set with the setBackground() function. The current background brush can be found with background(). The text label for each item can be rendered with its own font and brush. These are specified with the setFont() and setForeground() functions, and read with font() and foreground().

By default, items are enabled, editable, selectable, checkable, and can be used both as the source of a drag and drop operation and as a drop target. Each item's flags can be changed by calling setFlags(). Checkable items can be checked and unchecked with the setCheckState() function. The corresponding checkState() function indicates whether the item is currently checked.

You can store application-specific data in an item by calling setData().

Each item can have a two-dimensional table of child items. This makes it possible to build hierarchies of items. The typical hierarchy is the tree, in which case the child table is a table with a single column (a list).

The dimensions of the child table can be set with setRowCount() and setColumnCount(). Items can be positioned in the child table with setChild(). Get a pointer to a child item with child(). New rows and columns of children can also be inserted with insertRow() and insertColumn(), or appended with appendRow() and appendColumn(). When using the append and insert functions, the dimensions of the child table will grow as needed.

An existing row of children can be removed with removeRow() or takeRow(); correspondingly, a column can be removed with removeColumn() or takeColumn().

An item's children can be sorted by calling sortChildren().

Implementations§

source§

impl QStandardItem

source

pub unsafe fn accessible_description(&self) -> CppBox<QString>

Returns the item's accessible description.

Calls C++ function: QString QStandardItem::accessibleDescription() const.

C++ documentation:

Returns the item’s accessible description.

The accessible description is used by assistive technologies (i.e. for users who cannot use conventional means of interaction).

See also setAccessibleDescription() and accessibleText().

source

pub unsafe fn accessible_text(&self) -> CppBox<QString>

Returns the item's accessible text.

Calls C++ function: QString QStandardItem::accessibleText() const.

C++ documentation:

Returns the item’s accessible text.

The accessible text is used by assistive technologies (i.e. for users who cannot use conventional means of interaction).

See also setAccessibleText() and accessibleDescription().

source

pub unsafe fn append_column( &self, items: impl CastInto<Ref<QListOfQStandardItem>> )

Appends a column containing items. If necessary, the row count is increased to the size of items.

Calls C++ function: void QStandardItem::appendColumn(const QList<QStandardItem*>& items).

C++ documentation:

Appends a column containing items. If necessary, the row count is increased to the size of items.

See also insertColumn().

source

pub unsafe fn append_row_q_list_of_q_standard_item( &self, items: impl CastInto<Ref<QListOfQStandardItem>> )

Appends a row containing items. If necessary, the column count is increased to the size of items.

Calls C++ function: void QStandardItem::appendRow(const QList<QStandardItem*>& items).

C++ documentation:

Appends a row containing items. If necessary, the column count is increased to the size of items.

See also insertRow().

source

pub unsafe fn append_row_q_standard_item( &self, item: impl CastInto<Ptr<QStandardItem>> )

This is an overloaded function.

Calls C++ function: void QStandardItem::appendRow(QStandardItem* item).

C++ documentation:

This is an overloaded function.

Appends a row containing item.

When building a list or a tree that has only one column, this function provides a convenient way to append a single new item.

source

pub unsafe fn append_rows( &self, items: impl CastInto<Ref<QListOfQStandardItem>> )

Appends rows containing items. The column count will not change.

Calls C++ function: void QStandardItem::appendRows(const QList<QStandardItem*>& items).

C++ documentation:

Appends rows containing items. The column count will not change.

See also insertRow().

source

pub unsafe fn background(&self) -> CppBox<QBrush>

Returns the brush used to render the item's background.

Calls C++ function: QBrush QStandardItem::background() const.

C++ documentation:

Returns the brush used to render the item’s background.

See also foreground() and setBackground().

source

pub unsafe fn check_state(&self) -> CheckState

Returns the checked state of the item.

Calls C++ function: Qt::CheckState QStandardItem::checkState() const.

C++ documentation:

Returns the checked state of the item.

See also setCheckState() and isCheckable().

source

pub unsafe fn child_2a(&self, row: c_int, column: c_int) -> Ptr<QStandardItem>

Returns the child item at (row, column) if one has been set; otherwise returns 0.

Calls C++ function: QStandardItem* QStandardItem::child(int row, int column = …) const.

C++ documentation:

Returns the child item at (row, column) if one has been set; otherwise returns 0.

See also setChild(), takeChild(), and parent().

source

pub unsafe fn child_1a(&self, row: c_int) -> Ptr<QStandardItem>

Returns the child item at (row, column) if one has been set; otherwise returns 0.

Calls C++ function: QStandardItem* QStandardItem::child(int row) const.

C++ documentation:

Returns the child item at (row, column) if one has been set; otherwise returns 0.

See also setChild(), takeChild(), and parent().

source

pub unsafe fn clear_data(&self)

Available on cpp_lib_version="5.12.2" or cpp_lib_version="5.13.0" or cpp_lib_version="5.14.0" only.

Removes all the data from all roles previously set.

Calls C++ function: void QStandardItem::clearData().

C++ documentation:

Removes all the data from all roles previously set.

This function was introduced in Qt 5.12.

See also data() and setData().

source

pub unsafe fn clone(&self) -> Ptr<QStandardItem>

Returns a copy of this item. The item's children are not copied.

Calls C++ function: virtual QStandardItem* QStandardItem::clone() const.

C++ documentation:

Returns a copy of this item. The item’s children are not copied.

When subclassing QStandardItem, you can reimplement this function to provide QStandardItemModel with a factory that it can use to create new items on demand.

See also QStandardItemModel::setItemPrototype() and operator=().

source

pub unsafe fn column(&self) -> c_int

Returns the column where the item is located in its parent's child table, or -1 if the item has no parent.

Calls C++ function: int QStandardItem::column() const.

C++ documentation:

Returns the column where the item is located in its parent’s child table, or -1 if the item has no parent.

See also row() and parent().

source

pub unsafe fn column_count(&self) -> c_int

Returns the number of child item columns that the item has.

Calls C++ function: int QStandardItem::columnCount() const.

C++ documentation:

Returns the number of child item columns that the item has.

See also setColumnCount() and rowCount().

source

pub unsafe fn data_1a(&self, role: c_int) -> CppBox<QVariant>

Returns the item's data for the given role, or an invalid QVariant if there is no data for the role.

Calls C++ function: virtual QVariant QStandardItem::data(int role = …) const.

C++ documentation:

Returns the item’s data for the given role, or an invalid QVariant if there is no data for the role.

Note: The default implementation treats Qt::EditRole and Qt::DisplayRole as referring to the same data.

See also setData().

source

pub unsafe fn data_0a(&self) -> CppBox<QVariant>

Returns the item's data for the given role, or an invalid QVariant if there is no data for the role.

Calls C++ function: virtual QVariant QStandardItem::data() const.

C++ documentation:

Returns the item’s data for the given role, or an invalid QVariant if there is no data for the role.

Note: The default implementation treats Qt::EditRole and Qt::DisplayRole as referring to the same data.

See also setData().

source

pub unsafe fn flags(&self) -> QFlags<ItemFlag>

Returns the item flags for the item.

Calls C++ function: QFlags<Qt::ItemFlag> QStandardItem::flags() const.

C++ documentation:

Returns the item flags for the item.

The item flags determine how the user can interact with the item.

By default, items are enabled, editable, selectable, checkable, and can be used both as the source of a drag and drop operation and as a drop target.

See also setFlags().

source

pub unsafe fn font(&self) -> CppBox<QFont>

Returns the font used to render the item's text.

Calls C++ function: QFont QStandardItem::font() const.

C++ documentation:

Returns the font used to render the item’s text.

See also setFont().

source

pub unsafe fn foreground(&self) -> CppBox<QBrush>

Returns the brush used to render the item's foreground (e.g. text).

Calls C++ function: QBrush QStandardItem::foreground() const.

C++ documentation:

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

See also setForeground() and background().

source

pub unsafe fn has_children(&self) -> bool

Returns true if this item has any children; otherwise returns false.

Calls C++ function: bool QStandardItem::hasChildren() const.

C++ documentation:

Returns true if this item has any children; otherwise returns false.

See also rowCount(), columnCount(), and child().

source

pub unsafe fn icon(&self) -> CppBox<QIcon>

Returns the item's icon.

Calls C++ function: QIcon QStandardItem::icon() const.

C++ documentation:

Returns the item’s icon.

See also setIcon() and iconSize.

source

pub unsafe fn index(&self) -> CppBox<QModelIndex>

Returns the QModelIndex associated with this item.

Calls C++ function: QModelIndex QStandardItem::index() const.

C++ documentation:

Returns the QModelIndex associated with this item.

When you need to invoke item functionality in a QModelIndex-based API (e.g. QAbstractItemView), you can call this function to obtain an index that corresponds to the item's location in the model.

If the item is not associated with a model, an invalid QModelIndex is returned.

See also model() and QStandardItemModel::itemFromIndex().

source

pub unsafe fn insert_column( &self, column: c_int, items: impl CastInto<Ref<QListOfQStandardItem>> )

Inserts a column at column containing items. If necessary, the row count is increased to the size of items.

Calls C++ function: void QStandardItem::insertColumn(int column, const QList<QStandardItem*>& items).

C++ documentation:

Inserts a column at column containing items. If necessary, the row count is increased to the size of items.

See also insertColumns() and insertRow().

source

pub unsafe fn insert_columns(&self, column: c_int, count: c_int)

Inserts count columns of child items at column column.

Calls C++ function: void QStandardItem::insertColumns(int column, int count).

C++ documentation:

Inserts count columns of child items at column column.

See also insertColumn() and insertRows().

source

pub unsafe fn insert_row_int_q_list_of_q_standard_item( &self, row: c_int, items: impl CastInto<Ref<QListOfQStandardItem>> )

Inserts a row at row containing items. If necessary, the column count is increased to the size of items.

Calls C++ function: void QStandardItem::insertRow(int row, const QList<QStandardItem*>& items).

C++ documentation:

Inserts a row at row containing items. If necessary, the column count is increased to the size of items.

See also insertRows() and insertColumn().

source

pub unsafe fn insert_row_int_q_standard_item( &self, row: c_int, item: impl CastInto<Ptr<QStandardItem>> )

This is an overloaded function.

Calls C++ function: void QStandardItem::insertRow(int row, QStandardItem* item).

C++ documentation:

This is an overloaded function.

Inserts a row at row containing item.

When building a list or a tree that has only one column, this function provides a convenient way to insert a single new item.

source

pub unsafe fn insert_rows_int_q_list_of_q_standard_item( &self, row: c_int, items: impl CastInto<Ref<QListOfQStandardItem>> )

Inserts items at row. The column count won't be changed.

Calls C++ function: void QStandardItem::insertRows(int row, const QList<QStandardItem*>& items).

C++ documentation:

Inserts items at row. The column count won’t be changed.

See also insertRow() and insertColumn().

source

pub unsafe fn insert_rows_2_int(&self, row: c_int, count: c_int)

Inserts count rows of child items at row row.

Calls C++ function: void QStandardItem::insertRows(int row, int count).

C++ documentation:

Inserts count rows of child items at row row.

See also insertRow() and insertColumns().

source

pub unsafe fn is_auto_tristate(&self) -> bool

Returns whether the item is tristate and is controlled by QTreeWidget.

Calls C++ function: bool QStandardItem::isAutoTristate() const.

C++ documentation:

Returns whether the item is tristate and is controlled by QTreeWidget.

The default value is false.

This function was introduced in Qt 5.6.

See also setAutoTristate(), isCheckable(), and checkState().

source

pub unsafe fn is_checkable(&self) -> bool

Returns whether the item is user-checkable.

Calls C++ function: bool QStandardItem::isCheckable() const.

C++ documentation:

Returns whether the item is user-checkable.

The default value is false.

See also setCheckable(), checkState(), isUserTristate(), and isAutoTristate().

source

pub unsafe fn is_drag_enabled(&self) -> bool

Returns whether the item is drag enabled. An item that is drag enabled can be dragged by the user.

Calls C++ function: bool QStandardItem::isDragEnabled() const.

C++ documentation:

Returns whether the item is drag enabled. An item that is drag enabled can be dragged by the user.

The default value is true.

Note that item dragging must be enabled in the view for dragging to work; see QAbstractItemView::dragEnabled.

See also setDragEnabled(), isDropEnabled(), and flags().

source

pub unsafe fn is_drop_enabled(&self) -> bool

Returns whether the item is drop enabled. When an item is drop enabled, it can be used as a drop target.

Calls C++ function: bool QStandardItem::isDropEnabled() const.

C++ documentation:

Returns whether the item is drop enabled. When an item is drop enabled, it can be used as a drop target.

The default value is true.

See also setDropEnabled(), isDragEnabled(), and flags().

source

pub unsafe fn is_editable(&self) -> bool

Returns whether the item can be edited by the user.

Calls C++ function: bool QStandardItem::isEditable() const.

C++ documentation:

Returns whether the item can be edited by the user.

When an item is editable (and enabled), the user can edit the item by invoking one of the view's edit triggers; see QAbstractItemView::editTriggers.

The default value is true.

See also setEditable() and flags().

source

pub unsafe fn is_enabled(&self) -> bool

Returns whether the item is enabled.

Calls C++ function: bool QStandardItem::isEnabled() const.

C++ documentation:

Returns whether the item is enabled.

When an item is enabled, the user can interact with it. The possible types of interaction are specified by the other item flags, such as isEditable() and isSelectable().

The default value is true.

See also setEnabled() and flags().

source

pub unsafe fn is_selectable(&self) -> bool

Returns whether the item is selectable by the user.

Calls C++ function: bool QStandardItem::isSelectable() const.

C++ documentation:

Returns whether the item is selectable by the user.

The default value is true.

See also setSelectable() and flags().

source

pub unsafe fn is_tristate(&self) -> bool

Use QStandardItem::isAutoTristate() instead. For a tristate checkbox that the user can change between all three states, use QStandardItem::isUserTristate() instead.

Calls C++ function: bool QStandardItem::isTristate() const.

C++ documentation:

Use QStandardItem::isAutoTristate() instead. For a tristate checkbox that the user can change between all three states, use QStandardItem::isUserTristate() instead.

source

pub unsafe fn is_user_tristate(&self) -> bool

Returns whether the item is tristate; that is, if it's checkable with three separate states and the user can cycle through all three states.

Calls C++ function: bool QStandardItem::isUserTristate() const.

C++ documentation:

Returns whether the item is tristate; that is, if it’s checkable with three separate states and the user can cycle through all three states.

The default value is false.

This function was introduced in Qt 5.6.

See also setUserTristate(), isCheckable(), and checkState().

source

pub unsafe fn model(&self) -> QPtr<QStandardItemModel>

Returns the QStandardItemModel that this item belongs to.

Calls C++ function: QStandardItemModel* QStandardItem::model() const.

C++ documentation:

Returns the QStandardItemModel that this item belongs to.

If the item is not a child of another item that belongs to the model, this function returns 0.

See also index().

source

pub unsafe fn new() -> CppBox<QStandardItem>

Constructs an item.

Calls C++ function: [constructor] void QStandardItem::QStandardItem().

C++ documentation:

Constructs an item.

source

pub unsafe fn from_q_string( text: impl CastInto<Ref<QString>> ) -> CppBox<QStandardItem>

Constructs an item with the given text.

Calls C++ function: [constructor] void QStandardItem::QStandardItem(const QString& text).

C++ documentation:

Constructs an item with the given text.

source

pub unsafe fn from_q_icon_q_string( icon: impl CastInto<Ref<QIcon>>, text: impl CastInto<Ref<QString>> ) -> CppBox<QStandardItem>

Constructs an item with the given icon and text.

Calls C++ function: [constructor] void QStandardItem::QStandardItem(const QIcon& icon, const QString& text).

C++ documentation:

Constructs an item with the given icon and text.

source

pub unsafe fn from_2_int(rows: c_int, columns: c_int) -> CppBox<QStandardItem>

Constructs an item with rows rows and columns columns of child items.

Calls C++ function: [constructor] void QStandardItem::QStandardItem(int rows, int columns = …).

C++ documentation:

Constructs an item with rows rows and columns columns of child items.

source

pub unsafe fn from_int(rows: c_int) -> CppBox<QStandardItem>

Constructs an item with rows rows and columns columns of child items.

Calls C++ function: [constructor] void QStandardItem::QStandardItem(int rows).

C++ documentation:

Constructs an item with rows rows and columns columns of child items.

source

pub unsafe fn parent(&self) -> Ptr<QStandardItem>

Returns the item's parent item, or 0 if the item has no parent.

Calls C++ function: QStandardItem* QStandardItem::parent() const.

C++ documentation:

Returns the item’s parent item, or 0 if the item has no parent.

Note: For toplevel items parent() returns 0. To receive toplevel item's parent use QStandardItemModel::invisibleRootItem() instead.

See also child() and QStandardItemModel::invisibleRootItem().

source

pub unsafe fn read(&self, in_: impl CastInto<Ref<QDataStream>>)

Reads the item from stream in. Only the data and flags of the item are read, not the child items.

Calls C++ function: virtual void QStandardItem::read(QDataStream& in).

C++ documentation:

Reads the item from stream in. Only the data and flags of the item are read, not the child items.

See also write().

source

pub unsafe fn remove_column(&self, column: c_int)

Removes the given column. The items that were in the column are deleted.

Calls C++ function: void QStandardItem::removeColumn(int column).

C++ documentation:

Removes the given column. The items that were in the column are deleted.

See also takeColumn(), removeColumns(), and removeRow().

source

pub unsafe fn remove_columns(&self, column: c_int, count: c_int)

Removes count columns at column column. The items that were in those columns are deleted.

Calls C++ function: void QStandardItem::removeColumns(int column, int count).

C++ documentation:

Removes count columns at column column. The items that were in those columns are deleted.

See also removeColumn() and removeRows().

source

pub unsafe fn remove_row(&self, row: c_int)

Removes the given row. The items that were in the row are deleted.

Calls C++ function: void QStandardItem::removeRow(int row).

C++ documentation:

Removes the given row. The items that were in the row are deleted.

See also takeRow(), removeRows(), and removeColumn().

source

pub unsafe fn remove_rows(&self, row: c_int, count: c_int)

Removes count rows at row row. The items that were in those rows are deleted.

Calls C++ function: void QStandardItem::removeRows(int row, int count).

C++ documentation:

Removes count rows at row row. The items that were in those rows are deleted.

See also removeRow() and removeColumn().

source

pub unsafe fn row(&self) -> c_int

Returns the row where the item is located in its parent's child table, or -1 if the item has no parent.

Calls C++ function: int QStandardItem::row() const.

C++ documentation:

Returns the row where the item is located in its parent’s child table, or -1 if the item has no parent.

See also column() and parent().

source

pub unsafe fn row_count(&self) -> c_int

Returns the number of child item rows that the item has.

Calls C++ function: int QStandardItem::rowCount() const.

C++ documentation:

Returns the number of child item rows that the item has.

See also setRowCount() and columnCount().

source

pub unsafe fn set_accessible_description( &self, accessible_description: impl CastInto<Ref<QString>> )

Sets the item's accessible description to the string specified by accessibleDescription.

Calls C++ function: void QStandardItem::setAccessibleDescription(const QString& accessibleDescription).

C++ documentation:

Sets the item’s accessible description to the string specified by accessibleDescription.

The accessible description is used by assistive technologies (i.e. for users who cannot use conventional means of interaction).

See also accessibleDescription() and setAccessibleText().

source

pub unsafe fn set_accessible_text( &self, accessible_text: impl CastInto<Ref<QString>> )

Sets the item's accessible text to the string specified by accessibleText.

Calls C++ function: void QStandardItem::setAccessibleText(const QString& accessibleText).

C++ documentation:

Sets the item’s accessible text to the string specified by accessibleText.

The accessible text is used by assistive technologies (i.e. for users who cannot use conventional means of interaction).

See also accessibleText() and setAccessibleDescription().

source

pub unsafe fn set_auto_tristate(&self, tristate: bool)

Determines that the item is tristate and controlled by QTreeWidget if tristate is true. This enables automatic management of the state of parent items in QTreeWidget (checked if all children are checked, unchecked if all children are unchecked, or partially checked if only some children are checked).

Calls C++ function: void QStandardItem::setAutoTristate(bool tristate).

C++ documentation:

Determines that the item is tristate and controlled by QTreeWidget if tristate is true. This enables automatic management of the state of parent items in QTreeWidget (checked if all children are checked, unchecked if all children are unchecked, or partially checked if only some children are checked).

This function was introduced in Qt 5.6.

See also isAutoTristate(), setCheckable(), and setCheckState().

source

pub unsafe fn set_background(&self, brush: impl CastInto<Ref<QBrush>>)

Sets the item's background brush to the specified brush.

Calls C++ function: void QStandardItem::setBackground(const QBrush& brush).

C++ documentation:

Sets the item’s background brush to the specified brush.

See also background() and setForeground().

source

pub unsafe fn set_check_state(&self, check_state: CheckState)

Sets the check state of the item to be state.

Calls C++ function: void QStandardItem::setCheckState(Qt::CheckState checkState).

C++ documentation:

Sets the check state of the item to be state.

See also checkState() and setCheckable().

source

pub unsafe fn set_checkable(&self, checkable: bool)

Sets whether the item is user-checkable. If checkable is true, the item can be checked by the user; otherwise, the user cannot check the item.

Calls C++ function: void QStandardItem::setCheckable(bool checkable).

C++ documentation:

Sets whether the item is user-checkable. If checkable is true, the item can be checked by the user; otherwise, the user cannot check the item.

The item delegate will render a checkable item with a check box next to the item's text.

See also isCheckable(), setCheckState(), setUserTristate(), and setAutoTristate().

source

pub unsafe fn set_child_3a( &self, row: c_int, column: c_int, item: impl CastInto<Ptr<QStandardItem>> )

Sets the child item at (row, column) to item. This item (the parent item) takes ownership of item. If necessary, the row count and column count are increased to fit the item.

Calls C++ function: void QStandardItem::setChild(int row, int column, QStandardItem* item).

C++ documentation:

Sets the child item at (row, column) to item. This item (the parent item) takes ownership of item. If necessary, the row count and column count are increased to fit the item.

Note: Passing a null pointer as item removes the item.

See also child().

source

pub unsafe fn set_child_2a( &self, row: c_int, item: impl CastInto<Ptr<QStandardItem>> )

This is an overloaded function.

Calls C++ function: void QStandardItem::setChild(int row, QStandardItem* item).

C++ documentation:

This is an overloaded function.

Sets the child at row to item.

source

pub unsafe fn set_column_count(&self, columns: c_int)

Sets the number of child item columns to columns. If this is less than columnCount(), the data in the unwanted columns is discarded.

Calls C++ function: void QStandardItem::setColumnCount(int columns).

C++ documentation:

Sets the number of child item columns to columns. If this is less than columnCount(), the data in the unwanted columns is discarded.

See also columnCount() and setRowCount().

source

pub unsafe fn set_data_2a( &self, value: impl CastInto<Ref<QVariant>>, role: c_int )

Sets the item's data for the given role to the specified value.

Calls C++ function: virtual void QStandardItem::setData(const QVariant& value, int role = …).

C++ documentation:

Sets the item’s data for the given role to the specified value.

If you subclass QStandardItem and reimplement this function, your reimplementation should call emitDataChanged() if you do not call the base implementation of setData(). This will ensure that e.g. views using the model are notified of the changes.

Note: The default implementation treats Qt::EditRole and Qt::DisplayRole as referring to the same data.

See also Qt::ItemDataRole, data(), and setFlags().

source

pub unsafe fn set_data_1a(&self, value: impl CastInto<Ref<QVariant>>)

Sets the item's data for the given role to the specified value.

Calls C++ function: virtual void QStandardItem::setData(const QVariant& value).

C++ documentation:

Sets the item’s data for the given role to the specified value.

If you subclass QStandardItem and reimplement this function, your reimplementation should call emitDataChanged() if you do not call the base implementation of setData(). This will ensure that e.g. views using the model are notified of the changes.

Note: The default implementation treats Qt::EditRole and Qt::DisplayRole as referring to the same data.

See also Qt::ItemDataRole, data(), and setFlags().

source

pub unsafe fn set_drag_enabled(&self, drag_enabled: bool)

Sets whether the item is drag enabled. If dragEnabled is true, the item can be dragged by the user; otherwise, the user cannot drag the item.

Calls C++ function: void QStandardItem::setDragEnabled(bool dragEnabled).

C++ documentation:

Sets whether the item is drag enabled. If dragEnabled is true, the item can be dragged by the user; otherwise, the user cannot drag the item.

Note that you also need to ensure that item dragging is enabled in the view; see QAbstractItemView::dragEnabled.

See also isDragEnabled(), setDropEnabled(), and setFlags().

source

pub unsafe fn set_drop_enabled(&self, drop_enabled: bool)

Sets whether the item is drop enabled. If dropEnabled is true, the item can be used as a drop target; otherwise, it cannot.

Calls C++ function: void QStandardItem::setDropEnabled(bool dropEnabled).

C++ documentation:

Sets whether the item is drop enabled. If dropEnabled is true, the item can be used as a drop target; otherwise, it cannot.

Note that you also need to ensure that drops are enabled in the view; see QWidget::acceptDrops(); and that the model supports the desired drop actions; see QAbstractItemModel::supportedDropActions().

See also isDropEnabled(), setDragEnabled(), and setFlags().

source

pub unsafe fn set_editable(&self, editable: bool)

Sets whether the item is editable. If editable is true, the item can be edited by the user; otherwise, the user cannot edit the item.

Calls C++ function: void QStandardItem::setEditable(bool editable).

C++ documentation:

Sets whether the item is editable. If editable is true, the item can be edited by the user; otherwise, the user cannot edit the item.

How the user can edit items in a view is determined by the view's edit triggers; see QAbstractItemView::editTriggers.

See also isEditable() and setFlags().

source

pub unsafe fn set_enabled(&self, enabled: bool)

Sets whether the item is enabled. If enabled is true, the item is enabled, meaning that the user can interact with the item; if enabled is false, the user cannot interact with the item.

Calls C++ function: void QStandardItem::setEnabled(bool enabled).

C++ documentation:

Sets whether the item is enabled. If enabled is true, the item is enabled, meaning that the user can interact with the item; if enabled is false, the user cannot interact with the item.

This flag takes precedence over the other item flags; e.g. if an item is not enabled, it cannot be selected by the user, even if the Qt::ItemIsSelectable flag has been set.

See also isEnabled(), Qt::ItemIsEnabled, and setFlags().

source

pub unsafe fn set_flags(&self, flags: QFlags<ItemFlag>)

Sets the item flags for the item to flags.

Calls C++ function: void QStandardItem::setFlags(QFlags<Qt::ItemFlag> flags).

C++ documentation:

Sets the item flags for the item to flags.

The item flags determine how the user can interact with the item. This is often used to disable an item.

See also flags() and setData().

source

pub unsafe fn set_font(&self, font: impl CastInto<Ref<QFont>>)

Sets the font used to display the item's text to the given font.

Calls C++ function: void QStandardItem::setFont(const QFont& font).

C++ documentation:

Sets the font used to display the item’s text to the given font.

See also font(), setText(), and setForeground().

source

pub unsafe fn set_foreground(&self, brush: impl CastInto<Ref<QBrush>>)

Sets the brush used to display the item's foreground (e.g. text) to the given brush.

Calls C++ function: void QStandardItem::setForeground(const QBrush& brush).

C++ documentation:

Sets the brush used to display the item’s foreground (e.g. text) to the given brush.

See also foreground(), setBackground(), and setFont().

source

pub unsafe fn set_icon(&self, icon: impl CastInto<Ref<QIcon>>)

Sets the item's icon to the icon specified.

Calls C++ function: void QStandardItem::setIcon(const QIcon& icon).

C++ documentation:

Sets the item’s icon to the icon specified.

See also icon().

source

pub unsafe fn set_row_count(&self, rows: c_int)

Sets the number of child item rows to rows. If this is less than rowCount(), the data in the unwanted rows is discarded.

Calls C++ function: void QStandardItem::setRowCount(int rows).

C++ documentation:

Sets the number of child item rows to rows. If this is less than rowCount(), the data in the unwanted rows is discarded.

See also rowCount() and setColumnCount().

source

pub unsafe fn set_selectable(&self, selectable: bool)

Sets whether the item is selectable. If selectable is true, the item can be selected by the user; otherwise, the user cannot select the item.

Calls C++ function: void QStandardItem::setSelectable(bool selectable).

C++ documentation:

Sets whether the item is selectable. If selectable is true, the item can be selected by the user; otherwise, the user cannot select the item.

You can control the selection behavior and mode by manipulating their view properties; see QAbstractItemView::selectionMode and QAbstractItemView::selectionBehavior.

See also isSelectable() and setFlags().

source

pub unsafe fn set_size_hint(&self, size_hint: impl CastInto<Ref<QSize>>)

Sets the size hint for the item to be size. If no size hint is set, the item delegate will compute the size hint based on the item data.

Calls C++ function: void QStandardItem::setSizeHint(const QSize& sizeHint).

C++ documentation:

Sets the size hint for the item to be size. If no size hint is set, the item delegate will compute the size hint based on the item data.

See also sizeHint().

source

pub unsafe fn set_status_tip(&self, status_tip: impl CastInto<Ref<QString>>)

Sets the item's status tip to the string specified by statusTip.

Calls C++ function: void QStandardItem::setStatusTip(const QString& statusTip).

C++ documentation:

Sets the item’s status tip to the string specified by statusTip.

See also statusTip(), setToolTip(), and setWhatsThis().

source

pub unsafe fn set_text(&self, text: impl CastInto<Ref<QString>>)

Sets the item's text to the text specified.

Calls C++ function: void QStandardItem::setText(const QString& text).

C++ documentation:

Sets the item’s text to the text specified.

See also text(), setFont(), and setForeground().

source

pub unsafe fn set_text_alignment(&self, text_alignment: QFlags<AlignmentFlag>)

Sets the text alignment for the item's text to the alignment specified.

Calls C++ function: void QStandardItem::setTextAlignment(QFlags<Qt::AlignmentFlag> textAlignment).

C++ documentation:

Sets the text alignment for the item’s text to the alignment specified.

See also textAlignment().

source

pub unsafe fn set_tool_tip(&self, tool_tip: impl CastInto<Ref<QString>>)

Sets the item's tooltip to the string specified by toolTip.

Calls C++ function: void QStandardItem::setToolTip(const QString& toolTip).

C++ documentation:

Sets the item’s tooltip to the string specified by toolTip.

See also toolTip(), setStatusTip(), and setWhatsThis().

source

pub unsafe fn set_tristate(&self, tristate: bool)

Use QStandardItem::setAutoTristate(bool tristate) instead. For a tristate checkbox that the user can change between all three states, use QStandardItem::setUserTristate(bool tristate) instead.

Calls C++ function: void QStandardItem::setTristate(bool tristate).

C++ documentation:

Use QStandardItem::setAutoTristate(bool tristate) instead. For a tristate checkbox that the user can change between all three states, use QStandardItem::setUserTristate(bool tristate) instead.

See also isTristate().

source

pub unsafe fn set_user_tristate(&self, tristate: bool)

Sets whether the item is tristate and controlled by the user. If tristate is true, the user can cycle through three separate states; otherwise, the item is checkable with two states. (Note that this also requires that the item is checkable; see isCheckable().)

Calls C++ function: void QStandardItem::setUserTristate(bool tristate).

C++ documentation:

Sets whether the item is tristate and controlled by the user. If tristate is true, the user can cycle through three separate states; otherwise, the item is checkable with two states. (Note that this also requires that the item is checkable; see isCheckable().)

This function was introduced in Qt 5.6.

See also isUserTristate(), setCheckable(), and setCheckState().

source

pub unsafe fn set_whats_this(&self, whats_this: impl CastInto<Ref<QString>>)

Sets the item's "What's This?" help to the string specified by whatsThis.

Calls C++ function: void QStandardItem::setWhatsThis(const QString& whatsThis).

C++ documentation:

Sets the item’s “What’s This?” help to the string specified by whatsThis.

See also whatsThis(), setStatusTip(), and setToolTip().

source

pub unsafe fn size_hint(&self) -> CppBox<QSize>

Returns the size hint set for the item, or an invalid QSize if no size hint has been set.

Calls C++ function: QSize QStandardItem::sizeHint() const.

C++ documentation:

Returns the size hint set for the item, or an invalid QSize if no size hint has been set.

If no size hint has been set, the item delegate will compute the size hint based on the item data.

See also setSizeHint().

source

pub unsafe fn sort_children_2a(&self, column: c_int, order: SortOrder)

Sorts the children of the item using the given order, by the values in the given column.

Calls C++ function: void QStandardItem::sortChildren(int column, Qt::SortOrder order = …).

C++ documentation:

Sorts the children of the item using the given order, by the values in the given column.

Note: This function is recursive, therefore it sorts the children of the item, its grandchildren, etc.

See also operator<().

source

pub unsafe fn sort_children_1a(&self, column: c_int)

Sorts the children of the item using the given order, by the values in the given column.

Calls C++ function: void QStandardItem::sortChildren(int column).

C++ documentation:

Sorts the children of the item using the given order, by the values in the given column.

Note: This function is recursive, therefore it sorts the children of the item, its grandchildren, etc.

See also operator<().

source

pub unsafe fn status_tip(&self) -> CppBox<QString>

Returns the item's status tip.

Calls C++ function: QString QStandardItem::statusTip() const.

C++ documentation:

Returns the item’s status tip.

See also setStatusTip(), toolTip(), and whatsThis().

source

pub unsafe fn take_child_2a( &self, row: c_int, column: c_int ) -> Ptr<QStandardItem>

Removes the child item at (row, column) without deleting it, and returns a pointer to the item. If there was no child at the given location, then this function returns 0.

Calls C++ function: QStandardItem* QStandardItem::takeChild(int row, int column = …).

C++ documentation:

Removes the child item at (row, column) without deleting it, and returns a pointer to the item. If there was no child at the given location, then this function returns 0.

Note that this function, unlike takeRow() and takeColumn(), does not affect the dimensions of the child table.

See also child(), takeRow(), and takeColumn().

source

pub unsafe fn take_child_1a(&self, row: c_int) -> Ptr<QStandardItem>

Removes the child item at (row, column) without deleting it, and returns a pointer to the item. If there was no child at the given location, then this function returns 0.

Calls C++ function: QStandardItem* QStandardItem::takeChild(int row).

C++ documentation:

Removes the child item at (row, column) without deleting it, and returns a pointer to the item. If there was no child at the given location, then this function returns 0.

Note that this function, unlike takeRow() and takeColumn(), does not affect the dimensions of the child table.

See also child(), takeRow(), and takeColumn().

source

pub unsafe fn take_column(&self, column: c_int) -> CppBox<QListOfQStandardItem>

Removes column without deleting the column items, and returns a list of pointers to the removed items. For items in the column that have not been set, the corresponding pointers in the list will be 0.

Calls C++ function: QList<QStandardItem*> QStandardItem::takeColumn(int column).

C++ documentation:

Removes column without deleting the column items, and returns a list of pointers to the removed items. For items in the column that have not been set, the corresponding pointers in the list will be 0.

See also removeColumn(), insertColumn(), and takeRow().

source

pub unsafe fn take_row(&self, row: c_int) -> CppBox<QListOfQStandardItem>

Removes row without deleting the row items, and returns a list of pointers to the removed items. For items in the row that have not been set, the corresponding pointers in the list will be 0.

Calls C++ function: QList<QStandardItem*> QStandardItem::takeRow(int row).

C++ documentation:

Removes row without deleting the row items, and returns a list of pointers to the removed items. For items in the row that have not been set, the corresponding pointers in the list will be 0.

See also removeRow(), insertRow(), and takeColumn().

source

pub unsafe fn text(&self) -> CppBox<QString>

Returns the item's text. This is the text that's presented to the user in a view.

Calls C++ function: QString QStandardItem::text() const.

C++ documentation:

Returns the item’s text. This is the text that’s presented to the user in a view.

See also setText().

source

pub unsafe fn text_alignment(&self) -> QFlags<AlignmentFlag>

Returns the text alignment for the item's text.

Calls C++ function: QFlags<Qt::AlignmentFlag> QStandardItem::textAlignment() const.

C++ documentation:

Returns the text alignment for the item’s text.

See also setTextAlignment().

source

pub unsafe fn tool_tip(&self) -> CppBox<QString>

Returns the item's tooltip.

Calls C++ function: QString QStandardItem::toolTip() const.

C++ documentation:

Returns the item’s tooltip.

See also setToolTip(), statusTip(), and whatsThis().

source

pub unsafe fn type_(&self) -> c_int

Returns the type of this item. The type is used to distinguish custom items from the base class. When subclassing QStandardItem, you should reimplement this function and return a new value greater than or equal to UserType.

Calls C++ function: virtual int QStandardItem::type() const.

C++ documentation:

Returns the type of this item. The type is used to distinguish custom items from the base class. When subclassing QStandardItem, you should reimplement this function and return a new value greater than or equal to UserType.

See also QStandardItem::Type.

source

pub unsafe fn whats_this(&self) -> CppBox<QString>

Returns the item's "What's This?" help.

Calls C++ function: QString QStandardItem::whatsThis() const.

C++ documentation:

Returns the item’s “What’s This?” help.

See also setWhatsThis(), toolTip(), and statusTip().

source

pub unsafe fn write(&self, out: impl CastInto<Ref<QDataStream>>)

Writes the item to stream out. Only the data and flags of the item are written, not the child items.

Calls C++ function: virtual void QStandardItem::write(QDataStream& out) const.

C++ documentation:

Writes the item to stream out. Only the data and flags of the item are written, not the child items.

See also read().

Trait Implementations§

source§

impl CppDeletable for QStandardItem

source§

unsafe fn delete(&self)

Destructs the item. This causes the item's children to be destructed as well.

Calls C++ function: virtual [destructor] void QStandardItem::~QStandardItem().

C++ documentation:

Destructs the item. This causes the item’s children to be destructed as well.

source§

impl Lt<Ref<QStandardItem>> for QStandardItem

source§

unsafe fn lt(&self, other: &Ref<QStandardItem>) -> bool

Returns true if this item is less than other; otherwise returns false.

Calls C++ function: virtual bool QStandardItem::operator<(const QStandardItem& other) const.

C++ documentation:

Returns true if this item is less than other; otherwise returns false.

The default implementation uses the data for the item's sort role (see QStandardItemModel::sortRole) to perform the comparison if the item belongs to a model; otherwise, the data for the item's Qt::DisplayRole (text()) is used to perform the comparison.

sortChildren() and QStandardItemModel::sort() use this function when sorting items. If you want custom sorting, you can subclass QStandardItem and reimplement this function.

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, 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.