Qt Jambi Home

com.trolltech.qt.gui
Class QAbstractItemView

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
All Implemented Interfaces:
QPaintDeviceInterface, QtJambiInterface
Direct Known Subclasses:
QColumnView, QHeaderView, QListView, QTableView, QTreeView

public abstract class QAbstractItemView
extends QAbstractScrollArea

The QAbstractItemView class provides the basic functionality for item view classes.

QAbstractItemView class is the base class for every standard view that uses a QAbstractItemModel. QAbstractItemView is an abstract class and cannot itself be instantiated. It provides a standard interface for interoperating with models through the signals and slots mechanism, enabling subclasses to be kept up-to-date with changes to their models. This class provides standard support for keyboard and mouse navigation, viewport scrolling, item editing, and selections.

The QAbstractItemView class is one of the Model/View Classes and is part of Qt's model/view framework.

The view classes that inherit QAbstractItemView only need to implement their own view-specific functionality, such as drawing items, returning the geometry of items, finding items, etc.

QAbstractItemView provides common slots such as edit and setCurrentIndex. Many protected slots are also provided, including dataChanged, rowsInserted, rowsAboutToBeRemoved, selectionChanged, and currentChanged.

The root item is returned by rootIndex, and the current item by currentIndex. To make sure that an item is visible use scrollTo.

Some of QAbstractItemView's functions are concerned with scrolling, for example setHorizontalScrollMode and setVerticalScrollMode. To set the range of the scroll bars, you can, for example, reimplement the view's resizeEvent function:

    void MyView::resizeEvent(QResizeEvent *event) {
        horizontalScrollBar()->setRange(0, realWidth - width());
        ...
    }

Note that the range is not updated until the widget is shown.

Several other functions are concerned with selection control; for example setSelectionMode, and setSelectionBehavior. This class provides a default selection model to work with (selectionModel), but this can be replaced by using setSelectionModel with an instance of QItemSelectionModel.

For complete control over the display and editing of items you can specify a delegate with setItemDelegate.

QAbstractItemView provides a lot of protected functions. Some are concerned with editing, for example, edit, and commitData, whilst others are keyboard and mouse event handlers.

See Also:
View Classes, Model/View Programming, QAbstractItemModel, Example

Nested Class Summary
static class QAbstractItemView.CursorAction
          This enum describes the different ways to navigate between items,
static class QAbstractItemView.DragDropMode
          Describes the various drag and drop events the view can act upon.
static class QAbstractItemView.DropIndicatorPosition
          This enum indicates the position of the drop indicator in relation to the index at the current mouse position.
static class QAbstractItemView.EditTrigger
          This enum describes actions which will initiate item editing.
static class QAbstractItemView.EditTriggers
          This QFlag class provides flags for the int enum.
static class QAbstractItemView.ScrollHint
          Press link for info on QAbstractItemView.ScrollHint
static class QAbstractItemView.ScrollMode
          Press link for info on QAbstractItemView.ScrollMode
static class QAbstractItemView.SelectionBehavior
          Press link for info on QAbstractItemView.SelectionBehavior
static class QAbstractItemView.SelectionMode
          This enum indicates how the view responds to user selections.
static class QAbstractItemView.State
          Describes the different states the view can be in.
 
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<QModelIndex> activated
          This signal is emitted when the item specified by index is activated by the user.
 QSignalEmitter.Signal1<QModelIndex> clicked
          This signal is emitted when a mouse button is clicked.
 QSignalEmitter.Signal1<QModelIndex> doubleClicked
          This signal is emitted when a mouse button is double-clicked.
 QSignalEmitter.Signal1<QModelIndex> entered
          This signal is emitted when the mouse cursor enters the item specified by index.
 QSignalEmitter.Signal1<QModelIndex> pressed
          This signal is emitted when a mouse button is pressed.
 QSignalEmitter.Signal0 viewportEntered
          This signal is emitted when the mouse cursor enters the viewport.
 
Fields inherited from class com.trolltech.qt.gui.QWidget
customContextMenuRequested
 
Constructor Summary
QAbstractItemView()
          Equivalent to QAbstractItemView(0).
QAbstractItemView(QWidget parent)
          Constructs an abstract item view with the given parent.
 
Method Summary
 boolean alternatingRowColors()
          Returns whether to draw the background using alternating colors.
 void clearSelection()
          Clears all selected items.
protected  void closeEditor(QWidget editor, QAbstractItemDelegate.EndEditHint hint)
          Closes the given editor, and releases it.
 void closePersistentEditor(QModelIndex index)
          Closes the persistent editor for the item at the given index.
protected  void commitData(QWidget editor)
          Commit the data in the editor to the model.
protected  void currentChanged(QModelIndex current, QModelIndex previous)
          This slot is called when a new item becomes the current item.
 QModelIndex currentIndex()
          Returns the model index of the current item.
protected  void dataChanged(QModelIndex topLeft, QModelIndex bottomRight)
          This slot is called when items are changed in the model.
protected  QPoint dirtyRegionOffset()
          Returns the offset of the dirty regions in the view.
protected  void doAutoScroll()
          
 void doItemsLayout()
          
 QAbstractItemView.DragDropMode dragDropMode()
          Returns the drag and drop event the view will act upon.
 boolean dragDropOverwriteMode()
          Returns the view's drag and drop behavior.
 boolean dragEnabled()
          Returns whether the view supports dragging of its own items.
protected  void dragEnterEvent(QDragEnterEvent event)
          This function is called with the given event when a drag and drop operation enters the widget.
protected  void dragLeaveEvent(QDragLeaveEvent event)
          This function is called when the item being dragged leaves the view.
protected  void dragMoveEvent(QDragMoveEvent event)
          This function is called continuously with the given event during a drag and drop operation over the widget.
protected  void dropEvent(QDropEvent event)
          This function is called with the given event when a drop event occurs over the widget.
protected  QAbstractItemView.DropIndicatorPosition dropIndicatorPosition()
          Returns the position of the drop indicator in relation to the closest item.
 void edit(QModelIndex index)
          Starts editing the item corresponding to the given index if it is editable.
protected  boolean edit(QModelIndex index, QAbstractItemView.EditTrigger trigger, QEvent event)
          Starts editing the item at index, creating an editor if necessary, and returns true if the view's State is now EditingState; otherwise returns false.
protected  void editorDestroyed(QObject editor)
          This function is called when the given editor has been destroyed.
 QAbstractItemView.EditTriggers editTriggers()
          Returns which actions will initiate item editing.
 boolean event(QEvent event)
          

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.

protected  void executeDelayedItemsLayout()
          Executes the scheduled layouts without waiting for the event processing to begin.
protected  void focusInEvent(QFocusEvent event)
          This function is called with the given event when the widget obtains the focus.
protected  boolean focusNextPrevChild(boolean next)
          

Finds a new widget to give the keyboard focus to, as appropriate for Tab and Shift+Tab, and returns true if it can find a new widget, or false if it can't.

protected  void focusOutEvent(QFocusEvent event)
          This function is called with the given event when the widget looses the focus.
static QAbstractItemView fromNativePointer(QNativePointer nativePointer)
          This function returns the QAbstractItemView instance pointed to by nativePointer
 boolean hasAutoScroll()
          Returns whether autoscrolling in drag move events is enabled.
protected abstract  int horizontalOffset()
          Returns the horizontal offset of the view.
protected  void horizontalScrollbarAction(int action)
          
protected  void horizontalScrollbarValueChanged(int value)
          
 QAbstractItemView.ScrollMode horizontalScrollMode()
          Returns how the view scrolls its contents in the horizontal direction.
 QSize iconSize()
          Returns the size of items.
abstract  QModelIndex indexAt(QPoint point)
          Returns the model index of the item at the viewport coordinates point.
 QWidget indexWidget(QModelIndex index)
          Returns the widget for the item at the given index.
protected  void inputMethodEvent(QInputMethodEvent event)
          

This event handler, for event arg__1, can be reimplemented in a subclass to receive Input Method composition events.

 java.lang.Object inputMethodQuery(Qt.InputMethodQuery query)
          

This method is only relevant for input widgets.

protected abstract  boolean isIndexHidden(QModelIndex index)
          Returns true if the item referred to by the given index is hidden in the view, otherwise returns false.
 QAbstractItemDelegate itemDelegate()
          Returns the item delegate used by this view and model.
 QAbstractItemDelegate itemDelegate(QModelIndex index)
          Returns the item delegate used by this view and model for the given index.
 QAbstractItemDelegate itemDelegateForColumn(int column)
          Returns the item delegate used by this view and model for the given column.
 QAbstractItemDelegate itemDelegateForRow(int row)
          Returns the item delegate used by this view and model for the given row, or 0 if no delegate has been assigned.
 void keyboardSearch(java.lang.String search)
          Moves to and selects the item best matching the string search.
protected  void keyPressEvent(QKeyEvent event)
          This function is called with the given event when a key event is sent to the widget.
 QAbstractItemModel model()
          Returns the model that this view is presenting.
protected  void mouseDoubleClickEvent(QMouseEvent event)
          This function is called with the given event when a mouse button is double clicked inside the widget.
protected  void mouseMoveEvent(QMouseEvent event)
          This function is called with the given event when a mouse move event is sent to the widget.
protected  void mousePressEvent(QMouseEvent event)
          This function is called with the given event when a mouse button is pressed while the cursor is inside the widget.
protected  void mouseReleaseEvent(QMouseEvent event)
          This function is called with the given event when a mouse button is released, after a mouse press event on the widget.
protected abstract  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.
 void openPersistentEditor(QModelIndex index)
          Opens a persistent editor on the item at the given index.
 void reset()
          Reset the internal state of the view.
protected  void resizeEvent(QResizeEvent event)
          This function is called with the given event when a resize event is sent to the widget.
 QModelIndex rootIndex()
          Returns the model index of the model's root item.
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 scheduleDelayedItemsLayout()
          Schedules a layout of the items in the view to be executed when the event processing starts.
protected  void scrollDirtyRegion(int dx, int dy)
          Prepares the view for scrolling by (dx,dy) pixels by moving the dirty regions in the opposite direction.
 void scrollTo(QModelIndex index)
          Equivalent to scrollTo(index, EnsureVisible).
abstract  void scrollTo(QModelIndex index, QAbstractItemView.ScrollHint hint)
          Scrolls the view if necessary to ensure that the item at index is visible.
 void scrollToBottom()
          Scrolls the view to the bottom.
 void scrollToTop()
          Scrolls the view to the top.
 void selectAll()
          Selects all non-hidden items.
protected  java.util.List<QModelIndex> selectedIndexes()
          This convenience function returns a list of all selected and non-hidden item indexes in the view.
 QAbstractItemView.SelectionBehavior selectionBehavior()
          Returns which selection behavior the view uses.
protected  void selectionChanged(QItemSelection selected, QItemSelection deselected)
          This slot is called when the selection is changed.
protected  QItemSelectionModel.SelectionFlags selectionCommand(QModelIndex index)
          Equivalent to selectionCommand(index, 0).
protected  QItemSelectionModel.SelectionFlags selectionCommand(QModelIndex index, QEvent event)
          Returns the SelectionFlags to be used when updating a selection with to include the index specified.
 QAbstractItemView.SelectionMode selectionMode()
          Returns which selection mode the view operates in.
 QItemSelectionModel selectionModel()
          Returns the current selection model.
 void setAlternatingRowColors(boolean enable)
          Sets whether to draw the background using alternating colors to enable.
 void setAutoScroll(boolean enable)
          Sets whether autoscrolling in drag move events is enabled to enable.
 void setCurrentIndex(QModelIndex index)
          Sets the current item to be the item at index.
protected  void setDirtyRegion(QRegion region)
          Marks the given region as dirty and schedules it to be updated.
 void setDragDropMode(QAbstractItemView.DragDropMode behavior)
          Sets the drag and drop event the view will act upon to behavior.
 void setDragDropOverwriteMode(boolean overwrite)
          Sets the view's drag and drop behavior to overwrite.
 void setDragEnabled(boolean enable)
          Sets whether the view supports dragging of its own items to enable.
 void setDropIndicatorShown(boolean enable)
          Sets whether the drop indicator is shown when dragging items and dropping.
 void setEditTriggers(QAbstractItemView.EditTrigger... triggers)
          Sets which actions will initiate item editing to triggers.
 void setEditTriggers(QAbstractItemView.EditTriggers triggers)
          Sets which actions will initiate item editing to triggers.
 void setHorizontalScrollMode(QAbstractItemView.ScrollMode mode)
          Sets how the view scrolls its contents in the horizontal direction to mode.
 void setIconSize(QSize size)
          Sets the size of items to size.
 void setIndexWidget(QModelIndex index, QWidget widget)
          Sets the given widget on the item at the given index, passing the ownership of the widget to the viewport.
 void setItemDelegate(QAbstractItemDelegate delegate)
          Sets the item delegate for this view and its model to delegate.
 void setItemDelegateForColumn(int column, QAbstractItemDelegate delegate)
          Sets the given item delegate used by this view and model for the given column.
 void setItemDelegateForRow(int row, QAbstractItemDelegate delegate)
          Sets the given item delegate used by this view and model for the given row.
 void setModel(QAbstractItemModel model)
          Sets the model for the view to present.
 void setRootIndex(QModelIndex index)
          Sets the root item to the item at the given index.
protected abstract  void setSelection(QRect rect, QItemSelectionModel.SelectionFlags command)
          Applies the selection command to the items in or touched by the rectangle, rect.
 void setSelectionBehavior(QAbstractItemView.SelectionBehavior behavior)
          Sets which selection behavior the view uses to behavior.
 void setSelectionMode(QAbstractItemView.SelectionMode mode)
          Sets which selection mode the view operates in to mode.
 void setSelectionModel(QItemSelectionModel selectionModel)
          Sets the current selection model to the given selectionModel.
protected  void setState(QAbstractItemView.State state)
          Sets the item view's state to the given state.
 void setTabKeyNavigation(boolean enable)
          Sets whether item navigation with tab and backtab is enabled.
 void setTextElideMode(Qt.TextElideMode mode)
          Sets the the position of the "..." in elided text.
 void setVerticalScrollMode(QAbstractItemView.ScrollMode mode)
          Sets how the view scrolls its contents in the vertical direction to mode.
 boolean showDropIndicator()
          Returns whether the drop indicator is shown when dragging items and dropping..
 int sizeHintForColumn(int column)
          Returns the width size hint for the specified column or -1 if there is no model.
 QSize sizeHintForIndex(QModelIndex index)
          Returns the size hint for the item with the specified index or an invalid size for invalid indexes.
 int sizeHintForRow(int row)
          Returns the height size hint for the specified row or -1 if there is no model.
protected  void startAutoScroll()
          
protected  void startDrag(Qt.DropAction... supportedActions)
          Starts a drag by calling drag.start() using the given supportedActions.
protected  void startDrag(Qt.DropActions supportedActions)
          Starts a drag by calling drag->start() using the given supportedActions.
protected  QAbstractItemView.State state()
          Returns the item view's state.
protected  void stopAutoScroll()
          
 boolean tabKeyNavigation()
          Returns whether item navigation with tab and backtab is enabled..
 Qt.TextElideMode textElideMode()
          Returns the the position of the "..." in elided text..
protected  void timerEvent(QTimerEvent event)
          This function is called with the given event when a timer event is sent to the widget.
 void update(QModelIndex index)
          Updates the area occupied by the given index.
protected  void updateEditorData()
          
protected  void updateEditorGeometries()
          
protected  void updateGeometries()
          
protected abstract  int verticalOffset()
          Returns the vertical offset of the view.
protected  void verticalScrollbarAction(int action)
          
protected  void verticalScrollbarValueChanged(int value)
          
 QAbstractItemView.ScrollMode verticalScrollMode()
          Returns how the view scrolls its contents in the vertical direction.
protected  QStyleOptionViewItem viewOptions()
          Returns a QStyleOptionViewItem structure populated with the view's palette, font, state, alignments etc.
protected  boolean viewportEvent(QEvent event)
          This function is used to handle tool tips, and What's This? mode, if the given event is a QEvent::ToolTip,or a QEvent::WhatsThis.
abstract  QRect visualRect(QModelIndex index)
          Returns the rectangle on the viewport occupied by the item at index.
protected abstract  QRegion visualRegionForSelection(QItemSelection selection)
          Returns the region from the viewport of the items in the given selection.
 
Methods inherited from class com.trolltech.qt.gui.QAbstractScrollArea
addScrollBarWidget, addScrollBarWidget, contextMenuEvent, cornerWidget, horizontalScrollBar, horizontalScrollBarPolicy, maximumViewportSize, minimumSizeHint, paintEngine, paintEvent, scrollBarWidgets, scrollBarWidgets, scrollContentsBy, 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

activated

public final QSignalEmitter.Signal1<QModelIndex> activated

This signal is emitted when the item specified by index is activated by the user. How to activate items depends on the platform; e.g., by single- or double-clicking the item, or by pressing the Return or Enter key when the item is current.

Compatible Slot Signatures:
void mySlot(com.trolltech.qt.core.QModelIndex index)
void mySlot()
See Also:
clicked, doubleClicked, entered, pressed


clicked

public final QSignalEmitter.Signal1<QModelIndex> clicked

This signal is emitted when a mouse button is clicked. The item the mouse was clicked on is specified by index. The signal is only emitted when the index is valid.

Compatible Slot Signatures:
void mySlot(com.trolltech.qt.core.QModelIndex index)
void mySlot()
See Also:
activated, doubleClicked, entered, pressed


doubleClicked

public final QSignalEmitter.Signal1<QModelIndex> doubleClicked

This signal is emitted when a mouse button is double-clicked. The item the mouse was double-clicked on is specified by index. The signal is only emitted when the index is valid.

Compatible Slot Signatures:
void mySlot(com.trolltech.qt.core.QModelIndex index)
void mySlot()
See Also:
clicked, activated


entered

public final QSignalEmitter.Signal1<QModelIndex> entered

This signal is emitted when the mouse cursor enters the item specified by index. Mouse tracking needs to be enabled for this feature to work.

Compatible Slot Signatures:
void mySlot(com.trolltech.qt.core.QModelIndex index)
void mySlot()
See Also:
viewportEntered, activated, clicked, doubleClicked, pressed


pressed

public final QSignalEmitter.Signal1<QModelIndex> pressed

This signal is emitted when a mouse button is pressed. The item the mouse was pressed on is specified by index. The signal is only emitted when the index is valid.

Compatible Slot Signatures:
void mySlot(com.trolltech.qt.core.QModelIndex index)
void mySlot()
See Also:
activated, clicked, doubleClicked, entered


viewportEntered

public final QSignalEmitter.Signal0 viewportEntered

This signal is emitted when the mouse cursor enters the viewport. Mouse tracking needs to be enabled for this feature to work.

Compatible Slot Signature:
void mySlot()
See Also:
entered

Constructor Detail

QAbstractItemView

public QAbstractItemView()

Equivalent to QAbstractItemView(0).


QAbstractItemView

public QAbstractItemView(QWidget parent)

Constructs an abstract item view with the given parent.

Method Detail

alternatingRowColors

public final boolean alternatingRowColors()

Returns whether to draw the background using alternating colors.

If this property is true, the item background will be drawn using QPalette::Base and QPalette::AlternateBase; otherwise the background will be drawn using the QPalette::Base color.

By default, this property is false.

See Also:
setAlternatingRowColors

clearSelection

public final void clearSelection()

Clears all selected items. The current index will not be changed.

See Also:
setSelection, selectAll

closePersistentEditor

public final void closePersistentEditor(QModelIndex index)

Closes the persistent editor for the item at the given index.

See Also:
openPersistentEditor

currentIndex

public final QModelIndex currentIndex()

Returns the model index of the current item.

See Also:
setCurrentIndex

dirtyRegionOffset

protected final QPoint dirtyRegionOffset()

Returns the offset of the dirty regions in the view.

If you use scrollDirtyRegion and implement a paintEvent in a subclass of QAbstractItemView, you should translate the area given by the paint event with the offset returned from this function.

See Also:
scrollDirtyRegion, setDirtyRegion

doAutoScroll

protected final void doAutoScroll()


dragDropMode

public final QAbstractItemView.DragDropMode dragDropMode()

Returns the drag and drop event the view will act upon.

See Also:
setDragDropMode, showDropIndicator, dragDropOverwriteMode

dragDropOverwriteMode

public final boolean dragDropOverwriteMode()

Returns the view's drag and drop behavior.

If its value is true, the selected data will overwrite the existing item data when dropped, while moving the data will clear the item. If its value is false, the selected data will be inserted as a new item when the data is dropped. When the data is moved, the item is removed as well.

The default value is false, as in the QListView and QTreeView subclasses. In the QTableView subclass, on the other hand, the property has been set to true.

See Also:
setDragDropOverwriteMode, dragDropMode

dragEnabled

public final boolean dragEnabled()

Returns whether the view supports dragging of its own items.

See Also:
setDragEnabled, showDropIndicator, DragDropMode, dragDropOverwriteMode, acceptDrops

dropIndicatorPosition

protected final QAbstractItemView.DropIndicatorPosition dropIndicatorPosition()

Returns the position of the drop indicator in relation to the closest item.


edit

public final void edit(QModelIndex index)

Starts editing the item corresponding to the given index if it is editable.

Note that this function does not change the current index. Since the current index defines the next and previous items to edit, users may find that keyboard navigation does not work as expected. To provide consistent navigation behavior, call setCurrentIndex before this function with the same model index.

See Also:
QModelIndex::flags

editTriggers

public final QAbstractItemView.EditTriggers editTriggers()

Returns which actions will initiate item editing.

This property is a selection of flags defined by EditTrigger, combined using the OR operator. The view will only initiate the editing of an item if the action performed is set in this property.

See Also:
setEditTriggers

executeDelayedItemsLayout

protected final void executeDelayedItemsLayout()

Executes the scheduled layouts without waiting for the event processing to begin.

See Also:
scheduleDelayedItemsLayout

hasAutoScroll

public final boolean hasAutoScroll()

Returns whether autoscrolling in drag move events is enabled.

If this property is set to true (the default), the QAbstractItemView automatically scrolls the contents of the view if the user drags within 16 pixels of the viewport edge. This only works if the viewport accepts drops. Autoscroll is switched off by setting this property to false.


horizontalScrollMode

public final QAbstractItemView.ScrollMode horizontalScrollMode()

Returns how the view scrolls its contents in the horizontal direction.

This property controlls how the view scroll its contents horizontally. Scrolling can be done either per pixel or per item.

See Also:
setHorizontalScrollMode

iconSize

public final QSize iconSize()

Returns the size of items.

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

See Also:
setIconSize

indexWidget

public final QWidget indexWidget(QModelIndex index)

Returns the widget for the item at the given index.

See Also:
setIndexWidget

itemDelegate

public final QAbstractItemDelegate itemDelegate()

Returns the item delegate used by this view and model. This is either one set with setItemDelegate, or the default one.

See Also:
setItemDelegate

itemDelegate

public final QAbstractItemDelegate itemDelegate(QModelIndex index)

Returns the item delegate used by this view and model for the given index.


itemDelegateForColumn

public final QAbstractItemDelegate itemDelegateForColumn(int column)

Returns the item delegate used by this view and model for the given column. You can call itemDelegate to get a pointer to the current delegate for a given index.

See Also:
setItemDelegateForColumn, itemDelegateForRow, itemDelegate

itemDelegateForRow

public final QAbstractItemDelegate itemDelegateForRow(int row)

Returns the item delegate used by this view and model for the given row, or 0 if no delegate has been assigned. You can call itemDelegate to get a pointer to the current delegate for a given index.

See Also:
setItemDelegateForRow, itemDelegateForColumn, setItemDelegate

model

public final QAbstractItemModel model()

Returns the model that this view is presenting.

See Also:
setModel

openPersistentEditor

public final void openPersistentEditor(QModelIndex index)

Opens a persistent editor on the item at the given index. If no editor exists, the delegate will create a new editor.

See Also:
closePersistentEditor

rootIndex

public final QModelIndex rootIndex()

Returns the model index of the model's root item. The root item is the parent item to the view's toplevel items. The root can be invalid.

See Also:
setRootIndex

scheduleDelayedItemsLayout

protected final void scheduleDelayedItemsLayout()

Schedules a layout of the items in the view to be executed when the event processing starts.

Even if scheduleDelayedItemsLayout is called multiple times before events are processed, the view will only do the layout once.

See Also:
executeDelayedItemsLayout

scrollDirtyRegion

protected final void scrollDirtyRegion(int dx,
                                       int dy)

Prepares the view for scrolling by (dx,dy) pixels by moving the dirty regions in the opposite direction. You only need to call this function if you are implementing a scrolling viewport in your view subclass.

If you implement scrollContentsBy in a subclass of QAbstractItemView, call this function before you call QWidget::scroll() on the viewport. Alternatively, just call update.

See Also:
scrollContentsBy, dirtyRegionOffset, setDirtyRegion

scrollToBottom

public final void scrollToBottom()

Scrolls the view to the bottom.

See Also:
scrollTo, scrollToTop

scrollToTop

public final void scrollToTop()

Scrolls the view to the top.

See Also:
scrollTo, scrollToBottom

selectionBehavior

public final QAbstractItemView.SelectionBehavior selectionBehavior()

Returns which selection behavior the view uses.

This property holds whether selections are done in terms of single items, rows or columns.

See Also:
setSelectionBehavior, SelectionMode, SelectionBehavior

selectionMode

public final QAbstractItemView.SelectionMode selectionMode()

Returns which selection mode the view operates in.

This property controls whether the user can select one or many items and, in many-item selections, whether the selection must be a continuous range of items.

See Also:
setSelectionMode, SelectionMode, SelectionBehavior

selectionModel

public final QItemSelectionModel selectionModel()

Returns the current selection model.

See Also:
setSelectionModel, selectedIndexes

setAlternatingRowColors

public final void setAlternatingRowColors(boolean enable)

Sets whether to draw the background using alternating colors to enable.

If this property is true, the item background will be drawn using QPalette::Base and QPalette::AlternateBase; otherwise the background will be drawn using the QPalette::Base color.

By default, this property is false.

See Also:
alternatingRowColors

setAutoScroll

public final void setAutoScroll(boolean enable)

Sets whether autoscrolling in drag move events is enabled to enable.

If this property is set to true (the default), the QAbstractItemView automatically scrolls the contents of the view if the user drags within 16 pixels of the viewport edge. This only works if the viewport accepts drops. Autoscroll is switched off by setting this property to false.

See Also:
hasAutoScroll

setCurrentIndex

public final void setCurrentIndex(QModelIndex index)

Sets the current item to be the item at index. Depending on the current selection mode, the item may also be selected. Note that this function also updates the starting position for any new selections the user performs.

To set an item as the current item without selecting it, call

selectionModel()->setCurrentIndex(index, QItemSelectionModel::NoUpdate);

See Also:
currentIndex, currentChanged, selectionMode

setDirtyRegion

protected final void setDirtyRegion(QRegion region)

Marks the given region as dirty and schedules it to be updated. You only need to call this function if you are implementing your own view subclass.

See Also:
scrollDirtyRegion, dirtyRegionOffset

setDragDropMode

public final void setDragDropMode(QAbstractItemView.DragDropMode behavior)

Sets the drag and drop event the view will act upon to behavior.

See Also:
dragDropMode, showDropIndicator, dragDropOverwriteMode

setDragDropOverwriteMode

public final void setDragDropOverwriteMode(boolean overwrite)

Sets the view's drag and drop behavior to overwrite.

If its value is true, the selected data will overwrite the existing item data when dropped, while moving the data will clear the item. If its value is false, the selected data will be inserted as a new item when the data is dropped. When the data is moved, the item is removed as well.

The default value is false, as in the QListView and QTreeView subclasses. In the QTableView subclass, on the other hand, the property has been set to true.

See Also:
dragDropOverwriteMode, dragDropMode

setDragEnabled

public final void setDragEnabled(boolean enable)

Sets whether the view supports dragging of its own items to enable.

See Also:
dragEnabled, showDropIndicator, DragDropMode, dragDropOverwriteMode, acceptDrops

setDropIndicatorShown

public final void setDropIndicatorShown(boolean enable)

Sets whether the drop indicator is shown when dragging items and dropping. to enable.

See Also:
dragEnabled, DragDropMode, dragDropOverwriteMode, acceptDrops

setEditTriggers

public final void setEditTriggers(QAbstractItemView.EditTrigger... triggers)

Sets which actions will initiate item editing to triggers.

This property is a selection of flags defined by EditTrigger, combined using the OR operator. The view will only initiate the editing of an item if the action performed is set in this property.

See Also:
editTriggers

setEditTriggers

public final void setEditTriggers(QAbstractItemView.EditTriggers triggers)

Sets which actions will initiate item editing to triggers.

This property is a selection of flags defined by EditTrigger, combined using the OR operator. The view will only initiate the editing of an item if the action performed is set in this property.

See Also:
editTriggers

setHorizontalScrollMode

public final void setHorizontalScrollMode(QAbstractItemView.ScrollMode mode)

Sets how the view scrolls its contents in the horizontal direction to mode.

This property controlls how the view scroll its contents horizontally. Scrolling can be done either per pixel or per item.

See Also:
horizontalScrollMode

setIconSize

public final void setIconSize(QSize size)

Sets the size of items to size.

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

See Also:
iconSize

setIndexWidget

public final void setIndexWidget(QModelIndex index,
                                 QWidget widget)

Sets the given widget on the item at the given index, passing the ownership of the widget to the viewport.

If index is invalid (e.g., if you pass the root index), this function will do nothing.

Note that the given widget's autoFillBackground property must be set to true, otherwise the widget's background will be transparent, showing both the model data and the item at the given index.

This function should only be used to display static content within the visible area corresponding to an item of data. If you want to display custom dynamic content or implement a custom editor widget, subclass QItemDelegate instead.

See Also:
indexWidget, Delegate Classes

setItemDelegate

public final void setItemDelegate(QAbstractItemDelegate delegate)

Sets the item delegate for this view and its model to delegate. This is useful if you want complete control over the editing and display of items.

Any existing delegate will be removed, but not deleted. QAbstractItemView does not take ownership of delegate.

Warning: You should not share the same instance of a delegate between views. Doing so can cause incorrect or unintuitive editing behavior since each view connected to a given delegate may receive the closeEditor() signal, and attempt to access, modify or close an editor that has already been closed.

See Also:
itemDelegate

setItemDelegateForColumn

public final void setItemDelegateForColumn(int column,
                                           QAbstractItemDelegate delegate)

Sets the given item delegate used by this view and model for the given column. All items on column will be drawn and managed by delegate instead of using the default delegate (i.e., itemDelegate).

Any existing column delegate for column will be removed, but not deleted. QAbstractItemView does not take ownership of delegate.

Note: If a delegate has been assigned to both a row and a column, the row delegate will take presedence and manage the intersecting cell index.

Warning: You should not share the same instance of a delegate between views. Doing so can cause incorrect or unintuitive editing behavior since each view connected to a given delegate may receive the closeEditor() signal, and attempt to access, modify or close an editor that has already been closed.

See Also:
itemDelegateForColumn, setItemDelegateForRow, itemDelegate

setItemDelegateForRow

public final void setItemDelegateForRow(int row,
                                        QAbstractItemDelegate delegate)

Sets the given item delegate used by this view and model for the given row. All items on row will be drawn and managed by delegate instead of using the default delegate (i.e., itemDelegate).

Any existing row delegate for row will be removed, but not deleted. QAbstractItemView does not take ownership of delegate.

Note: If a delegate has been assigned to both a row and a column, the row delegate (i.e., this delegate) will take presedence and manage the intersecting cell index.

Warning: You should not share the same instance of a delegate between views. Doing so can cause incorrect or unintuitive editing behavior since each view connected to a given delegate may receive the closeEditor() signal, and attempt to access, modify or close an editor that has already been closed.

See Also:
itemDelegateForRow, setItemDelegateForColumn, itemDelegate

setSelectionBehavior

public final void setSelectionBehavior(QAbstractItemView.SelectionBehavior behavior)

Sets which selection behavior the view uses to behavior.

This property holds whether selections are done in terms of single items, rows or columns.

See Also:
selectionBehavior, SelectionMode, SelectionBehavior

setSelectionMode

public final void setSelectionMode(QAbstractItemView.SelectionMode mode)

Sets which selection mode the view operates in to mode.

This property controls whether the user can select one or many items and, in many-item selections, whether the selection must be a continuous range of items.

See Also:
selectionMode, SelectionMode, SelectionBehavior

setState

protected final void setState(QAbstractItemView.State state)

Sets the item view's state to the given state.

See Also:
state

setTabKeyNavigation

public final void setTabKeyNavigation(boolean enable)

Sets whether item navigation with tab and backtab is enabled. to enable.

See Also:
tabKeyNavigation

setTextElideMode

public final void setTextElideMode(Qt.TextElideMode mode)

Sets the the position of the "..." in elided text. to mode.

See Also:
textElideMode

setVerticalScrollMode

public final void setVerticalScrollMode(QAbstractItemView.ScrollMode mode)

Sets how the view scrolls its contents in the vertical direction to mode.

This property controlls how the view scroll its contents vertically. Scrolling can be done either per pixel or per item.

See Also:
verticalScrollMode

showDropIndicator

public final boolean showDropIndicator()

Returns whether the drop indicator is shown when dragging items and dropping..

See Also:
dragEnabled, DragDropMode, dragDropOverwriteMode, acceptDrops

sizeHintForIndex

public final QSize sizeHintForIndex(QModelIndex index)

Returns the size hint for the item with the specified index or an invalid size for invalid indexes.

See Also:
sizeHintForRow, sizeHintForColumn

startAutoScroll

protected final void startAutoScroll()


state

protected final QAbstractItemView.State state()

Returns the item view's state.

See Also:
setState

stopAutoScroll

protected final void stopAutoScroll()


tabKeyNavigation

public final boolean tabKeyNavigation()

Returns whether item navigation with tab and backtab is enabled..

See Also:
setTabKeyNavigation

textElideMode

public final Qt.TextElideMode textElideMode()

Returns the the position of the "..." in elided text..

See Also:
setTextElideMode

update

public final void update(QModelIndex index)

Updates the area occupied by the given index.


verticalScrollMode

public final QAbstractItemView.ScrollMode verticalScrollMode()

Returns how the view scrolls its contents in the vertical direction.

This property controlls how the view scroll its contents vertically. Scrolling can be done either per pixel or per item.

See Also:
setVerticalScrollMode

closeEditor

protected void closeEditor(QWidget editor,
                           QAbstractItemDelegate.EndEditHint hint)

Closes the given editor, and releases it. The hint is used to specify how the view should respond to the end of the editing operation. For example, the hint may indicate that the next item in the view should be opened for editing.

See Also:
edit, commitData

commitData

protected void commitData(QWidget editor)

Commit the data in the editor to the model.

See Also:
closeEditor

currentChanged

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.


dataChanged

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.


doItemsLayout

public void doItemsLayout()


dragEnterEvent

protected void dragEnterEvent(QDragEnterEvent event)

This function is called with the given event when a drag and drop operation enters the widget. If the drag is over a valid dropping place (e.g. over an item that accepts drops), the event is accepted; otherwise it is ignored.

Overrides:
dragEnterEvent in class QAbstractScrollArea
See Also:
dropEvent, startDrag

dragLeaveEvent

protected void dragLeaveEvent(QDragLeaveEvent event)

This function is called when the item being dragged leaves the view. The event describes the state of the drag and drop operation.

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

dragMoveEvent

protected void dragMoveEvent(QDragMoveEvent event)

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.

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

dropEvent

protected void dropEvent(QDropEvent event)

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.

Overrides:
dropEvent in class QAbstractScrollArea
See Also:
startDrag

edit

protected boolean edit(QModelIndex index,
                       QAbstractItemView.EditTrigger trigger,
                       QEvent event)

Starts editing the item at index, creating an editor if necessary, and returns true if the view's State is now EditingState; otherwise returns false.

The action that caused the editing process is described by trigger, and the associated event is specified by event.

Editing can be forced by specifying the trigger to be QAbstractItemView::AllEditTriggers.

See Also:
closeEditor

editorDestroyed

protected void editorDestroyed(QObject editor)

This function is called when the given editor has been destroyed.

See Also:
closeEditor

event

public boolean event(QEvent event)

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.

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

focusInEvent

protected void focusInEvent(QFocusEvent event)

This function is called with the given event when the widget obtains the focus. By default, the event is ignored.

Overrides:
focusInEvent in class QWidget
See Also:
setFocus, focusOutEvent

focusNextPrevChild

protected boolean focusNextPrevChild(boolean next)

Finds a new widget to give the keyboard focus to, as appropriate for Tab and Shift+Tab, and returns true if it can find a new widget, or false if it can't.

If next is true, this function searches forward, if next is false, it searches backward.

Sometimes, you will want to reimplement this function. For example, a web browser might reimplement it to move its "current active link" forward or backward, and call focusNextPrevChild only when it reaches the last or first link on the "page".

Child widgets call focusNextPrevChild on their parent widgets, but only the window that contains the child widgets decides where to redirect focus. By reimplementing this function for an object, you thus gain control of focus traversal for all child widgets.

Overrides:
focusNextPrevChild in class QWidget
See Also:
focusNextChild, focusPreviousChild

focusOutEvent

protected void focusOutEvent(QFocusEvent event)

This function is called with the given event when the widget looses the focus. By default, the event is ignored.

Overrides:
focusOutEvent in class QWidget
See Also:
clearFocus, focusInEvent

horizontalOffset

protected abstract int horizontalOffset()

Returns the horizontal offset of the view.

In the base class this is a pure virtual function.

See Also:
verticalOffset

horizontalScrollbarAction

protected void horizontalScrollbarAction(int action)


horizontalScrollbarValueChanged

protected void horizontalScrollbarValueChanged(int value)


indexAt

public abstract QModelIndex indexAt(QPoint point)

Returns the model index of the item at the viewport coordinates point.

In the base class this is a pure virtual function.

See Also:
visualRect

inputMethodEvent

protected void inputMethodEvent(QInputMethodEvent event)

This event handler, for event arg__1, can be reimplemented in a subclass to receive Input Method composition events. This handler is called when the state of the input method changes.

Note that when creating custom text editing widgets, the Qt::WA_InputMethodEnabled window attribute must be set explicitly (using the setAttribute function) in order to receive input method events.

The default implementation calls event->ignore(), which rejects the Input Method event. See the QInputMethodEvent documentation for more details.

Overrides:
inputMethodEvent in class QWidget
See Also:
event, QInputMethodEvent

inputMethodQuery

public java.lang.Object inputMethodQuery(Qt.InputMethodQuery query)

This method is only relevant for input widgets. It is used by the input method to query a set of properties of the widget to be able to support complex input method operations as support for surrounding text and reconversions.

arg__1 specifies which property is queried.

Overrides:
inputMethodQuery in class QWidget
See Also:
inputMethodEvent, QInputMethodEvent, QInputContext

isIndexHidden

protected abstract 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.


keyPressEvent

protected void keyPressEvent(QKeyEvent event)

This function is called with the given event when a key event is sent to the widget. The default implementation handles basic cursor movement, e.g. Up, Down, Left, Right, Home, PageUp, and PageDown; the activated signal is emitted if the current index is valid and the activation key is pressed (e.g. Enter or Return, depending on the platform). This function is where editing is initiated by key press, e.g. if F2 is pressed.

Overrides:
keyPressEvent in class QAbstractScrollArea
See Also:
edit, moveCursor, keyboardSearch, tabKeyNavigation

keyboardSearch

public void keyboardSearch(java.lang.String search)

Moves to and selects the item best matching the string search. If no item is found nothing happens.

In the default implementation, the search is reset if search is empty, or the time interval since the last search has exceeded QApplication::keyboardInputInterval().


mouseDoubleClickEvent

protected void mouseDoubleClickEvent(QMouseEvent event)

This function is called with the given event when a mouse button is double clicked inside the widget. If the double-click is on a valid item it emits the doubleClicked signal and calls edit on the item.

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

mouseMoveEvent

protected void mouseMoveEvent(QMouseEvent event)

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.

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

mousePressEvent

protected void mousePressEvent(QMouseEvent event)

This function is called with the given event when a mouse button is pressed while the cursor is inside the widget. If a valid item is pressed on it is made into the current item. This function emits the pressed signal.

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

mouseReleaseEvent

protected void mouseReleaseEvent(QMouseEvent event)

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.

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

moveCursor

protected abstract 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.


reset

public void reset()

Reset the internal state of the view.


resizeEvent

protected void resizeEvent(QResizeEvent event)

This function is called with the given event when a resize event is sent to the widget.

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

rowsAboutToBeRemoved

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.

See Also:
rowsInserted

rowsInserted

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.

See Also:
rowsAboutToBeRemoved

scrollTo

public final void scrollTo(QModelIndex index)

Equivalent to scrollTo(index, EnsureVisible).


scrollTo

public abstract 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.


selectAll

public void selectAll()

Selects all non-hidden items.

See Also:
setSelection, selectedIndexes, clearSelection

selectedIndexes

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.

See Also:
QItemSelectionModel::selectedIndexes

selectionChanged

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.

See Also:
setSelection

selectionCommand

protected final QItemSelectionModel.SelectionFlags selectionCommand(QModelIndex index)

Equivalent to selectionCommand(index, 0).


selectionCommand

protected QItemSelectionModel.SelectionFlags selectionCommand(QModelIndex index,
                                                              QEvent event)

Returns the SelectionFlags to be used when updating a selection with to include the index specified. The event is a user input event, such as a mouse or keyboard event.

Reimplement this function to define your own selection behavior.

See Also:
setSelection

setModel

public void setModel(QAbstractItemModel model)

Sets the model for the view to present.

Note: This function will also create and set a new selection model, replacing any previously set with setSelectionModel, but the old selection model will not be deleted.

See Also:
model, selectionModel, setSelectionModel

setRootIndex

public void setRootIndex(QModelIndex index)

Sets the root item to the item at the given index.

See Also:
rootIndex

setSelection

protected abstract 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.

See Also:
selectionCommand, selectedIndexes

setSelectionModel

public void setSelectionModel(QItemSelectionModel selectionModel)

Sets the current selection model to the given selectionModel.

Note that, if you call setModel after this function, the given selectionModel will be replaced by a one created by the view.

See Also:
selectionModel, setModel, clearSelection

sizeHintForColumn

public int sizeHintForColumn(int column)

Returns the width size hint for the specified column or -1 if there is no model.

This function is used in views with a horizontal header to find the size hint for a header section based on the contents of the given column.

See Also:
sizeHintForRow

sizeHintForRow

public int sizeHintForRow(int row)

Returns the height size hint for the specified row or -1 if there is no model.

The returned height is calculated using the size hints of the given row's items, i.e. the returned value is the maximum height among the items. Note that to control the height of a row, you must reimplement the QAbstractItemDelegate::sizeHint() function.

This function is used in views with a vertical header to find the size hint for a header section based on the contents of the given row.

See Also:
sizeHintForColumn

startDrag

protected final void startDrag(Qt.DropAction... supportedActions)
Starts a drag by calling drag.start() using the given supportedActions.


startDrag

protected void startDrag(Qt.DropActions supportedActions)

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


timerEvent

protected void timerEvent(QTimerEvent event)

This function is called with the given event when a timer event is sent to the widget.

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

updateEditorData

protected void updateEditorData()


updateEditorGeometries

protected void updateEditorGeometries()


updateGeometries

protected void updateGeometries()


verticalOffset

protected abstract int verticalOffset()

Returns the vertical offset of the view.

In the base class this is a pure virtual function.

See Also:
horizontalOffset

verticalScrollbarAction

protected void verticalScrollbarAction(int action)


verticalScrollbarValueChanged

protected void verticalScrollbarValueChanged(int value)


viewOptions

protected QStyleOptionViewItem viewOptions()

Returns a QStyleOptionViewItem structure populated with the view's palette, font, state, alignments etc.


viewportEvent

protected boolean viewportEvent(QEvent event)

This function is used to handle tool tips, and What's This? mode, if the given event is a QEvent::ToolTip,or a QEvent::WhatsThis. It passes all other events on to its base class viewportEvent handler.

Overrides:
viewportEvent in class QAbstractScrollArea

visualRect

public abstract 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.

See Also:
indexAt, visualRegionForSelection

visualRegionForSelection

protected abstract 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.

See Also:
visualRect, selectedIndexes

fromNativePointer

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

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

Qt Jambi Home