|
|
||||||||||
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. |
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.
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.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 slot is called when a new item becomes the current item. |
protected void |
dataChanged(QModelIndex topLeft,
QModelIndex bottomRight)
This slot is called when items are changed in the model. |
void |
doItemsLayout()
|
protected void |
dragLeaveEvent(QDragLeaveEvent e)
This function is called when the item being dragged leaves the view. |
protected void |
dragMoveEvent(QDragMoveEvent e)
This function is called continuously with the given event during a drag and drop operation over the widget. |
protected void |
dropEvent(QDropEvent e)
This function is called with the given event when a drop event occurs over the widget. |
boolean |
event(QEvent e)
This is the main event handler; it handles event arg__1. You can reimplement this function in a subclass, but we recommend using one of the specialized event handlers instead. Key press and release events are treated differently from other events. event checks for Tab and Shift+Tab and tries to move the focus appropriately. If there is no widget to move the focus to (or the key press is not Tab or Shift+Tab), event calls keyPressEvent. Mouse and tablet event handling is also slightly special: only when the widget is enabled, event will call the specialized handlers such as mousePressEvent; otherwise it will discard the event. This function returns true if the event was recognized, otherwise it returns false. If the recognized event was accepted (see QEvent::accepted), any further processing such as event propagation to the parent widget stops. |
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()
Returns the horizontal offset of the view. |
QModelIndex |
indexAt(QPoint p)
Returns the model index of the item at the viewport coordinates point. |
protected void |
internalDrag(Qt.DropAction... supportedActions)
|
protected void |
internalDrag(Qt.DropActions supportedActions)
|
protected void |
internalDrop(QDropEvent e)
|
protected boolean |
isIndexHidden(QModelIndex index)
Returns true if the item referred to by the given index is hidden in the view, otherwise returns false. |
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 called with the given event when a mouse move event is sent to the widget. |
protected void |
mouseReleaseEvent(QMouseEvent e)
This function is called with the given event when a mouse button is released, after a mouse press event on the widget. |
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 event handler can be reimplemented in a subclass to receive paint events (passed in arg__1), for the viewport widget. |
protected QRect |
rectForIndex(QModelIndex index)
Returns the rectangle of the item at position index in the model. |
void |
reset()
Reset the internal state of the view. |
protected void |
resizeContents(int width,
int height)
|
protected void |
resizeEvent(QResizeEvent e)
This function is called with the given event when a resize event is sent to the widget. |
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 slot is called when rows are about to be removed. |
protected void |
rowsInserted(QModelIndex parent,
int start,
int end)
This slot is called when rows are inserted. |
protected void |
scrollContentsBy(int dx,
int dy)
This virtual handler is called when the scroll bars are moved by dx, dy, and consequently the viewport's contents should be scrolled accordingly. |
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 convenience function returns a list of all selected and non-hidden item indexes in the view. |
protected void |
selectionChanged(QItemSelection selected,
QItemSelection deselected)
This slot is called when the selection is changed. |
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. |
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. |
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. |
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. |
void |
setRootIndex(QModelIndex index)
Sets the root item to the item at the given index. |
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. |
void |
setWordWrap(boolean on)
Sets the item text word-wrapping policy to on. |
void |
setWrapping(boolean enable)
Sets whether the items layout should wrap. |
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 called with the given event when a timer event is sent to the widget. |
boolean |
uniformItemSizes()
Returns whether all items in the listview have the same size. |
protected void |
updateGeometries()
|
protected int |
verticalOffset()
Returns the vertical offset of the view. |
QListView.ViewMode |
viewMode()
Returns the view mode of the QListView.. |
protected QStyleOptionViewItem |
viewOptions()
Returns a QStyleOptionViewItem structure populated with the view's palette, font, state, alignments etc. |
QRect |
visualRect(QModelIndex index)
Returns the rectangle on the viewport occupied by the item at index. |
protected QRegion |
visualRegionForSelection(QItemSelection selection)
Returns the region from the viewport of the items in the given selection. |
boolean |
wordWrap()
Returns the item text word-wrapping policy. |
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.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 |
---|
public final QSignalEmitter.Signal1<java.util.List<QModelIndex>> indexesMoved
Constructor Detail |
---|
public QListView()
Equivalent to QListView(0).
public QListView(QWidget parent)
Method Detail |
---|
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.
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.
protected final QSize contentsSize()
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.
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.
protected final void internalDrag(Qt.DropAction... supportedActions)
protected final void internalDrag(Qt.DropActions supportedActions)
protected final void internalDrop(QDropEvent e)
public final boolean isRowHidden(int row)
Returns true if the row is hidden; otherwise returns false.
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.
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.
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.
public final int modelColumn()
Returns the column in the model that is visible.
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.
protected final QRect rectForIndex(QModelIndex index)
Returns the rectangle of the item at position index in the model. The rectangle is in contents coordinates.
protected final void resizeContents(int width, int height)
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.
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.
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.
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.
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.
public final void setModelColumn(int column)
Sets the column in the model that is visible to column.
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.
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.
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.
public final void setRowHidden(int row, boolean hide)
If hide is true, the given row will be hidden; otherwise the row will be shown.
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.
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.
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.
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).
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.
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.
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.
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.
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).
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.
protected void currentChanged(QModelIndex current, QModelIndex previous)
This slot is called when a new item becomes the current item. The previous current item is specified by the previous index, and the new item by the current index.
If you want to know about changes to items see the dataChanged signal.
currentChanged
in class QAbstractItemView
protected void dataChanged(QModelIndex topLeft, QModelIndex bottomRight)
This slot is called when items are changed in the model. The changed items are those from topLeft to bottomRight inclusive. If just one item is changed topLeft == bottomRight.
dataChanged
in class QAbstractItemView
public void doItemsLayout()
doItemsLayout
in class QAbstractItemView
protected void dragLeaveEvent(QDragLeaveEvent e)
This function is called when the item being dragged leaves the view. The event describes the state of the drag and drop operation.
dragLeaveEvent
in class QAbstractItemView
protected void dragMoveEvent(QDragMoveEvent e)
This function is called continuously with the given event during a drag and drop operation over the widget. It can cause the view to scroll if, for example, the user drags a selection to view's right or bottom edge. In this case, the event will be accepted; otherwise it will be ignored.
dragMoveEvent
in class QAbstractItemView
protected void dropEvent(QDropEvent e)
This function is called with the given event when a drop event occurs over the widget. If the model accepts the even position the drop event is accepted; otherwise it is ignored.
dropEvent
in class QAbstractItemView
public boolean event(QEvent e)
This is the main event handler; it handles event arg__1. You can reimplement this function in a subclass, but we recommend using one of the specialized event handlers instead.
Key press and release events are treated differently from other events. event checks for Tab and Shift+Tab and tries to move the focus appropriately. If there is no widget to move the focus to (or the key press is not Tab or Shift+Tab), event calls keyPressEvent.
Mouse and tablet event handling is also slightly special: only when the widget is enabled, event will call the specialized handlers such as mousePressEvent; otherwise it will discard the event.
This function returns true if the event was recognized, otherwise it returns false. If the recognized event was accepted (see QEvent::accepted), any further processing such as event propagation to the parent widget stops.
event
in class QAbstractItemView
protected int horizontalOffset()
Returns the horizontal offset of the view.
In the base class this is a pure virtual function.
horizontalOffset
in class QAbstractItemView
public QModelIndex indexAt(QPoint p)
Returns the model index of the item at the viewport coordinates point.
In the base class this is a pure virtual function.
indexAt
in class QAbstractItemView
protected boolean isIndexHidden(QModelIndex index)
Returns true if the item referred to by the given index is hidden in the view, otherwise returns false.
Hiding is a view specific feature. For example in TableView a column can be marked as hidden or a row in the TreeView.
In the base class this is a pure virtual function.
isIndexHidden
in class QAbstractItemView
protected void mouseMoveEvent(QMouseEvent e)
This function is called with the given event when a mouse move event is sent to the widget. If a selection is in progress and new items are moved over the selection is extended; if a drag is in progress it is continued.
mouseMoveEvent
in class QAbstractItemView
protected void mouseReleaseEvent(QMouseEvent e)
This function is called with the given event when a mouse button is released, after a mouse press event on the widget. If a user presses the mouse inside your widget and then drags the mouse to another location before releasing the mouse button, your widget receives the release event. The function will emit the clicked signal if an item was being pressed.
mouseReleaseEvent
in class QAbstractItemView
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.
moveCursor
in class QAbstractItemView
protected void paintEvent(QPaintEvent e)
This event handler can be reimplemented in a subclass to receive paint events (passed in arg__1), for the viewport widget.
Note: If you open a painter, make sure to open it on the viewport.
paintEvent
in class QAbstractScrollArea
public void reset()
Reset the internal state of the view.
reset
in class QAbstractItemView
protected void resizeEvent(QResizeEvent e)
This function is called with the given event when a resize event is sent to the widget.
resizeEvent
in class QAbstractItemView
protected void rowsAboutToBeRemoved(QModelIndex parent, int start, int end)
This slot is called when rows are about to be removed. The deleted rows are those under the given parent from start to end inclusive.
rowsAboutToBeRemoved
in class QAbstractItemView
protected void rowsInserted(QModelIndex parent, int start, int end)
This slot is called when rows are inserted. The new rows are those under the given parent from start to end inclusive. The base class implementation calls fetchMore() on the model to check for more data.
rowsInserted
in class QAbstractItemView
protected void scrollContentsBy(int dx, int dy)
This virtual handler is called when the scroll bars are moved by dx, dy, and consequently the viewport's contents should be scrolled accordingly.
The default implementation simply calls update on the entire viewport, subclasses can reimplement this handler for optimization purposes, or - like QScrollArea - to move a contents widget. The parameters dx and dy are there for convenience, so that the class knows how much should be scrolled (useful e.g. when doing pixel-shifts). You may just as well ignore these values and scroll directly to the position the scroll bars indicate.
Calling this function in order to scroll programmatically is an error, use the scroll bars instead (e.g. by calling QScrollBar::setValue() directly).
scrollContentsBy
in class QAbstractScrollArea
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.
scrollTo
in class QAbstractItemView
protected java.util.List<QModelIndex> selectedIndexes()
This convenience function returns a list of all selected and non-hidden item indexes in the view. The list contains no duplicates, and is not sorted.
The default implementation does nothing.
selectedIndexes
in class QAbstractItemView
protected void selectionChanged(QItemSelection selected, QItemSelection deselected)
This slot is called when the selection is changed. The previous selection (which may be empty), is specified by deselected, and the new selection by selected.
selectionChanged
in class QAbstractItemView
public void setRootIndex(QModelIndex index)
Sets the root item to the item at the given index.
setRootIndex
in class QAbstractItemView
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.
setSelection
in class QAbstractItemView
protected void startDrag(Qt.DropActions supportedActions)
Starts a drag by calling drag->start() using the given supportedActions.
startDrag
in class QAbstractItemView
protected void timerEvent(QTimerEvent e)
This function is called with the given event when a timer event is sent to the widget.
timerEvent
in class QAbstractItemView
protected void updateGeometries()
updateGeometries
in class QAbstractItemView
protected int verticalOffset()
Returns the vertical offset of the view.
In the base class this is a pure virtual function.
verticalOffset
in class QAbstractItemView
protected QStyleOptionViewItem viewOptions()
Returns a QStyleOptionViewItem structure populated with the view's palette, font, state, alignments etc.
viewOptions
in class QAbstractItemView
public QRect visualRect(QModelIndex index)
Returns the rectangle on the viewport occupied by the item at index.
If your item is displayed in several areas then visualRect should return the primary area that contains index and not the complete area that index might encompasses, touch or cause drawing.
In the base class this is a pure virtual function.
visualRect
in class QAbstractItemView
protected QRegion visualRegionForSelection(QItemSelection selection)
Returns the region from the viewport of the items in the given selection.
In the base class this is a pure virtual function.
visualRegionForSelection
in class QAbstractItemView
public static QListView 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 |