|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.trolltech.qt.QSignalEmitter
com.trolltech.qt.QtJambiObject
com.trolltech.qt.gui.QTableWidgetItem
public 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(String.valueOf(Math.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
.
QTableWidget
, Model/View Programming, QListWidgetItem
, and QTreeWidgetItem
.
Nested Class Summary | |
---|---|
static class |
QTableWidgetItem.ItemType
This enum describes the types that are used to describe tree widget items. |
Nested classes/interfaces inherited from class com.trolltech.qt.QSignalEmitter |
---|
QSignalEmitter.Signal0, QSignalEmitter.Signal1, QSignalEmitter.Signal2, QSignalEmitter.Signal3, QSignalEmitter.Signal4, QSignalEmitter.Signal5, QSignalEmitter.Signal6, QSignalEmitter.Signal7, QSignalEmitter.Signal8, QSignalEmitter.Signal9 |
Constructor Summary | |
---|---|
QTableWidgetItem()
Constructs a table item of the specified type that does not belong to any table. |
|
QTableWidgetItem(int type)
Constructs a table item of the specified type that does not belong to any table. |
|
QTableWidgetItem(QIcon icon,
java.lang.String text)
Constructs a table item with the given icon and text. |
|
QTableWidgetItem(QIcon icon,
java.lang.String text,
int type)
Constructs a table item with the given icon and text. |
|
QTableWidgetItem(QTableWidgetItem other)
Constructs a copy of other. |
|
QTableWidgetItem(java.lang.String text)
Constructs a table item with the given text. |
|
QTableWidgetItem(java.lang.String text,
int type)
Constructs a table item with the given text. |
Method Summary | |
---|---|
QBrush |
background()
Returns the brush used to render the item's background. |
Qt.CheckState |
checkState()
Returns the checked state of the table item. |
QTableWidgetItem |
clone()
This method is reimplemented for internal reasons |
int |
column()
Returns the column of the item in the table. |
java.lang.Object |
data(int role)
Returns the item's data for the given role. |
Qt.ItemFlags |
flags()
Returns the flags used to describe the item. |
QFont |
font()
Returns the font used to render the item's text. |
QBrush |
foreground()
Returns the brush used to render the item's foreground (e.g. |
static QTableWidgetItem |
fromNativePointer(QNativePointer nativePointer)
|
QIcon |
icon()
Returns the item's icon. |
boolean |
isSelected()
Returns true if the item is selected, otherwise returns false. |
boolean |
operator_less(QTableWidgetItem other)
Returns true if the item is less than the other item; otherwise returns false. |
void |
read(QDataStream in)
Reads the item from stream in. |
void |
readFrom(QDataStream in)
|
int |
row()
Returns the row of the item in the table. |
void |
setBackground(QBrush brush)
Sets the item's background brush to the specified brush. |
void |
setCheckState(Qt.CheckState state)
Sets the check state of the table item to be state. |
void |
setData(int role,
java.lang.Object value)
Sets the item's data for the given role to the specified value. |
void |
setFlags(Qt.ItemFlag[] flags)
Sets the flags for the item to the given flags. |
void |
setFlags(Qt.ItemFlags flags)
Sets the flags for the item to the given flags. |
void |
setFont(QFont font)
Sets the font used to display the item's text to the given font. |
void |
setForeground(QBrush brush)
Sets the item's foreground brush to the specified brush. |
void |
setIcon(QIcon icon)
Sets the item's icon to the icon specified. |
void |
setSelected(boolean select)
Sets the selected state of the item to select. |
void |
setSizeHint(QSize size)
Sets the size hint for the table item to be size. |
void |
setStatusTip(java.lang.String statusTip)
Sets the item's status tip to the string specified by statusTip. |
void |
setText(java.lang.String text)
Sets the item's text to the text specified. |
void |
setTextAlignment(int alignment)
Sets the text alignment for the item's text to the alignment specified. |
void |
setToolTip(java.lang.String toolTip)
Sets the item's tooltip to the string specified by toolTip. |
void |
setWhatsThis(java.lang.String whatsThis)
Sets the item's "What's This?" help to the string specified by whatsThis. |
QSize |
sizeHint()
Returns the size hint set for the table item. |
java.lang.String |
statusTip()
Returns the item's status tip. |
QTableWidget |
tableWidget()
Returns the table widget that contains the item. |
java.lang.String |
text()
Returns the item's text. |
int |
textAlignment()
Returns the text alignment for the item's text. |
java.lang.String |
toolTip()
Returns the item's tooltip. |
int |
type()
Returns the type passed to the QTableWidgetItem constructor. |
java.lang.String |
whatsThis()
Returns the item's "What's This?" help. |
void |
write(QDataStream out)
Writes the item to stream out. |
void |
writeTo(QDataStream out)
|
Methods inherited from class com.trolltech.qt.QtJambiObject |
---|
dispose, disposed, equals, finalize, reassignNativeResources, tr, tr, tr |
Methods inherited from class com.trolltech.qt.QSignalEmitter |
---|
blockSignals, disconnect, disconnect, signalsBlocked, signalSender, thread |
Methods inherited from class java.lang.Object |
---|
getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface com.trolltech.qt.QtJambiInterface |
---|
disableGarbageCollection, nativeId, nativePointer, reenableGarbageCollection, setJavaOwnership |
Constructor Detail |
---|
public QTableWidgetItem(QIcon icon, java.lang.String text)
type()
.
public QTableWidgetItem(QIcon icon, java.lang.String text, int type)
type()
.
public QTableWidgetItem(java.lang.String text)
type()
.
public QTableWidgetItem(java.lang.String text, int type)
type()
.
public QTableWidgetItem(QTableWidgetItem other)
type()
and tableWidget()
are not copied. This function is useful when reimplementing clone()
.
data()
, and flags()
.
public QTableWidgetItem()
type()
.
public QTableWidgetItem(int type)
type()
.
Method Detail |
---|
public final QBrush background()
setBackground()
, and foreground()
.
public final Qt.CheckState checkState()
setCheckState()
, and flags()
.
public final int column()
row()
.
public final Qt.ItemFlags flags()
setFlags()
.
public final QFont font()
setFont()
.
public final QBrush foreground()
setForeground()
, and background()
.
public final QIcon icon()
setIcon()
, and iconSize
.
public final boolean isSelected()
setSelected()
.
public final void writeTo(QDataStream out)
public final void readFrom(QDataStream in)
public final int row()
column()
.
public final void setBackground(QBrush brush)
background()
, and setForeground()
.
public final void setCheckState(Qt.CheckState state)
checkState()
.
public final void setFlags(Qt.ItemFlag[] flags)
flags()
.
public final void setFlags(Qt.ItemFlags flags)
flags()
.
public final void setFont(QFont font)
font()
, setText()
, and setForeground()
.
public final void setForeground(QBrush brush)
foreground()
, and setBackground()
.
public final void setIcon(QIcon icon)
icon()
, setText()
, and iconSize
.
public final void setSelected(boolean select)
isSelected()
.
public final void setSizeHint(QSize size)
sizeHint()
.
public final void setStatusTip(java.lang.String statusTip)
statusTip()
, setToolTip()
, and setWhatsThis()
.
public final void setText(java.lang.String text)
text()
, setFont()
, and setForeground()
.
public final void setTextAlignment(int alignment)
textAlignment()
, and Qt::Alignment.
public final void setToolTip(java.lang.String toolTip)
toolTip()
, setStatusTip()
, and setWhatsThis()
.
public final void setWhatsThis(java.lang.String whatsThis)
whatsThis()
, setStatusTip()
, and setToolTip()
.
public final QSize sizeHint()
setSizeHint()
.
public final java.lang.String statusTip()
setStatusTip()
.
public final QTableWidget tableWidget()
public final java.lang.String text()
setText()
.
public final int textAlignment()
setTextAlignment()
, and Qt::Alignment.
public final java.lang.String toolTip()
setToolTip()
.
public final int type()
QTableWidgetItem
constructor.
public final java.lang.String whatsThis()
setWhatsThis()
.
public QTableWidgetItem clone()
clone
in class java.lang.Object
public java.lang.Object data(int role)
setData()
.
public boolean operator_less(QTableWidgetItem other)
public void read(QDataStream in)
write()
.
public void setData(int role, java.lang.Object value)
Qt::ItemDataRole
, and data()
.
public void write(QDataStream out)
read()
.
public static QTableWidgetItem fromNativePointer(QNativePointer nativePointer)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |