Qt Jambi Home

com.trolltech.qt.gui
Class QColumnView

java.lang.Object
  extended by com.trolltech.qt.QSignalEmitter
      extended by com.trolltech.qt.QtJambiObject
          extended by com.trolltech.qt.core.QObject
              extended by com.trolltech.qt.gui.QWidget
                  extended by com.trolltech.qt.gui.QFrame
                      extended by com.trolltech.qt.gui.QAbstractScrollArea
                          extended by com.trolltech.qt.gui.QAbstractItemView
                              extended by com.trolltech.qt.gui.QColumnView
All Implemented Interfaces:
QPaintDeviceInterface, QtJambiInterface

public class QColumnView
extends QAbstractItemView

The QColumnView class provides a model/view implementation of a column view.

QColumnView displays a model in a number of QListViews, one for each hierarchy in the tree. This is sometimes referred to as a cascading list.

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

QColumnView implements the interfaces defined by the QAbstractItemView class to allow it to display data provided by models derived from the QAbstractItemModel class.

See Also:
Model/View Programming

Nested Class Summary
 
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<QModelIndex> updatePreviewWidget
          This signal is emitted when the preview widget should be updated to provide rich information about index
 
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
QColumnView()
          Equivalent to QColumnView(0).
QColumnView(QWidget parent)
          Constructs a column view with a parent to represent a model's data.
 
Method Summary
 java.util.List<java.lang.Integer> columnWidths()
          Returns a list of the width of all the columns in this view.
protected  QAbstractItemView createColumn(QModelIndex rootIndex)
          To use a custom widget for the final column when you select an item overload this function and return a widget.
protected  void currentChanged(QModelIndex current, QModelIndex previous)
          

This slot is called when a new item becomes the current item.

static QColumnView fromNativePointer(QNativePointer nativePointer)
          This function returns the QColumnView instance pointed to by nativePointer
protected  int horizontalOffset()
          

Returns the horizontal offset of the view.

 QModelIndex indexAt(QPoint point)
          

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

protected  boolean isIndexHidden(QModelIndex index)
          

Returns true if the item referred to by the given index is hidden in the view, otherwise returns false.

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.
 QWidget previewWidget()
          Returns the preview widget, or 0 if there is none.
protected  void resizeEvent(QResizeEvent event)
          

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

 boolean resizeGripsVisible()
          Returns the way to specify if the list views gets resize grips or not.
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.
 void selectAll()
          

Selects all non-hidden items.

 void setColumnWidths(java.util.List<java.lang.Integer> list)
          Sets the column widths to the values given in the list.
 void setModel(QAbstractItemModel model)
          

Sets the model for the view to present.

 void setPreviewWidget(QWidget widget)
          Sets the preview widget.
 void setResizeGripsVisible(boolean visible)
          Sets the way to specify if the list views gets resize grips or not to visible.
 void setRootIndex(QModelIndex index)
          

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

protected  void setSelection(QRect rect, QItemSelectionModel.SelectionFlags command)
          Applies the selection command to the items in or touched by the rectangle, rect.
 void setSelectionModel(QItemSelectionModel selectionModel)
          

Sets the current selection model to the given selectionModel.

 QSize sizeHint()
          

Returns the recommended size for the widget.

If the value of this property is an invalid size, no size is recommended.

The default implementation of sizeHint returns an invalid size if there is no layout for this widget, and returns the layout's preferred size otherwise.

protected  int verticalOffset()
          

Returns the vertical offset of the view.

 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.

 
Methods inherited from class com.trolltech.qt.gui.QAbstractItemView
alternatingRowColors, clearSelection, closeEditor, closePersistentEditor, commitData, currentIndex, dataChanged, dirtyRegionOffset, doAutoScroll, doItemsLayout, dragDropMode, dragDropOverwriteMode, dragEnabled, dragEnterEvent, dragLeaveEvent, dragMoveEvent, dropEvent, dropIndicatorPosition, edit, edit, editorDestroyed, editTriggers, event, executeDelayedItemsLayout, focusInEvent, focusNextPrevChild, focusOutEvent, hasAutoScroll, horizontalScrollbarAction, horizontalScrollbarValueChanged, horizontalScrollMode, iconSize, indexWidget, inputMethodEvent, inputMethodQuery, itemDelegate, itemDelegate, itemDelegateForColumn, itemDelegateForRow, keyboardSearch, keyPressEvent, model, mouseDoubleClickEvent, mouseMoveEvent, mousePressEvent, mouseReleaseEvent, openPersistentEditor, reset, rootIndex, rowsAboutToBeRemoved, rowsInserted, scheduleDelayedItemsLayout, scrollDirtyRegion, scrollTo, scrollToBottom, scrollToTop, selectedIndexes, selectionBehavior, selectionChanged, selectionCommand, selectionCommand, selectionMode, selectionModel, setAlternatingRowColors, setAutoScroll, setCurrentIndex, setDirtyRegion, setDragDropMode, setDragDropOverwriteMode, setDragEnabled, setDropIndicatorShown, setEditTriggers, setEditTriggers, setHorizontalScrollMode, setIconSize, setIndexWidget, setItemDelegate, setItemDelegateForColumn, setItemDelegateForRow, setSelectionBehavior, setSelectionMode, setState, setTabKeyNavigation, setTextElideMode, setVerticalScrollMode, showDropIndicator, sizeHintForColumn, sizeHintForIndex, sizeHintForRow, startAutoScroll, startDrag, startDrag, state, stopAutoScroll, tabKeyNavigation, textElideMode, timerEvent, update, updateEditorData, updateEditorGeometries, updateGeometries, verticalScrollbarAction, verticalScrollbarValueChanged, verticalScrollMode, viewOptions, viewportEvent
 
Methods inherited from class com.trolltech.qt.gui.QAbstractScrollArea
addScrollBarWidget, addScrollBarWidget, contextMenuEvent, cornerWidget, horizontalScrollBar, horizontalScrollBarPolicy, maximumViewportSize, minimumSizeHint, paintEngine, paintEvent, scrollBarWidgets, scrollBarWidgets, setCornerWidget, setHorizontalScrollBar, setHorizontalScrollBarPolicy, setupViewport, setVerticalScrollBar, setVerticalScrollBarPolicy, setViewport, setViewportMargins, 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

updatePreviewWidget

public final QSignalEmitter.Signal1<QModelIndex> updatePreviewWidget

This signal is emitted when the preview widget should be updated to provide rich information about index

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

Constructor Detail

QColumnView

public QColumnView()

Equivalent to QColumnView(0).


QColumnView

public QColumnView(QWidget parent)

Constructs a column view with a parent to represent a model's data. Use setModel to set the model.

See Also:
QAbstractItemModel
Method Detail

columnWidths

public final java.util.List<java.lang.Integer> columnWidths()

Returns a list of the width of all the columns in this view.

See Also:
setColumnWidths

previewWidget

public final QWidget previewWidget()

Returns the preview widget, or 0 if there is none.

See Also:
setPreviewWidget, updatePreviewWidget

resizeGripsVisible

public final boolean resizeGripsVisible()

Returns the way to specify if the list views gets resize grips or not.

By default, visible is set to true

See Also:
setResizeGripsVisible, setRootIndex

setColumnWidths

public final void setColumnWidths(java.util.List<java.lang.Integer> list)

Sets the column widths to the values given in the list. Extra values in the list are kept and used when the columns are created.

If list contains too few values, only width of the rest of the columns will not be modified.

See Also:
columnWidths, createColumn

setPreviewWidget

public final void setPreviewWidget(QWidget widget)

Sets the preview widget.

The widget becomes a child of the column view, and will be destroyed when the column area is deleted or when a new widget is set.

See Also:
previewWidget, updatePreviewWidget

setResizeGripsVisible

public final void setResizeGripsVisible(boolean visible)

Sets the way to specify if the list views gets resize grips or not to visible.

By default, visible is set to true

See Also:
resizeGripsVisible, setRootIndex

createColumn

protected QAbstractItemView createColumn(QModelIndex rootIndex)

To use a custom widget for the final column when you select an item overload this function and return a widget. rootIndex is the root index that will be assigned to the view.

Return the new view. QColumnView will automatically take ownership of the widget.

See Also:
setPreviewWidget

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.

Overrides:
currentChanged in class QAbstractItemView

horizontalOffset

protected int horizontalOffset()

Returns the horizontal offset of the view.

In the base class this is a pure virtual function.

Specified by:
horizontalOffset in class QAbstractItemView
See Also:
verticalOffset

indexAt

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

Specified by:
indexAt in class QAbstractItemView
See Also:
visualRect

isIndexHidden

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.

Specified by:
isIndexHidden in class QAbstractItemView

moveCursor

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

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

In the base class this is a pure virtual function.

Specified by:
moveCursor in class QAbstractItemView

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 QAbstractItemView
See Also:
QWidget::resizeEvent

scrollContentsBy

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

Overrides:
scrollContentsBy in class QAbstractScrollArea

scrollTo

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

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

In the base class this is a pure virtual function.

Specified by:
scrollTo in class QAbstractItemView

selectAll

public void selectAll()

Selects all non-hidden items.

Overrides:
selectAll in class QAbstractItemView
See Also:
setSelection, selectedIndexes, clearSelection

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.

Overrides:
setModel in class QAbstractItemView
See Also:
model, selectionModel, setSelectionModel

setRootIndex

public void setRootIndex(QModelIndex index)

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

Overrides:
setRootIndex in class QAbstractItemView
See Also:
rootIndex

setSelection

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

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

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

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

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.

Overrides:
setSelectionModel in class QAbstractItemView
See Also:
selectionModel, setModel, clearSelection

sizeHint

public QSize sizeHint()

Returns the recommended size for the widget.

If the value of this property is an invalid size, no size is recommended.

The default implementation of sizeHint returns an invalid size if there is no layout for this widget, and returns the layout's preferred size otherwise.

Overrides:
sizeHint in class QAbstractScrollArea
See Also:
QSize::isValid, minimumSizeHint, sizePolicy, setMinimumSize, updateGeometry

verticalOffset

protected int verticalOffset()

Returns the vertical offset of the view.

In the base class this is a pure virtual function.

Specified by:
verticalOffset in class QAbstractItemView
See Also:
horizontalOffset

visualRect

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.

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

visualRegionForSelection

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.

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

fromNativePointer

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

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

Qt Jambi Home