#[repr(C)]pub struct QTableWidgetItem { /* private fields */ }
Expand description
The QTableWidgetItem class provides an item for use with the QTableWidget class.
C++ class: QTableWidgetItem
.
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
impl QTableWidgetItem
Sourcepub unsafe fn background(&self) -> CppBox<QBrush>
pub unsafe fn background(&self) -> CppBox<QBrush>
Returns the brush used to render the item's background.
Calls C++ function: QBrush QTableWidgetItem::background() const
.
Returns the brush used to render the item’s background.
This function was introduced in Qt 4.2.
See also setBackground() and foreground().
Sourcepub unsafe fn background_color(&self) -> CppBox<QColor>
pub unsafe fn background_color(&self) -> CppBox<QColor>
This function is deprecated. Use background() instead.
Calls C++ function: QColor QTableWidgetItem::backgroundColor() const
.
This function is deprecated. Use background() instead.
See also setBackgroundColor().
Sourcepub unsafe fn check_state(&self) -> CheckState
pub unsafe fn check_state(&self) -> CheckState
Returns the checked state of the table item.
Calls C++ function: Qt::CheckState QTableWidgetItem::checkState() const
.
Returns the checked state of the table item.
See also setCheckState() and flags().
Sourcepub unsafe fn clone(&self) -> Ptr<QTableWidgetItem>
pub unsafe fn clone(&self) -> Ptr<QTableWidgetItem>
Creates a copy of the item.
Calls C++ function: virtual QTableWidgetItem* QTableWidgetItem::clone() const
.
Creates a copy of the item.
Sourcepub unsafe fn column(&self) -> c_int
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
.
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().
Sourcepub unsafe fn copy_from(
&self,
other: impl CastInto<Ref<QTableWidgetItem>>,
) -> Ref<QTableWidgetItem>
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)
.
Assigns other’s data and flags to this item. Note that type() and tableWidget() are not copied.
This function is useful when reimplementing clone().
Sourcepub unsafe fn data(&self, role: c_int) -> CppBox<QVariant>
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
.
Returns the item’s data for the given role.
See also setData().
Sourcepub unsafe fn flags(&self) -> QFlags<ItemFlag>
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
.
Returns the flags used to describe the item. These determine whether the item can be checked, edited, and selected.
See also setFlags().
Sourcepub unsafe fn font(&self) -> CppBox<QFont>
pub unsafe fn font(&self) -> CppBox<QFont>
Returns the font used to render the item's text.
Calls C++ function: QFont QTableWidgetItem::font() const
.
Returns the font used to render the item’s text.
See also setFont().
Sourcepub unsafe fn foreground(&self) -> CppBox<QBrush>
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
.
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().
Sourcepub unsafe fn icon(&self) -> CppBox<QIcon>
pub unsafe fn icon(&self) -> CppBox<QIcon>
Returns the item's icon.
Calls C++ function: QIcon QTableWidgetItem::icon() const
.
Sourcepub unsafe fn is_selected(&self) -> bool
pub unsafe fn is_selected(&self) -> bool
Returns true
if the item is selected, otherwise returns false
.
Calls C++ function: bool QTableWidgetItem::isSelected() const
.
Returns true
if the item is selected, otherwise returns false
.
This function was introduced in Qt 4.2.
See also setSelected().
Sourcepub unsafe fn from_int(type_: c_int) -> CppBox<QTableWidgetItem>
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 = …)
.
Constructs a table item of the specified type that does not belong to any table.
See also type().
Sourcepub unsafe fn from_q_string_int(
text: impl CastInto<Ref<QString>>,
type_: c_int,
) -> CppBox<QTableWidgetItem>
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 = …)
.
Constructs a table item with the given text.
See also type().
Sourcepub unsafe fn from_q_icon_q_string_int(
icon: impl CastInto<Ref<QIcon>>,
text: impl CastInto<Ref<QString>>,
type_: c_int,
) -> CppBox<QTableWidgetItem>
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 = …)
.
Constructs a table item with the given icon and text.
See also type().
Sourcepub unsafe fn new() -> CppBox<QTableWidgetItem>
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()
.
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.
Sourcepub unsafe fn from_q_string(
text: impl CastInto<Ref<QString>>,
) -> CppBox<QTableWidgetItem>
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)
.
Constructs a table item with the given text.
See also type().
Sourcepub unsafe fn from_q_icon_q_string(
icon: impl CastInto<Ref<QIcon>>,
text: impl CastInto<Ref<QString>>,
) -> CppBox<QTableWidgetItem>
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)
.
Constructs a table item with the given icon and text.
See also type().
Sourcepub unsafe fn new_copy(
other: impl CastInto<Ref<QTableWidgetItem>>,
) -> CppBox<QTableWidgetItem>
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)
.
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.
Sourcepub unsafe fn read(&self, in_: impl CastInto<Ref<QDataStream>>)
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)
.
Reads the item from stream in.
See also write().
Sourcepub unsafe fn row(&self) -> c_int
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
.
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().
Sourcepub unsafe fn set_background(&self, brush: impl CastInto<Ref<QBrush>>)
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)
.
Sets the item’s background brush to the specified brush.
This function was introduced in Qt 4.2.
See also background() and setForeground().
Sourcepub unsafe fn set_background_color(&self, color: impl CastInto<Ref<QColor>>)
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)
.
This function is deprecated. Use setBackground() instead.
See also backgroundColor().
Sourcepub unsafe fn set_check_state(&self, state: CheckState)
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)
.
Sets the check state of the table item to be state.
See also checkState().
Sourcepub unsafe fn set_data(&self, role: c_int, value: impl CastInto<Ref<QVariant>>)
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)
.
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().
Sourcepub unsafe fn set_flags(&self, flags: QFlags<ItemFlag>)
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)
.
Sets the flags for the item to the given flags. These determine whether the item can be selected or modified.
See also flags().
Sourcepub unsafe fn set_font(&self, font: impl CastInto<Ref<QFont>>)
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)
.
Sets the font used to display the item’s text to the given font.
See also font(), setText(), and setForeground().
Sourcepub unsafe fn set_foreground(&self, brush: impl CastInto<Ref<QBrush>>)
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)
.
Sets the item’s foreground brush to the specified brush.
This function was introduced in Qt 4.2.
See also foreground() and setBackground().
Sourcepub unsafe fn set_icon(&self, icon: impl CastInto<Ref<QIcon>>)
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)
.
Sourcepub unsafe fn set_selected(&self, select: bool)
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)
.
Sets the selected state of the item to select.
This function was introduced in Qt 4.2.
See also isSelected().
Sourcepub unsafe fn set_size_hint(&self, size: impl CastInto<Ref<QSize>>)
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)
.
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().
Sourcepub unsafe fn set_status_tip(&self, status_tip: impl CastInto<Ref<QString>>)
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)
.
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().
Sourcepub unsafe fn set_text(&self, text: impl CastInto<Ref<QString>>)
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)
.
Sets the item’s text to the text specified.
See also text(), setFont(), and setForeground().
Sourcepub unsafe fn set_text_alignment(&self, alignment: c_int)
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)
.
Sets the text alignment for the item’s text to the alignment specified.
See also textAlignment() and Qt::Alignment.
Sourcepub unsafe fn set_text_color(&self, color: impl CastInto<Ref<QColor>>)
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)
.
This function is deprecated. Use setForeground() instead.
See also textColor().
Sourcepub unsafe fn set_tool_tip(&self, tool_tip: impl CastInto<Ref<QString>>)
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)
.
Sets the item’s tooltip to the string specified by toolTip.
See also toolTip(), setStatusTip(), and setWhatsThis().
Sourcepub unsafe fn set_whats_this(&self, whats_this: impl CastInto<Ref<QString>>)
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)
.
Sets the item’s “What’s This?” help to the string specified by whatsThis.
See also whatsThis(), setStatusTip(), and setToolTip().
Sourcepub unsafe fn size_hint(&self) -> CppBox<QSize>
pub unsafe fn size_hint(&self) -> CppBox<QSize>
Returns the size hint set for the table item.
Calls C++ function: QSize QTableWidgetItem::sizeHint() const
.
Returns the size hint set for the table item.
This function was introduced in Qt 4.1.
See also setSizeHint().
Sourcepub unsafe fn status_tip(&self) -> CppBox<QString>
pub unsafe fn status_tip(&self) -> CppBox<QString>
Returns the item's status tip.
Calls C++ function: QString QTableWidgetItem::statusTip() const
.
Returns the item’s status tip.
See also setStatusTip().
Sourcepub unsafe fn table_widget(&self) -> QPtr<QTableWidget>
pub unsafe fn table_widget(&self) -> QPtr<QTableWidget>
Returns the table widget that contains the item.
Calls C++ function: QTableWidget* QTableWidgetItem::tableWidget() const
.
Returns the table widget that contains the item.
Sourcepub unsafe fn text(&self) -> CppBox<QString>
pub unsafe fn text(&self) -> CppBox<QString>
Returns the item's text.
Calls C++ function: QString QTableWidgetItem::text() const
.
Returns the item’s text.
See also setText().
Sourcepub unsafe fn text_alignment(&self) -> c_int
pub unsafe fn text_alignment(&self) -> c_int
Returns the text alignment for the item's text.
Calls C++ function: int QTableWidgetItem::textAlignment() const
.
Returns the text alignment for the item’s text.
See also setTextAlignment() and Qt::Alignment.
Sourcepub unsafe fn text_color(&self) -> CppBox<QColor>
pub unsafe fn text_color(&self) -> CppBox<QColor>
This function is deprecated. Use foreground() instead.
Calls C++ function: QColor QTableWidgetItem::textColor() const
.
This function is deprecated. Use foreground() instead.
See also setTextColor().
Sourcepub unsafe fn tool_tip(&self) -> CppBox<QString>
pub unsafe fn tool_tip(&self) -> CppBox<QString>
Returns the item's tooltip.
Calls C++ function: QString QTableWidgetItem::toolTip() const
.
Returns the item’s tooltip.
See also setToolTip().
Sourcepub unsafe fn type_(&self) -> c_int
pub unsafe fn type_(&self) -> c_int
Returns the type passed to the QTableWidgetItem constructor.
Calls C++ function: int QTableWidgetItem::type() const
.
Returns the type passed to the QTableWidgetItem constructor.
Sourcepub unsafe fn whats_this(&self) -> CppBox<QString>
pub unsafe fn whats_this(&self) -> CppBox<QString>
Returns the item's "What's This?" help.
Calls C++ function: QString QTableWidgetItem::whatsThis() const
.
Returns the item’s “What’s This?” help.
See also setWhatsThis().
Trait Implementations§
Source§impl CppDeletable for QTableWidgetItem
impl CppDeletable for QTableWidgetItem
Source§impl Lt<Ref<QTableWidgetItem>> for QTableWidgetItem
impl Lt<Ref<QTableWidgetItem>> for QTableWidgetItem
Source§unsafe fn lt(&self, other: &Ref<QTableWidgetItem>) -> bool
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
.
Returns true
if the item is less than the other item; otherwise returns false.