|
|||||||||
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(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 setChecked() function. The corresponding checked() function indicates whether the item is currently checked.
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.
Nested Class Summary | |
---|---|
static class |
QTableWidgetItem.ItemType
This enum describes the types that are used to describe table widget items. |
Nested classes/interfaces inherited from class com.trolltech.qt.QSignalEmitter |
---|
QSignalEmitter.Signal0, QSignalEmitter.Signal1<A>, QSignalEmitter.Signal2<A,B>, QSignalEmitter.Signal3<A,B,C>, QSignalEmitter.Signal4<A,B,C,D>, QSignalEmitter.Signal5<A,B,C,D,E>, QSignalEmitter.Signal6<A,B,C,D,E,F>, QSignalEmitter.Signal7<A,B,C,D,E,F,G>, QSignalEmitter.Signal8<A,B,C,D,E,F,G,H>, QSignalEmitter.Signal9<A,B,C,D,E,F,G,H,I> |
Constructor Summary | |
---|---|
QTableWidgetItem()
Equivalent to QTableWidgetItem(Type). |
|
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)
Equivalent to QTableWidgetItem(icon, text, Type). |
|
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)
Equivalent to QTableWidgetItem(text, Type). |
|
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()
Creates a copy of the item. |
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. text). |
static QTableWidgetItem |
fromNativePointer(QNativePointer nativePointer)
This function returns the QTableWidgetItem instance pointed to by nativePointer |
QIcon |
icon()
Returns the item's icon. |
boolean |
isSelected()
Returns true if the item is selected, otherwise returns false. |
void |
read(QDataStream in)
Reads the item from stream in. |
void |
readFrom(QDataStream in)
Reads a QTableWidgetItem from 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)
Writes thisQTableWidgetItem to out. |
Methods inherited from class com.trolltech.qt.QtJambiObject |
---|
dispose, disposed, 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 |
---|
equals, 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)
Equivalent to QTableWidgetItem(icon, text, Type).
public QTableWidgetItem(QIcon icon, java.lang.String text, int type)
Constructs a table item with the given icon and text.
public QTableWidgetItem(java.lang.String text)
Equivalent to QTableWidgetItem(text, Type).
public QTableWidgetItem(java.lang.String text, int type)
Constructs a table item with the given text.
public QTableWidgetItem()
Equivalent to QTableWidgetItem(Type).
public QTableWidgetItem(int type)
Constructs a table item of the specified type that does not belong to any table.
public QTableWidgetItem(QTableWidgetItem other)
Constructs a copy of other. Note that type and tableWidget are not copied.
This function is useful when reimplementing clone.
Method Detail |
---|
public final QBrush background()
Returns the brush used to render the item's background.
public final Qt.CheckState checkState()
Returns the checked state of the table item.
public final int column()
Returns the column of the item in the table. If the item is not in a table, this function will return -1.
public final Qt.ItemFlags flags()
Returns the flags used to describe the item. These determine whether the item can be checked, edited, and selected.
public final QFont font()
Returns the font used to render the item's text.
public final QBrush foreground()
Returns the brush used to render the item's foreground (e.g. text).
public final QIcon icon()
Returns the item's icon.
public final boolean isSelected()
Returns true if the item is selected, otherwise returns false.
public final void writeTo(QDataStream out)
public final void readFrom(QDataStream in)
public final int row()
Returns the row of the item in the table. If the item is not in a table, this function will return -1.
public final void setBackground(QBrush brush)
Sets the item's background brush to the specified brush.
public final void setCheckState(Qt.CheckState state)
Sets the check state of the table item to be state.
public final void setFlags(Qt.ItemFlag... flags)
Sets the flags for the item to the given flags. These determine whether the item can be selected or modified.
public final void setFlags(Qt.ItemFlags flags)
Sets the flags for the item to the given flags. These determine whether the item can be selected or modified.
public final void setFont(QFont font)
Sets the font used to display the item's text to the given font.
public final void setForeground(QBrush brush)
Sets the item's foreground brush to the specified brush.
public final void setIcon(QIcon icon)
Sets the item's icon to the icon specified.
public final void setSelected(boolean select)
Sets the selected state of the item to select.
public final void setSizeHint(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.
public final void setStatusTip(java.lang.String statusTip)
Sets the item's status tip to the string specified by statusTip.
public final void setText(java.lang.String text)
Sets the item's text to the text specified.
public final void setTextAlignment(int alignment)
Sets the text alignment for the item's text to the alignment specified.
Qt::Alignment
public final void setToolTip(java.lang.String toolTip)
Sets the item's tooltip to the string specified by toolTip.
public final void setWhatsThis(java.lang.String whatsThis)
Sets the item's "What's This?" help to the string specified by whatsThis.
public final QSize sizeHint()
Returns the size hint set for the table item.
public final java.lang.String statusTip()
Returns the item's status tip.
public final QTableWidget tableWidget()
Returns the table widget that contains the item.
public final java.lang.String text()
Returns the item's text.
public final int textAlignment()
Returns the text alignment for the item's text.
Qt::Alignment
public final java.lang.String toolTip()
Returns the item's tooltip.
public final int type()
Returns the type passed to the QTableWidgetItem constructor.
public final java.lang.String whatsThis()
Returns the item's "What's This?" help.
public QTableWidgetItem clone()
Creates a copy of the item.
clone
in class java.lang.Object
public java.lang.Object data(int role)
Returns the item's data for the given role.
public void read(QDataStream in)
Reads the item from stream in.
public void setData(int role, java.lang.Object value)
Sets the item's data for the given role to the specified value.
public void write(QDataStream out)
Writes the item to stream out.
public static QTableWidgetItem fromNativePointer(QNativePointer nativePointer)
nativePointer
- the QNativePointer of which object should be returned.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |