|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.trolltech.qt.internal.QSignalEmitterInternal
com.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()
.Subclassing
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
.
QListWidget
, Model/View Programming, QTreeWidgetItem
, and QTableWidgetItem
.
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.AbstractSignal, QSignalEmitter.Signal0, QSignalEmitter.Signal1, QSignalEmitter.Signal2, QSignalEmitter.Signal3, QSignalEmitter.Signal4, QSignalEmitter.Signal5, QSignalEmitter.Signal6, QSignalEmitter.Signal7, QSignalEmitter.Signal8, QSignalEmitter.Signal9 |
Nested classes/interfaces inherited from class com.trolltech.qt.internal.QSignalEmitterInternal |
---|
com.trolltech.qt.internal.QSignalEmitterInternal.AbstractSignalInternal |
Field Summary |
---|
Fields inherited from class com.trolltech.qt.internal.QSignalEmitterInternal |
---|
currentSender |
Constructor Summary | |
---|---|
QListWidgetItem()
Constructs an empty list widget item of the specified type with the given parent. |
|
QListWidgetItem(QIcon icon,
java.lang.String text)
Constructs an empty list widget item of the specified type with the given icon, text and parent. |
|
QListWidgetItem(QIcon icon,
java.lang.String text,
QListWidget view)
Constructs an empty list widget item of the specified type with the given icon, text and parent. |
|
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 parent. |
|
QListWidgetItem(QListWidget view)
Constructs an empty list widget item of the specified type with the given parent. |
|
QListWidgetItem(QListWidget view,
int type)
Constructs an empty list widget item of the specified type with the given parent. |
|
QListWidgetItem(QListWidgetItem other)
Constructs a copy of other. |
|
QListWidgetItem(java.lang.String text)
Constructs an empty list widget item of the specified type with the given text and parent. |
|
QListWidgetItem(java.lang.String text,
QListWidget view)
Constructs an empty list widget item of the specified type with the given text and parent. |
|
QListWidgetItem(java.lang.String text,
QListWidget view,
int type)
Constructs an empty list widget item of the specified type with the given text and parent. |
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()
This method is reimplemented for internal reasons |
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. |
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. |
boolean |
operator_less(QListWidgetItem other)
Returns true if this item's text is less then other item's text; otherwise returns false. |
void |
read(QDataStream in)
Reads the item from stream in. |
void |
readFrom(QDataStream 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)
|
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)
|
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 com.trolltech.qt.internal.QSignalEmitterInternal |
---|
__qt_signalInitialization |
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 QListWidgetItem(QListWidget view)
QListWidget::insertItem()
. type()
.
public QListWidgetItem()
QListWidget::insertItem()
. type()
.
public QListWidgetItem(QListWidget view, int type)
QListWidget::insertItem()
. type()
.
public QListWidgetItem(QIcon icon, java.lang.String text, QListWidget view)
QListWidget::insertItem()
. type()
.
public QListWidgetItem(QIcon icon, java.lang.String text)
QListWidget::insertItem()
. type()
.
public QListWidgetItem(QIcon icon, java.lang.String text, QListWidget view, int type)
QListWidget::insertItem()
. type()
.
public QListWidgetItem(QListWidgetItem other)
type()
and listWidget()
are not copied. This function is useful when reimplementing clone()
.
data()
, and flags()
.
public QListWidgetItem(java.lang.String text, QListWidget view)
QListWidget::insertItem()
. type()
.
public QListWidgetItem(java.lang.String text)
QListWidget::insertItem()
. type()
.
public QListWidgetItem(java.lang.String text, QListWidget view, int type)
QListWidget::insertItem()
. type()
.
Method Detail |
---|
public final QBrush background()
setBackground()
, and foreground()
.
public final Qt.CheckState checkState()
Qt::CheckState
). setCheckState()
, and flags()
.
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 isHidden()
setHidden()
.
public final boolean isSelected()
setSelected()
.
public final QListWidget listWidget()
public final void writeTo(QDataStream out)
public final void readFrom(QDataStream in)
public final void setBackground(QBrush brush)
background()
, and setForeground()
.
public final void setCheckState(Qt.CheckState state)
checkState()
.
public final void setFlags(Qt.ItemFlag[] flags)
public final void setFlags(Qt.ItemFlags flags)
flags()
.
public final void setFont(QFont font)
font()
.
public final void setForeground(QBrush brush)
foreground()
, and setBackground()
.
public final void setHidden(boolean hide)
isHidden()
.
public final void setIcon(QIcon icon)
icon()
, text()
, and iconSize
.
public final void setSelected(boolean select)
isSelected()
.
public final void setSizeHint(QSize size)
sizeHint()
.
public final void setStatusTip(java.lang.String statusTip)
QListWidget
mouse tracking needs to be enabled for this feature to work. statusTip()
, setToolTip()
, and setWhatsThis()
.
public final void setText(java.lang.String text)
text()
.
public final void setTextAlignment(int alignment)
Qt::AlignmentFlag
). textAlignment()
.
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 java.lang.String text()
setText()
.
public final int textAlignment()
Qt::AlignmentFlag
). setTextAlignment()
.
public final java.lang.String toolTip()
setToolTip()
, statusTip()
, and whatsThis()
.
public final int type()
public final java.lang.String whatsThis()
setWhatsThis()
, statusTip()
, and toolTip()
.
public QListWidgetItem clone()
clone
in class java.lang.Object
public java.lang.Object data(int role)
Qt::ItemDataRole
). Reimplement this function if you need extra roles or special behavior for certain roles. setData()
.
public boolean operator_less(QListWidgetItem other)
public void read(QDataStream in)
write()
.
public void setData(int role, java.lang.Object value)
Qt::ItemDataRole
). Reimplement this function if you need extra roles or special behavior for certain roles. Qt::ItemDataRole
, and data()
.
public void write(QDataStream out)
read()
.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |