|
|||||||||
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.core.QObject
com.trolltech.qt.gui.QWidget
com.trolltech.qt.gui.QFrame
com.trolltech.qt.gui.QAbstractScrollArea
com.trolltech.qt.gui.QAbstractItemView
com.trolltech.qt.gui.QListView
public class QListView
The QListView
class provides a list or icon view onto a model. A QListView
presents items stored in a model, either as a simple non-hierarchical list, or as a collection of icons. This class is used to provide lists and icon views that were previously provided by the QListBox and QIconView classes, but using the more flexible approach provided by Qt's model/view architecture.
The QListView
class is one of the Model/View Classes and is part of Qt's model/view framework.
This view does not display horizontal or vertical headers; to display a list of items with a horizontal header, use QTreeView
instead.
QListView
implements the interfaces defined by the QAbstractItemView
class to allow it to display data provided by models derived from the QAbstractItemModel
class.
Items in a list view can be displayed using one of two view modes: In ListMode
, the items are displayed in the form of a simple list; in IconMode
, the list view takes the form of an icon view in which the items are displayed with icons like files in a file manager. By default, the list view is in ListMode
. To change the view mode, use the setViewMode()
function, and to determine the current view mode, use viewMode()
.
Items in these views are laid out in the direction specified by the flow()
of the list view. The items may be fixed in place, or allowed to move, depending on the view's movement()
state.
If the items in the model cannot be completely laid out in the direction of flow, they can be wrapped at the boundary of the view widget; this depends on isWrapping()
. This property is useful when the items are being represented by an icon view.
The resizeMode()
and layoutMode()
govern how and when the items are laid out. Items are spaced according to their spacing()
, and can exist within a notional grid of size specified by gridSize()
. The items can be rendered as large or small icons depending on their iconSize().
![]() | ![]() | ![]() |
A Windows XP style list view. | A Macintosh style list view. | A Plastique style list view. |
uniformItemSizes
property to true. QTreeView
, QTableView
, and QListWidget
.
Nested Class Summary | |
---|---|
static class |
QListView.Flow
|
static class |
QListView.LayoutMode
See also. batchSize . |
static class |
QListView.Movement
|
static class |
QListView.ResizeMode
This enum describes the different resizing behaviors child widgets can have. |
static class |
QListView.ViewMode
This enum is used to describe the view mode of the preview widget. |
Nested classes/interfaces inherited from class com.trolltech.qt.gui.QAbstractItemView |
---|
QAbstractItemView.CursorAction, QAbstractItemView.DragDropMode, QAbstractItemView.DropIndicatorPosition, QAbstractItemView.EditTrigger, QAbstractItemView.EditTriggers, QAbstractItemView.ScrollHint, QAbstractItemView.ScrollMode, QAbstractItemView.SelectionBehavior, QAbstractItemView.SelectionMode, QAbstractItemView.State |
Nested classes/interfaces inherited from class com.trolltech.qt.gui.QFrame |
---|
QFrame.Shadow, QFrame.Shape, QFrame.StyleMask |
Nested classes/interfaces inherited from class com.trolltech.qt.gui.QWidget |
---|
QWidget.RenderFlag, QWidget.RenderFlags |
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 |
Field Summary | |
---|---|
QSignalEmitter.Signal1 |
indexesMoved
This signal is emitted when the specified indexes are moved in the view. |
Fields inherited from class com.trolltech.qt.gui.QAbstractItemView |
---|
activated, clicked, doubleClicked, entered, pressed, viewportEntered |
Fields inherited from class com.trolltech.qt.gui.QWidget |
---|
customContextMenuRequested |
Constructor Summary | |
---|---|
QListView()
Creates a new QListView with the given parent to view a model. |
|
QListView(QWidget parent)
Creates a new QListView with the given parent to view a model. |
Method Summary | |
---|---|
int |
batchSize()
This property holds the number of items laid out in each batch if layoutMode is set to Batched . |
void |
clearPropertyFlags()
Clears the QListView -specific property flags. |
QListView.Flow |
flow()
This property holds which direction the items layout should flow. |
static QListView |
fromNativePointer(QNativePointer nativePointer)
|
QSize |
gridSize()
This property holds the size of the layout grid. |
boolean |
isRowHidden(int row)
Returns true if the row is hidden; otherwise returns false. |
boolean |
isSelectionRectVisible()
This property holds if the selection rectangle should be visible. |
boolean |
isWrapping()
This property holds whether the items layout should wrap. |
QListView.LayoutMode |
layoutMode()
This property determines whether the layout of items should happen immediately or be delayed. |
int |
modelColumn()
This property holds the column in the model that is visible. |
QListView.Movement |
movement()
This property holds whether the items can be moved freely, are snapped to a grid, or cannot be moved at all. |
protected QRect |
rectForIndex(QModelIndex index)
Returns the rectangle of the item at position index in the model. |
QListView.ResizeMode |
resizeMode()
This property holds whether the items are laid out again when the view is resized. |
void |
setBatchSize(int batchSize)
This property holds the number of items laid out in each batch if layoutMode is set to Batched . |
void |
setFlow(QListView.Flow flow)
This property holds which direction the items layout should flow. |
void |
setGridSize(QSize size)
This property holds the size of the layout grid. |
void |
setLayoutMode(QListView.LayoutMode mode)
This property determines whether the layout of items should happen immediately or be delayed. |
void |
setModelColumn(int column)
This property holds the column in the model that is visible. |
void |
setMovement(QListView.Movement movement)
This property holds whether the items can be moved freely, are snapped to a grid, or cannot be moved at all. |
protected void |
setPositionForIndex(QPoint position,
QModelIndex index)
Sets the contents position of the item at index in the model to the given position. |
void |
setResizeMode(QListView.ResizeMode mode)
This property holds whether the items are laid out again when the view is resized. |
void |
setRowHidden(int row,
boolean hide)
If hide is true, the given row will be hidden; otherwise the row will be shown. |
void |
setSelectionRectVisible(boolean show)
This property holds if the selection rectangle should be visible. |
void |
setSpacing(int space)
This property holds the space between items in the layout. |
void |
setUniformItemSizes(boolean enable)
This property holds whether all items in the listview have the same size. |
void |
setViewMode(QListView.ViewMode mode)
This property holds the view mode of the QListView .. |
void |
setWordWrap(boolean on)
This property holds the item text word-wrapping policy. |
void |
setWrapping(boolean enable)
This property holds whether the items layout should wrap. |
int |
spacing()
This property holds the space between items in the layout. |
boolean |
uniformItemSizes()
This property holds whether all items in the listview have the same size. |
QListView.ViewMode |
viewMode()
This property holds the view mode of the QListView .. |
boolean |
wordWrap()
This property holds the item text word-wrapping policy. |
Methods inherited from class com.trolltech.qt.gui.QFrame |
---|
frameRect, frameShadow, frameShape, frameStyle, frameWidth, lineWidth, midLineWidth, setFrameRect, setFrameShadow, setFrameShape, setFrameStyle, setLineWidth, setMidLineWidth |
Methods inherited from class com.trolltech.qt.core.QObject |
---|
childEvent, children, connectSlotsByName, customEvent, disposeLater, dumpObjectInfo, dumpObjectTree, dynamicPropertyNames, event, eventFilter, findChild, findChild, findChild, findChildren, findChildren, findChildren, findChildren, indexOfProperty, installEventFilter, isWidgetType, killTimer, moveToThread, objectName, parent, properties, property, removeEventFilter, setObjectName, setParent, setProperty, startTimer, timerEvent, toString, userProperty |
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 |
---|
clone, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface com.trolltech.qt.QtJambiInterface |
---|
disableGarbageCollection, nativeId, nativePointer, reenableGarbageCollection, setJavaOwnership |
Field Detail |
---|
public final QSignalEmitter.Signal1 indexesMoved
Constructor Detail |
---|
public QListView()
QListView
with the given parent to view a model. Use setModel()
to set the model.
public QListView(QWidget parent)
QListView
with the given parent to view a model. Use setModel()
to set the model.
Method Detail |
---|
public final int batchSize()
layoutMode
is set to Batched
. The default value is 100.
public final void clearPropertyFlags()
QListView
-specific property flags. See viewMode
. Properties inherited from QAbstractItemView
are not covered by the property flags. Specifically, dragEnabled
and acceptDrops
are computed by QListView
when calling setMovement()
or setViewMode()
.
public final QListView.Flow flow()
LeftToRight
, the items will be laid out left to right. If the isWrapping
property is true, the layout will wrap when it reaches the right side of the visible area. If this property is TopToBottom
, the items will be laid out from the top of the visible area, wrapping when it reaches the bottom. Setting this property when the view is visible will cause the items to be laid out again.
viewMode
.
public final QSize gridSize()
spacing
property is ignored.) Setting this property when the view is visible will cause the items to be laid out again.
viewMode
.
public final boolean isRowHidden(int row)
public final boolean isSelectionRectVisible()
QAbstractItemView::SingleSelection
.
public final boolean isWrapping()
flow
property. Setting this property when the view is visible will cause the items to be laid out again.
viewMode
.
public final QListView.LayoutMode layoutMode()
SinglePass
(the default), the items are laid out all in one go. When the mode is Batched
, the items are laid out in batches of batchSize
items, while processing events. This makes it possible to instantly view and interact with the visible items while the rest are being laid out. viewMode
.
public final int modelColumn()
public final QListView.Movement movement()
Static
means that the items can't be moved the user. Free
means that the user can drag and drop the items to any position in the view. Snap
means that the user can drag and drop the items, but only to the positions in a notional grid signified by the gridSize
property. Setting this property when the view is visible will cause the items to be laid out again.
gridSize
, and viewMode
.
protected final QRect rectForIndex(QModelIndex index)
visualRect()
.
public final QListView.ResizeMode resizeMode()
Adjust
, the items will be laid out again when the view is resized. If the value is Fixed
, the items will not be laid out when the view is resized. viewMode
.
public final void setBatchSize(int batchSize)
layoutMode
is set to Batched
. The default value is 100.
public final void setFlow(QListView.Flow flow)
LeftToRight
, the items will be laid out left to right. If the isWrapping
property is true, the layout will wrap when it reaches the right side of the visible area. If this property is TopToBottom
, the items will be laid out from the top of the visible area, wrapping when it reaches the bottom. Setting this property when the view is visible will cause the items to be laid out again.
viewMode
.
public final void setGridSize(QSize size)
spacing
property is ignored.) Setting this property when the view is visible will cause the items to be laid out again.
viewMode
.
public final void setLayoutMode(QListView.LayoutMode mode)
SinglePass
(the default), the items are laid out all in one go. When the mode is Batched
, the items are laid out in batches of batchSize
items, while processing events. This makes it possible to instantly view and interact with the visible items while the rest are being laid out. viewMode
.
public final void setModelColumn(int column)
public final void setMovement(QListView.Movement movement)
Static
means that the items can't be moved the user. Free
means that the user can drag and drop the items to any position in the view. Snap
means that the user can drag and drop the items, but only to the positions in a notional grid signified by the gridSize
property. Setting this property when the view is visible will cause the items to be laid out again.
gridSize
, and viewMode
.
protected final void setPositionForIndex(QPoint position, QModelIndex index)
public final void setResizeMode(QListView.ResizeMode mode)
Adjust
, the items will be laid out again when the view is resized. If the value is Fixed
, the items will not be laid out when the view is resized. viewMode
.
public final void setRowHidden(int row, boolean hide)
isRowHidden()
.
public final void setSelectionRectVisible(boolean show)
QAbstractItemView::SingleSelection
.
public final void setSpacing(int space)
Setting this property when the view is visible will cause the items to be laid out again.
viewMode
.
public final void setUniformItemSizes(boolean enable)
public final void setViewMode(QListView.ViewMode mode)
QListView
.. This property will change the other unset properties to conform with the set view mode. QListView
-specific properties that have already been set will not be changed, unless clearPropertyFlags()
has been called. Setting the view mode will enable or disable drag and drop based on the selected movement. For ListMode
, the default movement is Static
(drag and drop disabled); for IconMode
, the default movement is Free
(drag and drop enabled).
isWrapping
, spacing
, gridSize
, flow
, movement
, and resizeMode
.
public final void setWordWrap(boolean on)
Please note that even if wrapping is enabled, the cell will not be expanded to make room for the text. It will print ellipsis for text that cannot be shown, according to the view's textElideMode
.
public final void setWrapping(boolean enable)
flow
property. Setting this property when the view is visible will cause the items to be laid out again.
viewMode
.
public final int spacing()
Setting this property when the view is visible will cause the items to be laid out again.
viewMode
.
public final boolean uniformItemSizes()
public final QListView.ViewMode viewMode()
QListView
.. This property will change the other unset properties to conform with the set view mode. QListView
-specific properties that have already been set will not be changed, unless clearPropertyFlags()
has been called. Setting the view mode will enable or disable drag and drop based on the selected movement. For ListMode
, the default movement is Static
(drag and drop disabled); for IconMode
, the default movement is Free
(drag and drop enabled).
isWrapping
, spacing
, gridSize
, flow
, movement
, and resizeMode
.
public final boolean wordWrap()
Please note that even if wrapping is enabled, the cell will not be expanded to make room for the text. It will print ellipsis for text that cannot be shown, according to the view's textElideMode
.
public static QListView fromNativePointer(QNativePointer nativePointer)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |