Skip to content

PythonQt.Qt.QTableWidgetItem

QTableWidgetItem

PythonQtInstanceWrapper object

Native bases: PythonQtInstanceWrapper

Supplemental documentation: Qt 5 reference:

Detailed Description

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.

Subclassing

When subclassing QTableWidgetItem to provide custom items, it is possible to define new types for them so that they can be distinguished from standard items. The constructors for subclasses that require this feature need to call the base class constructor with a new type value equal to or greater than UserType.

Source: https://doc.qt.io/archives/qt-5.15/qtablewidgetitem.html

Complete member index

Every captured member retains its own identity. Identical captured declaration text is linked once; this does not establish native inheritance or interchangeable objects.

Member Kind Signature Summary
ItemType attribute type Convert a number or string to an integer, or return 0 if no arguments are given. (shared captured text)
Type attribute Any (shared captured text)
UserType attribute Any (shared captured text)
__init__ function (self, *args: Any, **kwargs: Any) -> None Native constructor; consult class documentation for supported overloads. (shared captured text)
background function (self) -> Any X.background() -> PythonQt.QtGui.QBrush (shared captured text)
checkState function (self) -> Any Returns the checked state of the table item. (shared captured text)
className function (self, *args: Any, **kwargs: Any) -> Any Return the classname of the object (shared captured text)
clone function (self) -> Any X.clone() -> PythonQt.QtGui.QTableWidgetItem (shared captured text)
column function (self) -> int X.column() -> int (shared captured text)
data function (self, role: int) -> Any X.data(role) -> object (shared captured text)
delete function (self, *args: Any, **kwargs: Any) -> Any Deletes the C++ object (at your own risk, my friend!) (shared captured text)
flags function (self) -> Any Returns the flags used to describe the item. (shared captured text)
font function (self) -> Any X.font() -> PythonQt.QtGui.QFont (shared captured text)
foreground function (self) -> Any X.foreground() -> PythonQt.QtGui.QBrush (shared captured text)
help function (self, *args: Any, **kwargs: Any) -> Any Shows the help of available methods for this class (shared captured text)
icon function (self) -> Any X.icon() -> PythonQt.QtGui.QIcon (shared captured text)
inherits function (self, *args: Any, **kwargs: Any) -> Any Returns if the class inherits or is of given type name (shared captured text)
isSelected function (self) -> bool X.isSelected() -> bool (shared captured text)
read function (self, *args: Any, **kwargs: Any) -> None Reads the item from stream in. (shared captured text)
readFrom function (self, *args: Any, **kwargs: Any) -> Any (shared captured text)
row function (self) -> int X.row() -> int (shared captured text)
setBackground function (self, brush: Any) -> None Sets the item's background brush to the specified brush. (shared captured text)
setCheckState function (self, state: Any) -> None Sets the check state of the table item to be state. (shared captured text)
setData function (self, role: int, value: Any) -> None X.setData(role, value) (shared captured text)
setFlags function (self, arg0: flags) -> None Sets the flags for the item to the given flags. (shared captured text)
setFont function (self, font: Any) -> None Sets the font used to display the item's text to the given font. (shared captured text)
setForeground function (self, brush: Any) -> None Sets the item's foreground brush to the specified brush. (shared captured text)
setIcon function (self, icon: Any) -> None Sets the item's icon to the icon specified. (shared captured text)
setSelected function (self, select: bool) -> None Sets the selected state of the item to select. (shared captured text)
setSizeHint function (self, size: Any) -> None Sets the size hint for the table item to be size. (shared captured text)
setStatusTip function (self, statusTip: str) -> None Sets the status tip for the table item to the text specified by statusTip. (shared captured text)
setText function (self, text: str) -> None Sets the item's text to the text specified. (shared captured text)
setTextAlignment function (self, alignment: int) -> None Sets the text alignment for the item's text to the alignment specified. (shared captured text)
setToolTip function (self, toolTip: str) -> None Sets the item's tooltip to the string specified by toolTip. (shared captured text)
setWhatsThis function (self, whatsThis: str) -> None Sets the item's "What's This?" help to the string specified by whatsThis. (shared captured text)
sizeHint function (self) -> Any X.sizeHint() -> PythonQt.QtCore.QSize (shared captured text)
statusTip function (self) -> str X.statusTip() -> str (shared captured text)
tableWidget function (self) -> Any X.tableWidget() -> PythonQt.QtGui.QTableWidget (shared captured text)
text function (self) -> str X.text() -> str (shared captured text)
textAlignment function (self) -> int X.textAlignment() -> int (shared captured text)
toolTip function (self) -> str X.toolTip() -> str (shared captured text)
type function (self) -> int X.type() -> int (shared captured text)
whatsThis function (self) -> str X.whatsThis() -> str (shared captured text)
write function (self, out: Any) -> None Writes the item to stream out. (shared captured text)
writeTo function (self, out: Any) -> Any (shared captured text)