Struct QTableWidgetItem

Source
#[repr(C)]
pub struct QTableWidgetItem { /* private fields */ }
Expand description

The QTableWidgetItem class provides an item for use with the QTableWidget class.

C++ class: QTableWidgetItem.

C++ documentation:

The QTableWidgetItem class provides an item for use with the QTableWidget class.

Table items are used to hold pieces of information for table widgets. Items usually contain text, icons, or checkboxes

The QTableWidgetItem class is a convenience class that replaces the QTableItem class in Qt 3. It provides an item for use with the QTableWidget class.

Top-level items are constructed without a parent then inserted at the position specified by a pair of row and column numbers:

QTableWidgetItem *newItem = new QTableWidgetItem(tr(“%1”).arg( pow(row, column+1))); tableWidget->setItem(row, column, newItem);

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() with the appropriate value (see Qt::ItemFlags). Checkable items can be checked and unchecked with the setCheckState() function. The corresponding checkState() function indicates whether the item is currently checked.

Implementations§

Source§

impl QTableWidgetItem

Source

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

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

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

C++ documentation:

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

This function was introduced in Qt 4.2.

See also setBackground() and foreground().

Source

pub unsafe fn background_color(&self) -> CppBox<QColor>

This function is deprecated. Use background() instead.

Calls C++ function: QColor QTableWidgetItem::backgroundColor() const.

C++ documentation:

This function is deprecated. Use background() instead.

See also setBackgroundColor().

Source

pub unsafe fn check_state(&self) -> CheckState

Returns the checked state of the table item.

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

C++ documentation:

Returns the checked state of the table item.

See also setCheckState() and flags().

Source

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

Creates a copy of the item.

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

C++ documentation:

Creates a copy of the item.

Source

pub unsafe fn column(&self) -> c_int

Returns the column of the item in the table. If the item is not in a table, this function will return -1.

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

C++ documentation:

Returns the column of the item in the table. If the item is not in a table, this function will return -1.

This function was introduced in Qt 4.2.

See also row().

Source

pub unsafe fn copy_from( &self, other: impl CastInto<Ref<QTableWidgetItem>>, ) -> Ref<QTableWidgetItem>

Assigns other's data and flags to this item. Note that type() and tableWidget() are not copied.

Calls C++ function: QTableWidgetItem& QTableWidgetItem::operator=(const QTableWidgetItem& other).

C++ documentation:

Assigns other’s data and flags to this item. Note that type() and tableWidget() are not copied.

This function is useful when reimplementing clone().

See also data() and flags().

Source

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

Returns the item's data for the given role.

Calls C++ function: virtual QVariant QTableWidgetItem::data(int role) const.

C++ documentation:

Returns the item’s data for the given role.

See also setData().

Source

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

Returns the flags used to describe the item. These determine whether the item can be checked, edited, and selected.

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

C++ documentation:

Returns the flags used to describe the item. These determine whether the item can be checked, edited, and selected.

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 QTableWidgetItem::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 QTableWidgetItem::foreground() const.

C++ documentation:

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

This function was introduced in Qt 4.2.

See also setForeground() and background().

Source

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

Returns the item's icon.

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

C++ documentation:

Returns the item’s icon.

See also setIcon() and iconSize.

Source

pub unsafe fn is_selected(&self) -> bool

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

Calls C++ function: bool QTableWidgetItem::isSelected() const.

C++ documentation:

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

This function was introduced in Qt 4.2.

See also setSelected().

Source

pub unsafe fn from_int(type_: c_int) -> CppBox<QTableWidgetItem>

Constructs a table item of the specified type that does not belong to any table.

Calls C++ function: [constructor] void QTableWidgetItem::QTableWidgetItem(int type = …).

C++ documentation:

Constructs a table item of the specified type that does not belong to any table.

See also type().

Source

pub unsafe fn from_q_string_int( text: impl CastInto<Ref<QString>>, type_: c_int, ) -> CppBox<QTableWidgetItem>

Constructs a table item with the given text.

Calls C++ function: [constructor] void QTableWidgetItem::QTableWidgetItem(const QString& text, int type = …).

C++ documentation:

Constructs a table item with the given text.

See also type().

Source

pub unsafe fn from_q_icon_q_string_int( icon: impl CastInto<Ref<QIcon>>, text: impl CastInto<Ref<QString>>, type_: c_int, ) -> CppBox<QTableWidgetItem>

Constructs a table item with the given icon and text.

Calls C++ function: [constructor] void QTableWidgetItem::QTableWidgetItem(const QIcon& icon, const QString& text, int type = …).

C++ documentation:

Constructs a table item with the given icon and text.

See also type().

Source

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

The QTableWidgetItem class provides an item for use with the QTableWidget class.

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

C++ documentation:

The QTableWidgetItem class provides an item for use with the QTableWidget class.

Table items are used to hold pieces of information for table widgets. Items usually contain text, icons, or checkboxes

The QTableWidgetItem class is a convenience class that replaces the QTableItem class in Qt 3. It provides an item for use with the QTableWidget class.

Top-level items are constructed without a parent then inserted at the position specified by a pair of row and column numbers:

QTableWidgetItem *newItem = new QTableWidgetItem(tr(“%1”).arg( pow(row, column+1))); tableWidget->setItem(row, column, newItem);

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() with the appropriate value (see Qt::ItemFlags). Checkable items can be checked and unchecked with the setCheckState() function. The corresponding checkState() function indicates whether the item is currently checked.

Source

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

Constructs a table item with the given text.

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

C++ documentation:

Constructs a table item with the given text.

See also type().

Source

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

Constructs a table item with the given icon and text.

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

C++ documentation:

Constructs a table item with the given icon and text.

See also type().

Source

pub unsafe fn new_copy( other: impl CastInto<Ref<QTableWidgetItem>>, ) -> CppBox<QTableWidgetItem>

Constructs a copy of other. Note that type() and tableWidget() are not copied.

Calls C++ function: [constructor] void QTableWidgetItem::QTableWidgetItem(const QTableWidgetItem& other).

C++ documentation:

Constructs a copy of other. Note that type() and tableWidget() are not copied.

This function is useful when reimplementing clone().

This function was introduced in Qt 4.1.

See also data() and flags().

Source

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

Reads the item from stream in.

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

C++ documentation:

Reads the item from stream in.

See also write().

Source

pub unsafe fn row(&self) -> c_int

Returns the row of the item in the table. If the item is not in a table, this function will return -1.

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

C++ documentation:

Returns the row of the item in the table. If the item is not in a table, this function will return -1.

This function was introduced in Qt 4.2.

See also column().

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 QTableWidgetItem::setBackground(const QBrush& brush).

C++ documentation:

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

This function was introduced in Qt 4.2.

See also background() and setForeground().

Source

pub unsafe fn set_background_color(&self, color: impl CastInto<Ref<QColor>>)

This function is deprecated. Use setBackground() instead.

Calls C++ function: void QTableWidgetItem::setBackgroundColor(const QColor& color).

C++ documentation:

This function is deprecated. Use setBackground() instead.

See also backgroundColor().

Source

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

Sets the check state of the table item to be state.

Calls C++ function: void QTableWidgetItem::setCheckState(Qt::CheckState state).

C++ documentation:

Sets the check state of the table item to be state.

See also checkState().

Source

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

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

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

C++ documentation:

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

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

See also Qt::ItemDataRole and data().

Source

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

Sets the flags for the item to the given flags. These determine whether the item can be selected or modified.

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

C++ documentation:

Sets the flags for the item to the given flags. These determine whether the item can be selected or modified.

See also flags().

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 QTableWidgetItem::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 item's foreground brush to the specified brush.

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

C++ documentation:

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

This function was introduced in Qt 4.2.

See also foreground() and setBackground().

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 QTableWidgetItem::setIcon(const QIcon& icon).

C++ documentation:

Sets the item’s icon to the icon specified.

See also icon(), setText(), and iconSize.

Source

pub unsafe fn set_selected(&self, select: bool)

Sets the selected state of the item to select.

Calls C++ function: void QTableWidgetItem::setSelected(bool select).

C++ documentation:

Sets the selected state of the item to select.

This function was introduced in Qt 4.2.

See also isSelected().

Source

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

Sets the size hint for the table 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 QTableWidgetItem::setSizeHint(const QSize& size).

C++ documentation:

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

This function was introduced in Qt 4.1.

See also sizeHint().

Source

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

Sets the status tip for the table item to the text specified by statusTip. QTableWidget mouse tracking needs to be enabled for this feature to work.

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

C++ documentation:

Sets the status tip for the table item to the text specified by statusTip. QTableWidget mouse tracking needs to be enabled for this feature to work.

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 QTableWidgetItem::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, alignment: c_int)

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

Calls C++ function: void QTableWidgetItem::setTextAlignment(int alignment).

C++ documentation:

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

See also textAlignment() and Qt::Alignment.

Source

pub unsafe fn set_text_color(&self, color: impl CastInto<Ref<QColor>>)

This function is deprecated. Use setForeground() instead.

Calls C++ function: void QTableWidgetItem::setTextColor(const QColor& color).

C++ documentation:

This function is deprecated. Use setForeground() instead.

See also textColor().

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 QTableWidgetItem::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_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 QTableWidgetItem::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 table item.

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

C++ documentation:

Returns the size hint set for the table item.

This function was introduced in Qt 4.1.

See also setSizeHint().

Source

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

Returns the item's status tip.

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

C++ documentation:

Returns the item’s status tip.

See also setStatusTip().

Source

pub unsafe fn table_widget(&self) -> QPtr<QTableWidget>

Returns the table widget that contains the item.

Calls C++ function: QTableWidget* QTableWidgetItem::tableWidget() const.

C++ documentation:

Returns the table widget that contains the item.

Source

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

Returns the item's text.

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

C++ documentation:

Returns the item’s text.

See also setText().

Source

pub unsafe fn text_alignment(&self) -> c_int

Returns the text alignment for the item's text.

Calls C++ function: int QTableWidgetItem::textAlignment() const.

C++ documentation:

Returns the text alignment for the item’s text.

See also setTextAlignment() and Qt::Alignment.

Source

pub unsafe fn text_color(&self) -> CppBox<QColor>

This function is deprecated. Use foreground() instead.

Calls C++ function: QColor QTableWidgetItem::textColor() const.

C++ documentation:

This function is deprecated. Use foreground() instead.

See also setTextColor().

Source

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

Returns the item's tooltip.

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

C++ documentation:

Returns the item’s tooltip.

See also setToolTip().

Source

pub unsafe fn type_(&self) -> c_int

Returns the type passed to the QTableWidgetItem constructor.

Calls C++ function: int QTableWidgetItem::type() const.

C++ documentation:

Returns the type passed to the QTableWidgetItem constructor.

Source

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

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

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

C++ documentation:

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

See also setWhatsThis().

Source

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

Writes the item to stream out.

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

C++ documentation:

Writes the item to stream out.

See also read().

Trait Implementations§

Source§

impl CppDeletable for QTableWidgetItem

Source§

unsafe fn delete(&self)

Destroys the table item.

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

C++ documentation:

Destroys the table item.

Source§

impl Lt<Ref<QTableWidgetItem>> for QTableWidgetItem

Source§

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

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

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

C++ documentation:

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

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

Source§

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

Source§

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.