|
|||||||||
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.QListWidgetItem
public class QListWidgetItem
The QListWidgetItem class provides an item for use with the QListWidget item view class.
QListWidgetItem is used to represent items in a list provided by the QListWidget class. Each item can hold several pieces of information, and will display these appropriately.
The item view convenience classes use a classic item-based interface rather than a pure model/view approach. For a more flexible list view widget, consider using the QListView class with a standard model.
List items can be automatically inserted into a list when they are constructed by specifying the list widget:
new QListWidgetItem(tr("Hazel"), listWidget);
They can also be created without a parent widget, and later inserted into a list (see QListWidget::insertItem).
List items are typically used to display text and an icon. These are set with the setText and setIcon functions. The appearance of the text can be customized with setFont, setForeground, and setBackground. Text in list items can be aligned using the setTextAlignment function. Tooltips, status tips and "What's This?" help can be added to list items with setToolTip, setStatusTip, and setWhatsThis.
By default, items are enabled, selectable, checkable, and can be the source of a drag and drop operation. Each item's flags can be changed by calling setFlags with the appropriate value (see Qt::ItemFlags). Checkable items can be checked, unchecked and partially checked with the setCheckState function. The corresponding checkState function indicates what check state the item currently has.
The isHidden function can be used to determine whether the item is hidden. Items can be hidden with setHidden.
When subclassing QListWidgetItem 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 |
QListWidgetItem.ItemType
This enum describes the types that are used to describe list 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 | |
---|---|
QListWidgetItem()
Equivalent to QListWidgetItem(0, Type). |
|
QListWidgetItem(QIcon icon,
java.lang.String text)
Equivalent to QListWidgetItem(icon, text, 0, Type). |
|
QListWidgetItem(QIcon icon,
java.lang.String text,
QListWidget view)
Equivalent to QListWidgetItem(icon, text, view, Type). |
|
QListWidgetItem(QIcon icon,
java.lang.String text,
QListWidget view,
int type)
Constructs an empty list widget item of the specified type with the given icon, text and view. |
|
QListWidgetItem(QListWidget view)
Equivalent to QListWidgetItem(view, Type). |
|
QListWidgetItem(QListWidget view,
int type)
Constructs an empty list widget item of the specified type with the given view. |
|
QListWidgetItem(QListWidgetItem other)
Constructs a copy of other. |
|
QListWidgetItem(java.lang.String text)
Equivalent to QListWidgetItem(text, 0, Type). |
|
QListWidgetItem(java.lang.String text,
QListWidget view)
Equivalent to QListWidgetItem(text, view, Type). |
|
QListWidgetItem(java.lang.String text,
QListWidget view,
int type)
Constructs an empty list widget item of the specified type with the given text and view. |
Method Summary | |
---|---|
QBrush |
background()
Returns the brush used to display the list item's background. |
Qt.CheckState |
checkState()
Returns the checked state of the list item (see Qt::CheckState). |
QListWidgetItem |
clone()
Creates an exact copy of the item. |
java.lang.Object |
data(int role)
This function returns the item's data for a given role (see Qt::ItemDataRole). |
Qt.ItemFlags |
flags()
Returns the item flags for this item (see Qt::ItemFlags). |
QFont |
font()
Returns the font used to display this list item's text. |
QBrush |
foreground()
Returns the brush used to display the list item's foreground (e.g. text). |
static QListWidgetItem |
fromNativePointer(QNativePointer nativePointer)
This function returns the QListWidgetItem instance pointed to by nativePointer |
QIcon |
icon()
Returns the list item's icon. |
boolean |
isHidden()
Returns true if the item is hidden, otherwise returns false. |
boolean |
isSelected()
Returns true if the item is selected, otherwise returns false. |
QListWidget |
listWidget()
Returns the list widget that contains the item. |
void |
read(QDataStream in)
Reads the item from stream in. |
void |
readFrom(QDataStream in)
Reads a QListWidgetItem from in. |
void |
setBackground(QBrush brush)
Sets the background brush of the list item to the given brush. |
void |
setCheckState(Qt.CheckState state)
Sets the check state of the list item to state. |
void |
setData(int role,
java.lang.Object value)
This function sets the data for a given role to the given value (see Qt::ItemDataRole). |
void |
setFlags(Qt.ItemFlag... flags)
Sets the item flags for the list item to flags (see Qt::ItemFlags). |
void |
setFlags(Qt.ItemFlags flags)
Sets the item flags for the list item to flags (see Qt::ItemFlags). |
void |
setFont(QFont font)
Sets the font used when painting the item to the given font. |
void |
setForeground(QBrush brush)
Sets the foreground brush of the list item to the given brush. |
void |
setHidden(boolean hide)
Hides the item if hide is true, otherwise shows the item. |
void |
setIcon(QIcon icon)
Sets the icon for the list item to the given icon. |
void |
setSelected(boolean select)
Sets the selected state of the item to select. |
void |
setSizeHint(QSize size)
Sets the size hint for the list item to be size. |
void |
setStatusTip(java.lang.String statusTip)
Sets the status tip for the list item to the text specified by statusTip. |
void |
setText(java.lang.String text)
Sets the text for the list widget item's to the given text. |
void |
setTextAlignment(int alignment)
Sets the list item's text alignment to alignment (see Qt::AlignmentFlag). |
void |
setToolTip(java.lang.String toolTip)
Sets the tooltip for the list item to the text specified by toolTip. |
void |
setWhatsThis(java.lang.String whatsThis)
Sets the "What's This?" help for the list item to the text specified by whatsThis. |
QSize |
sizeHint()
Returns the size hint set for the list item. |
java.lang.String |
statusTip()
Returns the list item's status tip. |
java.lang.String |
text()
Returns the list item's text. |
int |
textAlignment()
Returns the text alignment for the list item (see Qt::AlignmentFlag). |
java.lang.String |
toolTip()
Returns the list item's tooltip. |
int |
type()
Returns the type passed to the QListWidgetItem constructor. |
java.lang.String |
whatsThis()
Returns the list item's "What's This?" help text. |
void |
write(QDataStream out)
Writes the item to stream out. |
void |
writeTo(QDataStream out)
Writes thisQListWidgetItem 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 QListWidgetItem(QIcon icon, java.lang.String text, QListWidget view)
Equivalent to QListWidgetItem(icon, text, view, Type).
public QListWidgetItem(QIcon icon, java.lang.String text)
Equivalent to QListWidgetItem(icon, text, 0, Type).
public QListWidgetItem(QIcon icon, java.lang.String text, QListWidget view, int type)
Constructs an empty list widget item of the specified type with the given icon, text and view. If the parent is not specified, the item will need to be inserted into a list widget with QListWidget::insertItem().
public QListWidgetItem(QListWidget view)
Equivalent to QListWidgetItem(view, Type).
public QListWidgetItem()
Equivalent to QListWidgetItem(0, Type).
public QListWidgetItem(QListWidget view, int type)
Constructs an empty list widget item of the specified type with the given view. If the parent is not specified, the item will need to be inserted into a list widget with QListWidget::insertItem().
public QListWidgetItem(QListWidgetItem other)
Constructs a copy of other. Note that type and listWidget are not copied.
This function is useful when reimplementing clone.
public QListWidgetItem(java.lang.String text, QListWidget view)
Equivalent to QListWidgetItem(text, view, Type).
public QListWidgetItem(java.lang.String text)
Equivalent to QListWidgetItem(text, 0, Type).
public QListWidgetItem(java.lang.String text, QListWidget view, int type)
Constructs an empty list widget item of the specified type with the given text and view. If the parent is not specified, the item will need to be inserted into a list widget with QListWidget::insertItem().
Method Detail |
---|
public final QBrush background()
Returns the brush used to display the list item's background.
public final Qt.CheckState checkState()
Returns the checked state of the list item (see Qt::CheckState).
public final Qt.ItemFlags flags()
Returns the item flags for this item (see Qt::ItemFlags).
public final QFont font()
Returns the font used to display this list item's text.
public final QBrush foreground()
Returns the brush used to display the list item's foreground (e.g. text).
public final QIcon icon()
Returns the list item's icon.
public final boolean isHidden()
Returns true if the item is hidden, otherwise returns false.
public final boolean isSelected()
Returns true if the item is selected, otherwise returns false.
public final QListWidget listWidget()
Returns the list widget that contains the item.
public final void writeTo(QDataStream out)
public final void readFrom(QDataStream in)
public final void setBackground(QBrush brush)
Sets the background brush of the list item to the given brush.
public final void setCheckState(Qt.CheckState state)
Sets the check state of the list item to state.
public final void setFlags(Qt.ItemFlag... flags)
Sets the item flags for the list item to flags (see Qt::ItemFlags).
public final void setFlags(Qt.ItemFlags flags)
Sets the item flags for the list item to flags (see Qt::ItemFlags).
public final void setFont(QFont font)
Sets the font used when painting the item to the given font.
public final void setForeground(QBrush brush)
Sets the foreground brush of the list item to the given brush.
public final void setHidden(boolean hide)
Hides the item if hide is true, otherwise shows the item.
public final void setIcon(QIcon icon)
Sets the icon for the list item to the given icon.
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 list 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 status tip for the list item to the text specified by statusTip.
public final void setText(java.lang.String text)
Sets the text for the list widget item's to the given text.
public final void setTextAlignment(int alignment)
Sets the list item's text alignment to alignment (see Qt::AlignmentFlag).
public final void setToolTip(java.lang.String toolTip)
Sets the tooltip for the list item to the text specified by toolTip.
public final void setWhatsThis(java.lang.String whatsThis)
Sets the "What's This?" help for the list item to the text specified by whatsThis.
public final QSize sizeHint()
Returns the size hint set for the list item.
public final java.lang.String statusTip()
Returns the list item's status tip.
public final java.lang.String text()
Returns the list item's text.
public final int textAlignment()
Returns the text alignment for the list item (see Qt::AlignmentFlag).
public final java.lang.String toolTip()
Returns the list item's tooltip.
public final int type()
Returns the type passed to the QListWidgetItem constructor.
public final java.lang.String whatsThis()
Returns the list item's "What's This?" help text.
public QListWidgetItem clone()
Creates an exact copy of the item.
clone
in class java.lang.Object
public java.lang.Object data(int role)
This function returns the item's data for a given role (see Qt::ItemDataRole). Reimplement this function if you need extra roles or special behavior for certain roles.
public void read(QDataStream in)
Reads the item from stream in.
public void setData(int role, java.lang.Object value)
This function sets the data for a given role to the given value (see Qt::ItemDataRole). Reimplement this function if you need extra roles or special behavior for certain roles.
public void write(QDataStream out)
Writes the item to stream out.
public static QListWidgetItem 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 |