Qt Jambi Home

com.trolltech.qt.gui
Class QListView

java.lang.Object
  extended by com.trolltech.qt.QSignalEmitter
      extended by com.trolltech.qt.QtJambiObject
          extended by com.trolltech.qt.core.QObject
              extended by com.trolltech.qt.gui.QWidget
                  extended by com.trolltech.qt.gui.QFrame
                      extended by com.trolltech.qt.gui.QAbstractScrollArea
                          extended by com.trolltech.qt.gui.QAbstractItemView
                              extended by com.trolltech.qt.gui.QListView
All Implemented Interfaces:
QPaintDeviceInterface, QtJambiInterface
Direct Known Subclasses:
QListWidget, QUndoView

public class QListView
extends QAbstractItemView

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.

Screenshot of a Windows XP style list viewScreenshot of a Macintosh style table viewScreenshot of a Plastique style table view
A Windows XP style list view.A Macintosh style list view.A Plastique style list view.

Improving Performance

It is possible to give the view hints about the data it is handling in order to improve its performance when displaying large numbers of items. One approach that can be taken for views that are intended to display items with equal sizes is to set the uniformItemSizes property to true.

See Also:
View Classes, QTreeView, QTableView, QListWidget

Nested Class Summary
static class QListView.Flow
          Press link for info on QListView.Flow
static class QListView.LayoutMode
          Press link for info on QListView.LayoutMode
static class QListView.Movement
          Press link for info on QListView.Movement
static class QListView.ResizeMode
          Press link for info on QListView.ResizeMode
static class QListView.ViewMode
          Press link for info on QListView.ViewMode
 
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.AbstractSignal, 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>
 
Field Summary
 QSignalEmitter.Signal1<java.util.List<QModelIndex>> indexesMoved
           
 
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()
          Equivalent to QListView(0).
QListView(QWidget parent)
          Creates a new QListView with the given parent to view a model.
 
Method Summary
 int batchSize()
          Returns the number of items laid out in each batch if layoutMode is set to Batched.
 void clearPropertyFlags()
          Clears the QListView-specific property flags.
protected  QSize contentsSize()
          
protected  void currentChanged(QModelIndex current, QModelIndex previous)
          This function is reimplemented for internal reasons.
protected  void dataChanged(QModelIndex topLeft, QModelIndex bottomRight)
          This function is reimplemented for internal reasons.
 void doItemsLayout()
          This function is reimplemented for internal reasons.
protected  void dragLeaveEvent(QDragLeaveEvent e)
          This function is reimplemented for internal reasons.
protected  void dragMoveEvent(QDragMoveEvent e)
          This function is reimplemented for internal reasons.
protected  void dropEvent(QDropEvent e)
          This function is reimplemented for internal reasons.
 boolean event(QEvent e)
          This function is reimplemented for internal reasons.
 QListView.Flow flow()
          Returns which direction the items layout should flow..
static QListView fromNativePointer(QNativePointer nativePointer)
          This function returns the QListView instance pointed to by nativePointer
 QSize gridSize()
          Returns the size of the layout grid.
protected  int horizontalOffset()
          This function is reimplemented for internal reasons.
 QModelIndex indexAt(QPoint p)
          This function is reimplemented for internal reasons.
protected  void internalDrag(Qt.DropAction... supportedActions)
          
protected  void internalDrag(Qt.DropActions supportedActions)
          
protected  void internalDrop(QDropEvent e)
          
protected  boolean isIndexHidden(QModelIndex index)
          This function is reimplemented for internal reasons.
 boolean isRowHidden(int row)
          Returns true if the row is hidden; otherwise returns false.
 boolean isSelectionRectVisible()
          Returns if the selection rectangle should be visible.
 boolean isWrapping()
          Returns whether the items layout should wrap..
 QListView.LayoutMode layoutMode()
          Returns whether the layout of items should happen immediately or be delayed..
 int modelColumn()
          Returns the column in the model that is visible.
protected  void mouseMoveEvent(QMouseEvent e)
          This function is reimplemented for internal reasons.
protected  void mouseReleaseEvent(QMouseEvent e)
          This function is reimplemented for internal reasons.
protected  QModelIndex moveCursor(QAbstractItemView.CursorAction cursorAction, Qt.KeyboardModifiers modifiers)
          Moves the cursor in the view according to the given cursorAction and keyboard modifiers specified by modifiers.
 QListView.Movement movement()
          Returns whether the items can be moved freely, are snapped to a grid, or cannot be moved at all..
protected  void paintEvent(QPaintEvent e)
          This function is reimplemented for internal reasons.
protected  QRect rectForIndex(QModelIndex index)
          Returns the rectangle of the item at position index in the model.
 void reset()
          This function is reimplemented for internal reasons.
protected  void resizeContents(int width, int height)
          
protected  void resizeEvent(QResizeEvent e)
          This function is reimplemented for internal reasons.
 QListView.ResizeMode resizeMode()
          Returns whether the items are laid out again when the view is resized..
protected  void rowsAboutToBeRemoved(QModelIndex parent, int start, int end)
          This function is reimplemented for internal reasons.
protected  void rowsInserted(QModelIndex parent, int start, int end)
          This function is reimplemented for internal reasons.
protected  void scrollContentsBy(int dx, int dy)
          This function is reimplemented for internal reasons.
 void scrollTo(QModelIndex index, QAbstractItemView.ScrollHint hint)
          Scrolls the view if necessary to ensure that the item at index is visible.
protected  java.util.List<QModelIndex> selectedIndexes()
          This function is reimplemented for internal reasons.
protected  void selectionChanged(QItemSelection selected, QItemSelection deselected)
          This function is reimplemented for internal reasons.
 void setBatchSize(int batchSize)
          Sets the number of items laid out in each batch if layoutMode is set to Batched to batchSize.
 void setFlow(QListView.Flow flow)
          Sets which direction the items layout should flow. to flow.
 void setGridSize(QSize size)
          Sets the size of the layout grid to size.
 void setLayoutMode(QListView.LayoutMode mode)
          Sets whether the layout of items should happen immediately or be delayed. to mode.
 void setModelColumn(int column)
          Sets the column in the model that is visible to column.
 void setMovement(QListView.Movement movement)
          Sets whether the items can be moved freely, are snapped to a grid, or cannot be moved at all. to movement.
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)
          Sets whether the items are laid out again when the view is resized. to mode.
 void setRootIndex(QModelIndex index)
          This function is reimplemented for internal reasons.
 void setRowHidden(int row, boolean hide)
          If hide is true, the given row will be hidden; otherwise the row will be shown.
protected  void setSelection(QRect rect, QItemSelectionModel.SelectionFlags command)
          Applies the selection command to the items in or touched by the rectangle, rect.
 void setSelectionRectVisible(boolean show)
          Sets if the selection rectangle should be visible to show.
 void setSpacing(int space)
          Sets the space between items in the layout to space.
 void setUniformItemSizes(boolean enable)
          Sets whether all items in the listview have the same size to enable.
 void setViewMode(QListView.ViewMode mode)
          Sets the view mode of the QListView. to mode.
 void setWordWrap(boolean on)
          Sets the item text word-wrapping policy to on.
 void setWrapping(boolean enable)
          Sets whether the items layout should wrap. to enable.
 int spacing()
          Returns the space between items in the layout.
protected  void startDrag(Qt.DropActions supportedActions)
          Starts a drag by calling drag->start() using the given supportedActions.
protected  void timerEvent(QTimerEvent e)
          This function is reimplemented for internal reasons.
 boolean uniformItemSizes()
          Returns whether all items in the listview have the same size.
protected  void updateGeometries()
          This function is reimplemented for internal reasons.
protected  int verticalOffset()
          This function is reimplemented for internal reasons.
 QListView.ViewMode viewMode()
          Returns the view mode of the QListView..
protected  QStyleOptionViewItem viewOptions()
          This function is reimplemented for internal reasons.
 QRect visualRect(QModelIndex index)
          This function is reimplemented for internal reasons.
protected  QRegion visualRegionForSelection(QItemSelection selection)
          This function is reimplemented for internal reasons.
 boolean wordWrap()
          Returns the item text word-wrapping policy.
 
Methods inherited from class com.trolltech.qt.gui.QAbstractItemView
alternatingRowColors, clearSelection, closeEditor, closePersistentEditor, commitData, currentIndex, dirtyRegionOffset, doAutoScroll, dragDropMode, dragDropOverwriteMode, dragEnabled, dragEnterEvent, dropIndicatorPosition, edit, edit, editorDestroyed, editTriggers, executeDelayedItemsLayout, focusInEvent, focusNextPrevChild, focusOutEvent, hasAutoScroll, horizontalScrollbarAction, horizontalScrollbarValueChanged, horizontalScrollMode, iconSize, indexWidget, inputMethodEvent, inputMethodQuery, itemDelegate, itemDelegate, itemDelegateForColumn, itemDelegateForRow, keyboardSearch, keyPressEvent, model, mouseDoubleClickEvent, mousePressEvent, openPersistentEditor, rootIndex, scheduleDelayedItemsLayout, scrollDirtyRegion, scrollTo, scrollToBottom, scrollToTop, selectAll, selectionBehavior, selectionCommand, selectionCommand, selectionMode, selectionModel, setAlternatingRowColors, setAutoScroll, setCurrentIndex, setDirtyRegion, setDragDropMode, setDragDropOverwriteMode, setDragEnabled, setDropIndicatorShown, setEditTriggers, setEditTriggers, setHorizontalScrollMode, setIconSize, setIndexWidget, setItemDelegate, setItemDelegateForColumn, setItemDelegateForRow, setModel, setSelectionBehavior, setSelectionMode, setSelectionModel, setState, setTabKeyNavigation, setTextElideMode, setVerticalScrollMode, showDropIndicator, sizeHintForColumn, sizeHintForIndex, sizeHintForRow, startAutoScroll, startDrag, state, stopAutoScroll, tabKeyNavigation, textElideMode, update, updateEditorData, updateEditorGeometries, verticalScrollbarAction, verticalScrollbarValueChanged, verticalScrollMode, viewportEvent
 
Methods inherited from class com.trolltech.qt.gui.QAbstractScrollArea
addScrollBarWidget, addScrollBarWidget, contextMenuEvent, cornerWidget, horizontalScrollBar, horizontalScrollBarPolicy, maximumViewportSize, minimumSizeHint, paintEngine, scrollBarWidgets, scrollBarWidgets, setCornerWidget, setHorizontalScrollBar, setHorizontalScrollBarPolicy, setupViewport, setVerticalScrollBar, setVerticalScrollBarPolicy, setViewport, setViewportMargins, sizeHint, verticalScrollBar, verticalScrollBarPolicy, viewport, wheelEvent
 
Methods inherited from class com.trolltech.qt.gui.QFrame
changeEvent, drawFrame, frameRect, frameShadow, frameShape, frameStyle, frameWidth, lineWidth, midLineWidth, setFrameRect, setFrameShadow, setFrameShape, setFrameStyle, setLineWidth, setMidLineWidth
 
Methods inherited from class com.trolltech.qt.gui.QWidget
acceptDrops, accessibleDescription, accessibleName, actionEvent, actions, activateWindow, addAction, addActions, adjustSize, autoFillBackground, backgroundRole, baseSize, childAt, childAt, childrenRect, childrenRegion, clearFocus, clearMask, close, closeEvent, contentsRect, contextMenuPolicy, createWinId, cursor, depth, destroy, destroy, destroy, devType, ensurePolished, enterEvent, focusNextChild, focusPolicy, focusPreviousChild, focusProxy, focusWidget, font, fontInfo, fontMetrics, foregroundRole, frameGeometry, frameSize, geometry, getContentsMargins, grabKeyboard, grabMouse, grabMouse, grabShortcut, grabShortcut, hasFocus, hasMouseTracking, height, heightForWidth, heightMM, hide, hideEvent, inputContext, insertAction, insertActions, isActiveWindow, isAncestorOf, isEnabled, isEnabledTo, isFullScreen, isHidden, isLeftToRight, isMaximized, isMinimized, isModal, isRightToLeft, isVisible, isVisibleTo, isWindow, isWindowModified, keyboardGrabber, keyReleaseEvent, layout, layoutDirection, leaveEvent, locale, logicalDpiX, logicalDpiY, lower, mapFrom, mapFromGlobal, mapFromParent, mapTo, mapToGlobal, mapToParent, mask, maximumHeight, maximumSize, maximumWidth, metric, minimumHeight, minimumSize, minimumWidth, mouseGrabber, move, move, moveEvent, nextInFocusChain, normalGeometry, numColors, overrideWindowFlags, overrideWindowFlags, overrideWindowState, overrideWindowState, paintingActive, palette, parentWidget, physicalDpiX, physicalDpiY, pos, raise, rect, releaseKeyboard, releaseMouse, releaseShortcut, removeAction, render, render, render, render, render, repaint, repaint, repaint, repaint, resetInputContext, resize, resize, restoreGeometry, saveGeometry, scroll, scroll, setAcceptDrops, setAccessibleDescription, setAccessibleName, setAttribute, setAttribute, setAutoFillBackground, setBackgroundRole, setBaseSize, setBaseSize, setContentsMargins, setContentsMargins, setContextMenuPolicy, setCursor, setDisabled, setEnabled, setFixedHeight, setFixedSize, setFixedSize, setFixedWidth, setFocus, setFocus, setFocusPolicy, setFocusProxy, setFont, setForegroundRole, setGeometry, setGeometry, setHidden, setInputContext, setLayout, setLayoutDirection, setLocale, setMask, setMask, setMaximumHeight, setMaximumSize, setMaximumSize, setMaximumWidth, setMinimumHeight, setMinimumSize, setMinimumSize, setMinimumWidth, setMouseTracking, setPalette, setParent, setParent, setParent, setShortcutAutoRepeat, setShortcutAutoRepeat, setShortcutEnabled, setShortcutEnabled, setSizeIncrement, setSizeIncrement, setSizePolicy, setSizePolicy, setStatusTip, setStyle, setStyleSheet, setTabOrder, setToolTip, setUpdatesEnabled, setVisible, setWhatsThis, setWindowFlags, setWindowFlags, setWindowIcon, setWindowIconText, setWindowModality, setWindowModified, setWindowOpacity, setWindowRole, setWindowState, setWindowState, setWindowTitle, show, showEvent, showFullScreen, showMaximized, showMinimized, showNormal, size, sizeIncrement, sizePolicy, stackUnder, statusTip, style, styleSheet, tabletEvent, testAttribute, toolTip, underMouse, unsetCursor, unsetLayoutDirection, unsetLocale, update, update, update, update, updateGeometry, updateMicroFocus, updatesEnabled, visibleRegion, whatsThis, width, widthMM, window, windowFlags, windowIcon, windowIconText, windowModality, windowOpacity, windowRole, windowState, windowTitle, windowType, winId, x, y
 
Methods inherited from class com.trolltech.qt.core.QObject
blockSignals, childEvent, children, connectSlotsByName, customEvent, disposeLater, dumpObjectInfo, dumpObjectTree, dynamicPropertyNames, eventFilter, findChild, findChild, findChild, findChildren, findChildren, findChildren, findChildren, installEventFilter, isWidgetType, killTimer, moveToThread, objectName, parent, property, removeEventFilter, setObjectName, setParent, setProperty, signalsBlocked, startTimer, thread
 
Methods inherited from class com.trolltech.qt.QtJambiObject
dispose, disposed, finalize, reassignNativeResources, tr, tr, tr
 
Methods inherited from class com.trolltech.qt.QSignalEmitter
disconnect, disconnect, signalSender
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.trolltech.qt.QtJambiInterface
disableGarbageCollection, nativeId, nativePointer, reenableGarbageCollection, setJavaOwnership
 

Field Detail

indexesMoved

public final QSignalEmitter.Signal1<java.util.List<QModelIndex>> indexesMoved
Constructor Detail

QListView

public QListView()

Equivalent to QListView(0).


QListView

public QListView(QWidget parent)

Creates a new QListView with the given parent to view a model. Use setModel to set the model.

Method Detail

batchSize

public final int batchSize()

Returns the number of items laid out in each batch if layoutMode is set to Batched.

The default value is 100.

See Also:
setBatchSize

clearPropertyFlags

public final void clearPropertyFlags()

Clears the 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.


contentsSize

protected final QSize contentsSize()


flow

public final QListView.Flow flow()

Returns which direction the items layout should flow..

If this property is 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.

See Also:
setFlow, viewMode

gridSize

public final QSize gridSize()

Returns the size of the layout grid.

This property is the size of the grid in which the items are laid out. The default is an empty size which means that there is no grid and the layout is not done in a grid. Setting this property to a non-empty size switches on the grid layout. (When a grid layout is in force the spacing property is ignored.)

Setting this property when the view is visible will cause the items to be laid out again.

See Also:
setGridSize, viewMode

internalDrag

protected final void internalDrag(Qt.DropAction... supportedActions)


internalDrag

protected final void internalDrag(Qt.DropActions supportedActions)


internalDrop

protected final void internalDrop(QDropEvent e)


isRowHidden

public final boolean isRowHidden(int row)

Returns true if the row is hidden; otherwise returns false.


isSelectionRectVisible

public final boolean isSelectionRectVisible()

Returns if the selection rectangle should be visible.

If this property is true then the selection rectangle is visible; otherwise it will be hidden. Note that the selection rectangle will only be visible if the selection mode is in a mode where more than one item can be selected, i.e. it will not draw a selection rectangle if the selection mode is QAbstractItemView::SingleSelection.


isWrapping

public final boolean isWrapping()

Returns whether the items layout should wrap..

This property holds whether the layout should wrap when there is no more space in the visible area. The point at which the layout wraps depends on the flow property.

Setting this property when the view is visible will cause the items to be laid out again.

See Also:
viewMode

layoutMode

public final QListView.LayoutMode layoutMode()

Returns whether the layout of items should happen immediately or be delayed..

This property holds the layout mode for the items. When the mode is 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.

See Also:
setLayoutMode, viewMode

modelColumn

public final int modelColumn()

Returns the column in the model that is visible.

See Also:
setModelColumn

movement

public final QListView.Movement movement()

Returns whether the items can be moved freely, are snapped to a grid, or cannot be moved at all..

This property determines how the user can move the items in the view. 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.

See Also:
setMovement, gridSize, viewMode

rectForIndex

protected final QRect rectForIndex(QModelIndex index)

Returns the rectangle of the item at position index in the model. The rectangle is in contents coordinates.

See Also:
visualRect

resizeContents

protected final void resizeContents(int width,
                                    int height)


resizeMode

public final QListView.ResizeMode resizeMode()

Returns whether the items are laid out again when the view is resized..

If this property is 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.

See Also:
setResizeMode, viewMode

setBatchSize

public final void setBatchSize(int batchSize)

Sets the number of items laid out in each batch if layoutMode is set to Batched to batchSize.

The default value is 100.

See Also:
batchSize

setFlow

public final void setFlow(QListView.Flow flow)

Sets which direction the items layout should flow. to flow.

If this property is 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.

See Also:
flow, viewMode

setGridSize

public final void setGridSize(QSize size)

Sets the size of the layout grid to size.

This property is the size of the grid in which the items are laid out. The default is an empty size which means that there is no grid and the layout is not done in a grid. Setting this property to a non-empty size switches on the grid layout. (When a grid layout is in force the spacing property is ignored.)

Setting this property when the view is visible will cause the items to be laid out again.

See Also:
gridSize, viewMode

setLayoutMode

public final void setLayoutMode(QListView.LayoutMode mode)

Sets whether the layout of items should happen immediately or be delayed. to mode.

This property holds the layout mode for the items. When the mode is 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.

See Also:
layoutMode, viewMode

setModelColumn

public final void setModelColumn(int column)

Sets the column in the model that is visible to column.

See Also:
modelColumn

setMovement

public final void setMovement(QListView.Movement movement)

Sets whether the items can be moved freely, are snapped to a grid, or cannot be moved at all. to movement.

This property determines how the user can move the items in the view. 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.

See Also:
movement, gridSize, viewMode

setPositionForIndex

protected final void setPositionForIndex(QPoint position,
                                         QModelIndex index)

Sets the contents position of the item at index in the model to the given position. If the list view's movement mode is Static, this function will have no effect.


setResizeMode

public final void setResizeMode(QListView.ResizeMode mode)

Sets whether the items are laid out again when the view is resized. to mode.

If this property is 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.

See Also:
resizeMode, viewMode

setRowHidden

public final void setRowHidden(int row,
                               boolean hide)

If hide is true, the given row will be hidden; otherwise the row will be shown.

See Also:
isRowHidden

setSelectionRectVisible

public final void setSelectionRectVisible(boolean show)

Sets if the selection rectangle should be visible to show.

If this property is true then the selection rectangle is visible; otherwise it will be hidden. Note that the selection rectangle will only be visible if the selection mode is in a mode where more than one item can be selected, i.e. it will not draw a selection rectangle if the selection mode is QAbstractItemView::SingleSelection.

See Also:
isSelectionRectVisible

setSpacing

public final void setSpacing(int space)

Sets the space between items in the layout to space.

This property is the size of the empty space that is padded around an item in the layout.

Setting this property when the view is visible will cause the items to be laid out again.

See Also:
spacing, viewMode

setUniformItemSizes

public final void setUniformItemSizes(boolean enable)

Sets whether all items in the listview have the same size to enable.

This property should only be set to true if it is guaranteed that all items in the view have the same size. This enables the view to do some optimizations.

See Also:
uniformItemSizes

setViewMode

public final void setViewMode(QListView.ViewMode mode)

Sets the view mode of the QListView. to mode.

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).

See Also:
viewMode, isWrapping, spacing, gridSize, flow, movement, resizeMode

setWordWrap

public final void setWordWrap(boolean on)

Sets the item text word-wrapping policy to on.

If this property is true then the item text is wrapped where necessary at word-breaks; otherwise it is not wrapped at all. This property is false by default.

See Also:
wordWrap

setWrapping

public final void setWrapping(boolean enable)

Sets whether the items layout should wrap. to enable.

This property holds whether the layout should wrap when there is no more space in the visible area. The point at which the layout wraps depends on the flow property.

Setting this property when the view is visible will cause the items to be laid out again.

See Also:
isWrapping, viewMode

spacing

public final int spacing()

Returns the space between items in the layout.

This property is the size of the empty space that is padded around an item in the layout.

Setting this property when the view is visible will cause the items to be laid out again.

See Also:
setSpacing, viewMode

uniformItemSizes

public final boolean uniformItemSizes()

Returns whether all items in the listview have the same size.

This property should only be set to true if it is guaranteed that all items in the view have the same size. This enables the view to do some optimizations.

See Also:
setUniformItemSizes

viewMode

public final QListView.ViewMode viewMode()

Returns the view mode of the 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).

See Also:
setViewMode, isWrapping, spacing, gridSize, flow, movement, resizeMode

wordWrap

public final boolean wordWrap()

Returns the item text word-wrapping policy.

If this property is true then the item text is wrapped where necessary at word-breaks; otherwise it is not wrapped at all. This property is false by default.

See Also:
setWordWrap

currentChanged

protected void currentChanged(QModelIndex current,
                              QModelIndex previous)

This function is reimplemented for internal reasons.

Overrides:
currentChanged in class QAbstractItemView

dataChanged

protected void dataChanged(QModelIndex topLeft,
                           QModelIndex bottomRight)

This function is reimplemented for internal reasons.

Overrides:
dataChanged in class QAbstractItemView

doItemsLayout

public void doItemsLayout()

This function is reimplemented for internal reasons.

Overrides:
doItemsLayout in class QAbstractItemView

dragLeaveEvent

protected void dragLeaveEvent(QDragLeaveEvent e)

This function is reimplemented for internal reasons.

Overrides:
dragLeaveEvent in class QAbstractItemView
See Also:
QWidget::dragLeaveEvent

dragMoveEvent

protected void dragMoveEvent(QDragMoveEvent e)

This function is reimplemented for internal reasons.

Overrides:
dragMoveEvent in class QAbstractItemView
See Also:
dropEvent, startDrag

dropEvent

protected void dropEvent(QDropEvent e)

This function is reimplemented for internal reasons.

Overrides:
dropEvent in class QAbstractItemView
See Also:
startDrag

event

public boolean event(QEvent e)

This function is reimplemented for internal reasons.

Overrides:
event in class QAbstractItemView
See Also:
QEvent::type

horizontalOffset

protected int horizontalOffset()

This function is reimplemented for internal reasons.

Specified by:
horizontalOffset in class QAbstractItemView
See Also:
verticalOffset

indexAt

public QModelIndex indexAt(QPoint p)

This function is reimplemented for internal reasons.

Specified by:
indexAt in class QAbstractItemView
See Also:
visualRect

isIndexHidden

protected boolean isIndexHidden(QModelIndex index)

This function is reimplemented for internal reasons.

Specified by:
isIndexHidden in class QAbstractItemView

mouseMoveEvent

protected void mouseMoveEvent(QMouseEvent e)

This function is reimplemented for internal reasons.

Overrides:
mouseMoveEvent in class QAbstractItemView
See Also:
QWidget::mouseMoveEvent

mouseReleaseEvent

protected void mouseReleaseEvent(QMouseEvent e)

This function is reimplemented for internal reasons.

Overrides:
mouseReleaseEvent in class QAbstractItemView
See Also:
QWidget::mouseReleaseEvent

moveCursor

protected QModelIndex moveCursor(QAbstractItemView.CursorAction cursorAction,
                                 Qt.KeyboardModifiers modifiers)

Moves the cursor in the view according to the given cursorAction and keyboard modifiers specified by modifiers.

In the base class this is a pure virtual function.

Specified by:
moveCursor in class QAbstractItemView

paintEvent

protected void paintEvent(QPaintEvent e)

This function is reimplemented for internal reasons.

Overrides:
paintEvent in class QAbstractScrollArea
See Also:
QWidget::paintEvent

reset

public void reset()

This function is reimplemented for internal reasons.

Overrides:
reset in class QAbstractItemView

resizeEvent

protected void resizeEvent(QResizeEvent e)

This function is reimplemented for internal reasons.

Overrides:
resizeEvent in class QAbstractItemView
See Also:
QWidget::resizeEvent

rowsAboutToBeRemoved

protected void rowsAboutToBeRemoved(QModelIndex parent,
                                    int start,
                                    int end)

This function is reimplemented for internal reasons.

Overrides:
rowsAboutToBeRemoved in class QAbstractItemView
See Also:
rowsInserted

rowsInserted

protected void rowsInserted(QModelIndex parent,
                            int start,
                            int end)

This function is reimplemented for internal reasons.

Overrides:
rowsInserted in class QAbstractItemView
See Also:
rowsAboutToBeRemoved

scrollContentsBy

protected void scrollContentsBy(int dx,
                                int dy)

This function is reimplemented for internal reasons.

Overrides:
scrollContentsBy in class QAbstractScrollArea

scrollTo

public void scrollTo(QModelIndex index,
                     QAbstractItemView.ScrollHint hint)

Scrolls the view if necessary to ensure that the item at index is visible. The view will try to position the item according to the given hint.

In the base class this is a pure virtual function.

Specified by:
scrollTo in class QAbstractItemView

selectedIndexes

protected java.util.List<QModelIndex> selectedIndexes()

This function is reimplemented for internal reasons.

Overrides:
selectedIndexes in class QAbstractItemView
See Also:
QItemSelectionModel::selectedIndexes

selectionChanged

protected void selectionChanged(QItemSelection selected,
                                QItemSelection deselected)

This function is reimplemented for internal reasons.

Overrides:
selectionChanged in class QAbstractItemView
See Also:
setSelection

setRootIndex

public void setRootIndex(QModelIndex index)

This function is reimplemented for internal reasons.

Overrides:
setRootIndex in class QAbstractItemView
See Also:
rootIndex

setSelection

protected void setSelection(QRect rect,
                            QItemSelectionModel.SelectionFlags command)

Applies the selection command to the items in or touched by the rectangle, rect.

When implementing your own itemview setSelection should call selectionModel->select(selection, flags) where selection is either an empty QModelIndex or a QItemSelection that contains all items that are contained in rect.

Specified by:
setSelection in class QAbstractItemView
See Also:
selectionCommand, selectedIndexes

startDrag

protected void startDrag(Qt.DropActions supportedActions)

Starts a drag by calling drag->start() using the given supportedActions.

Overrides:
startDrag in class QAbstractItemView

timerEvent

protected void timerEvent(QTimerEvent e)

This function is reimplemented for internal reasons.

Overrides:
timerEvent in class QAbstractItemView
See Also:
QObject::timerEvent

updateGeometries

protected void updateGeometries()

This function is reimplemented for internal reasons.

Overrides:
updateGeometries in class QAbstractItemView

verticalOffset

protected int verticalOffset()

This function is reimplemented for internal reasons.

Specified by:
verticalOffset in class QAbstractItemView
See Also:
horizontalOffset

viewOptions

protected QStyleOptionViewItem viewOptions()

This function is reimplemented for internal reasons.

Overrides:
viewOptions in class QAbstractItemView

visualRect

public QRect visualRect(QModelIndex index)

This function is reimplemented for internal reasons.

Specified by:
visualRect in class QAbstractItemView
See Also:
indexAt, visualRegionForSelection

visualRegionForSelection

protected QRegion visualRegionForSelection(QItemSelection selection)

This function is reimplemented for internal reasons.

Specified by:
visualRegionForSelection in class QAbstractItemView
See Also:
visualRect, selectedIndexes

fromNativePointer

public static QListView fromNativePointer(QNativePointer nativePointer)
This function returns the QListView instance pointed to by nativePointer

Parameters:
nativePointer - the QNativePointer of which object should be returned.

Qt Jambi Home