Qt Jambi Home

com.trolltech.qt.gui
Class QTableView

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.QTableView
All Implemented Interfaces:
QPaintDeviceInterface, QtJambiInterface
Direct Known Subclasses:
QTableWidget

public class QTableView
extends QAbstractItemView

The QTableView class provides a default model/view implementation of a table view.

A QTableView implements a table view that displays items from a model. This class is used to provide standard tables that were previously provided by the QTable class, but using the more flexible approach provided by Qt's model/view architecture.

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

You can navigate the cells in the table by clicking on a cell with the mouse, or by using the arrow keys. Because QTableView enables tabKeyNavigation by default, you can also hit Tab and Backtab to move from cell to cell.

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

The table has a vertical header that can be obtained using the verticalHeader function, and a horizontal header that is available through the horizontalHeader function. The height of each row in the table can be found by using rowHeight; similarly, the width of columns can be found using columnWidth. They are both just QWidgets so you can hide either of them using their hide functions.

Rows and columns can be hidden and shown with hideRow, hideColumn, showRow, and showColumn. They can be selected with selectRow and selectColumn. The table will show a grid depending on the showGrid property.

The items shown in a table view, like those in the other item views, are rendered and edited using standard delegates. However, for some tasks it is sometimes useful to be able to insert widgets in a table instead. Widgets are set for particular indexes with the setIndexWidget() function, and later retrieved with indexWidget().

For some specialized forms of tables it is useful to be able to convert between row and column indexes and widget coordinates. The rowAt function provides the y-coordinate within the view of the specified row; the row index can be used to obtain a corresponding y-coordinate with rowViewportPosition. The columnAt and columnViewportPosition functions provide the equivalent conversion operations between x-coordinates and column indexes.

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

See Also:
QTableWidget, View Classes, QAbstractItemModel, QAbstractItemView, Example, Example, Model Example

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.AbstractSignal, QSignalEmitter.Signal0, QSignalEmitter.Signal1<A>, QSignalEmitter.Signal2<A,B>, QSignalEmitter.Signal3<A,B,C>, QSignalEmitter.Signal4<A,B,C,D>, QSignalEmitter.Signal5<A,B,C,D,E>, QSignalEmitter.Signal6<A,B,C,D,E,F>, QSignalEmitter.Signal7<A,B,C,D,E,F,G>, QSignalEmitter.Signal8<A,B,C,D,E,F,G,H>, QSignalEmitter.Signal9<A,B,C,D,E,F,G,H,I>
 
Field Summary
 
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
QTableView()
          Equivalent to QTableView(0).
QTableView(QWidget parent)
          Constructs a table view with a parent to represent the data.
 
Method Summary
 int columnAt(int x)
          Returns the column in which the given x-coordinate, x, in contents coordinates is located.
protected  void columnCountChanged(int oldCount, int newCount)
          This slot is called whenever columns are added or deleted.
protected  void columnMoved(int column, int oldIndex, int newIndex)
          This slot is called to change the index of the given column in the table view.
protected  void columnResized(int column, int oldWidth, int newWidth)
          This slot is called to change the width of the given column.
 int columnSpan(int row, int column)
          Returns the column span of the table element at (row, column).
 int columnViewportPosition(int column)
          Returns the x-coordinate in contents coordinates of the given column.
 int columnWidth(int column)
          Returns the width of the given column.
protected  void currentChanged(QModelIndex current, QModelIndex previous)
          This function is reimplemented for internal reasons.
static QTableView fromNativePointer(QNativePointer nativePointer)
          This function returns the QTableView instance pointed to by nativePointer
 Qt.PenStyle gridStyle()
          Returns the pen style used to draw the grid..
 void hideColumn(int column)
          Hide the given column.
 void hideRow(int row)
          Hide the given row.
 QHeaderView horizontalHeader()
          Returns the table view's horizontal header.
protected  int horizontalOffset()
          Returns the horizontal offset of the items in the table view.
protected  void horizontalScrollbarAction(int action)
          This function is reimplemented for internal reasons.
 QModelIndex indexAt(QPoint p)
          Returns the index position of the model item corresponding to the table item at position p in contents coordinates.
 boolean isColumnHidden(int column)
          Returns true if the given column is hidden; otherwise returns false.
 boolean isCornerButtonEnabled()
          Returns whether the button in the top-left corner is enabled.
protected  boolean isIndexHidden(QModelIndex index)
          This function is reimplemented for internal reasons.
 boolean isRowHidden(int row)
          Returns true if the given row is hidden; otherwise returns false.
 boolean isSortingEnabled()
          Returns whether sorting is enabled.
protected  QModelIndex moveCursor(QAbstractItemView.CursorAction cursorAction, Qt.KeyboardModifiers modifiers)
          Moves the cursor in accordance with the given cursorAction, using the information provided by the modifiers.
protected  void paintEvent(QPaintEvent e)
          Paints the table on receipt of the given paint event e.
 void resizeColumnsToContents()
          Resizes all columns based on the size hints of the delegate used to render each item in the columns.
 void resizeColumnToContents(int column)
          Resizes the given column based on the size hints of the delegate used to render each item in the column.
 void resizeRowsToContents()
          Resizes all rows based on the size hints of the delegate used to render each item in the rows.
 void resizeRowToContents(int row)
          Resizes the given row based on the size hints of the delegate used to render each item in the row.
 int rowAt(int y)
          Returns the row in which the given y-coordinate, y, in contents coordinates is located.
protected  void rowCountChanged(int oldCount, int newCount)
          This slot is called whenever rows are added or deleted.
 int rowHeight(int row)
          Returns the height of the given row.
protected  void rowMoved(int row, int oldIndex, int newIndex)
          This slot is called to change the index of the given row in the table view.
protected  void rowResized(int row, int oldHeight, int newHeight)
          This slot is called to change the height of the given row.
 int rowSpan(int row, int column)
          Returns the row span of the table element at (row, column).
 int rowViewportPosition(int row)
          Returns the y-coordinate in contents coordinates of the given row.
protected  void scrollContentsBy(int dx, int dy)
          This function is reimplemented for internal reasons.
 void scrollTo(QModelIndex index, QAbstractItemView.ScrollHint hint)
          Scrolls the view if necessary to ensure that the item at index is visible.
 void selectColumn(int column)
          Selects the given column in the table view if the current SelectionMode and SelectionBehavior allows columns to be selected.
protected  java.util.List<QModelIndex> selectedIndexes()
          This function is reimplemented for internal reasons.
protected  void selectionChanged(QItemSelection selected, QItemSelection deselected)
          This function is reimplemented for internal reasons.
 void selectRow(int row)
          Selects the given row in the table view if the current SelectionMode and SelectionBehavior allows rows to be selected.
 void setColumnHidden(int column, boolean hide)
          If hide is true the given column will be hidden; otherwise it will be shown.
 void setColumnWidth(int column, int width)
          Sets the width of the given column to be width.
 void setCornerButtonEnabled(boolean enable)
          Sets whether the button in the top-left corner is enabled to enable.
 void setGridStyle(Qt.PenStyle style)
          Sets the pen style used to draw the grid.
 void setHorizontalHeader(QHeaderView header)
          Sets the widget to use for the vertical header to header.
 void setModel(QAbstractItemModel model)
          This function is reimplemented for internal reasons.
 void setRootIndex(QModelIndex index)
          This function is reimplemented for internal reasons.
 void setRowHeight(int row, int height)
          Sets the height of the given row to be height.
 void setRowHidden(int row, boolean hide)
          If hide is true row will be hidden, otherwise it will be shown.
protected  void setSelection(QRect rect, QItemSelectionModel.SelectionFlags command)
          Selects the items within the given rect and in accordance with the specified selection command.
 void setSelectionModel(QItemSelectionModel selectionModel)
          This function is reimplemented for internal reasons.
 void setShowGrid(boolean show)
          Sets whether the grid is shown to show.
 void setSortingEnabled(boolean enable)
          Sets whether sorting is enabled to enable.
 void setSpan(int row, int column, int rowSpan, int columnSpan)
          Sets the span of the table element at (row, column) to (rowSpan, columnSpan).
 void setVerticalHeader(QHeaderView header)
          Sets the widget to use for the horizontal header to header.
 void setWordWrap(boolean on)
          Sets the item text word-wrapping policy to on.
 void showColumn(int column)
          Show the given column.
 boolean showGrid()
          Returns whether the grid is shown.
 void showRow(int row)
          Show the given row.
 int sizeHintForColumn(int column)
          Returns the size hint for the given column's width or -1 if there is no model.
 int sizeHintForRow(int row)
          Returns the size hint for the given row's height or -1 if there is no model.
 void sortByColumn(int column, Qt.SortOrder order)
          Sorts the model by the values in the given column in the given order.
protected  void timerEvent(QTimerEvent event)
          This function is reimplemented for internal reasons.
protected  void updateGeometries()
          This function is reimplemented for internal reasons.
 QHeaderView verticalHeader()
          Returns the table view's vertical header.
protected  int verticalOffset()
          Returns the vertical offset of the items in the table view.
protected  void verticalScrollbarAction(int action)
          This function is reimplemented for internal reasons.
protected  QStyleOptionViewItem viewOptions()
          This function is reimplemented for internal reasons.
 QRect visualRect(QModelIndex index)
          This function is reimplemented for internal reasons.
protected  QRegion visualRegionForSelection(QItemSelection selection)
          This function is reimplemented for internal reasons.
 boolean wordWrap()
          Returns the item text word-wrapping policy.
 
Methods inherited from class com.trolltech.qt.gui.QAbstractItemView
alternatingRowColors, clearSelection, closeEditor, closePersistentEditor, commitData, currentIndex, dataChanged, dirtyRegionOffset, doAutoScroll, doItemsLayout, dragDropMode, dragDropOverwriteMode, dragEnabled, dragEnterEvent, dragLeaveEvent, dragMoveEvent, dropEvent, dropIndicatorPosition, edit, edit, editorDestroyed, editTriggers, event, executeDelayedItemsLayout, focusInEvent, focusNextPrevChild, focusOutEvent, hasAutoScroll, horizontalScrollbarValueChanged, horizontalScrollMode, iconSize, indexWidget, inputMethodEvent, inputMethodQuery, itemDelegate, itemDelegate, itemDelegateForColumn, itemDelegateForRow, keyboardSearch, keyPressEvent, model, mouseDoubleClickEvent, mouseMoveEvent, mousePressEvent, mouseReleaseEvent, openPersistentEditor, reset, resizeEvent, rootIndex, rowsAboutToBeRemoved, rowsInserted, scheduleDelayedItemsLayout, scrollDirtyRegion, scrollTo, scrollToBottom, scrollToTop, selectAll, selectionBehavior, selectionCommand, selectionCommand, selectionMode, selectionModel, setAlternatingRowColors, setAutoScroll, setCurrentIndex, setDirtyRegion, setDragDropMode, setDragDropOverwriteMode, setDragEnabled, setDropIndicatorShown, setEditTriggers, setEditTriggers, setHorizontalScrollMode, setIconSize, setIndexWidget, setItemDelegate, setItemDelegateForColumn, setItemDelegateForRow, setSelectionBehavior, setSelectionMode, setState, setTabKeyNavigation, setTextElideMode, setVerticalScrollMode, showDropIndicator, sizeHintForIndex, startAutoScroll, startDrag, startDrag, state, stopAutoScroll, tabKeyNavigation, textElideMode, update, updateEditorData, updateEditorGeometries, verticalScrollbarValueChanged, verticalScrollMode, viewportEvent
 
Methods inherited from class com.trolltech.qt.gui.QAbstractScrollArea
addScrollBarWidget, addScrollBarWidget, contextMenuEvent, cornerWidget, horizontalScrollBar, horizontalScrollBarPolicy, maximumViewportSize, minimumSizeHint, paintEngine, scrollBarWidgets, scrollBarWidgets, setCornerWidget, setHorizontalScrollBar, setHorizontalScrollBarPolicy, setupViewport, setVerticalScrollBar, setVerticalScrollBarPolicy, setViewport, setViewportMargins, sizeHint, verticalScrollBar, verticalScrollBarPolicy, viewport, wheelEvent
 
Methods inherited from class com.trolltech.qt.gui.QFrame
changeEvent, drawFrame, frameRect, frameShadow, frameShape, frameStyle, frameWidth, lineWidth, midLineWidth, setFrameRect, setFrameShadow, setFrameShape, setFrameStyle, setLineWidth, setMidLineWidth
 
Methods inherited from class com.trolltech.qt.gui.QWidget
acceptDrops, accessibleDescription, accessibleName, actionEvent, actions, activateWindow, addAction, addActions, adjustSize, autoFillBackground, backgroundRole, baseSize, childAt, childAt, childrenRect, childrenRegion, clearFocus, clearMask, close, closeEvent, contentsRect, contextMenuPolicy, createWinId, cursor, depth, destroy, destroy, destroy, devType, ensurePolished, enterEvent, focusNextChild, focusPolicy, focusPreviousChild, focusProxy, focusWidget, font, fontInfo, fontMetrics, foregroundRole, frameGeometry, frameSize, geometry, getContentsMargins, grabKeyboard, grabMouse, grabMouse, grabShortcut, grabShortcut, hasFocus, hasMouseTracking, height, heightForWidth, heightMM, hide, hideEvent, inputContext, insertAction, insertActions, isActiveWindow, isAncestorOf, isEnabled, isEnabledTo, isFullScreen, isHidden, isLeftToRight, isMaximized, isMinimized, isModal, isRightToLeft, isVisible, isVisibleTo, isWindow, isWindowModified, keyboardGrabber, keyReleaseEvent, layout, layoutDirection, leaveEvent, locale, logicalDpiX, logicalDpiY, lower, mapFrom, mapFromGlobal, mapFromParent, mapTo, mapToGlobal, mapToParent, mask, maximumHeight, maximumSize, maximumWidth, metric, minimumHeight, minimumSize, minimumWidth, mouseGrabber, move, move, moveEvent, nextInFocusChain, normalGeometry, numColors, overrideWindowFlags, overrideWindowFlags, overrideWindowState, overrideWindowState, paintingActive, palette, parentWidget, physicalDpiX, physicalDpiY, pos, raise, rect, releaseKeyboard, releaseMouse, releaseShortcut, removeAction, render, render, render, render, render, repaint, repaint, repaint, repaint, resetInputContext, resize, resize, restoreGeometry, saveGeometry, scroll, scroll, setAcceptDrops, setAccessibleDescription, setAccessibleName, setAttribute, setAttribute, setAutoFillBackground, setBackgroundRole, setBaseSize, setBaseSize, setContentsMargins, setContentsMargins, setContextMenuPolicy, setCursor, setDisabled, setEnabled, setFixedHeight, setFixedSize, setFixedSize, setFixedWidth, setFocus, setFocus, setFocusPolicy, setFocusProxy, setFont, setForegroundRole, setGeometry, setGeometry, setHidden, setInputContext, setLayout, setLayoutDirection, setLocale, setMask, setMask, setMaximumHeight, setMaximumSize, setMaximumSize, setMaximumWidth, setMinimumHeight, setMinimumSize, setMinimumSize, setMinimumWidth, setMouseTracking, setPalette, setParent, setParent, setParent, setShortcutAutoRepeat, setShortcutAutoRepeat, setShortcutEnabled, setShortcutEnabled, setSizeIncrement, setSizeIncrement, setSizePolicy, setSizePolicy, setStatusTip, setStyle, setStyleSheet, setTabOrder, setToolTip, setUpdatesEnabled, setVisible, setWhatsThis, setWindowFlags, setWindowFlags, setWindowIcon, setWindowIconText, setWindowModality, setWindowModified, setWindowOpacity, setWindowRole, setWindowState, setWindowState, setWindowTitle, show, showEvent, showFullScreen, showMaximized, showMinimized, showNormal, size, sizeIncrement, sizePolicy, stackUnder, statusTip, style, styleSheet, tabletEvent, testAttribute, toolTip, underMouse, unsetCursor, unsetLayoutDirection, unsetLocale, update, update, update, update, updateGeometry, updateMicroFocus, updatesEnabled, visibleRegion, whatsThis, width, widthMM, window, windowFlags, windowIcon, windowIconText, windowModality, windowOpacity, windowRole, windowState, windowTitle, windowType, winId, x, y
 
Methods inherited from class com.trolltech.qt.core.QObject
blockSignals, childEvent, children, connectSlotsByName, customEvent, disposeLater, dumpObjectInfo, dumpObjectTree, dynamicPropertyNames, eventFilter, findChild, findChild, findChild, findChildren, findChildren, findChildren, findChildren, installEventFilter, isWidgetType, killTimer, moveToThread, objectName, parent, property, removeEventFilter, setObjectName, setParent, setProperty, signalsBlocked, startTimer, thread
 
Methods inherited from class com.trolltech.qt.QtJambiObject
dispose, disposed, finalize, reassignNativeResources, tr, tr, tr
 
Methods inherited from class com.trolltech.qt.QSignalEmitter
disconnect, disconnect, signalSender
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.trolltech.qt.QtJambiInterface
disableGarbageCollection, nativeId, nativePointer, reenableGarbageCollection, setJavaOwnership
 

Constructor Detail

QTableView

public QTableView()

Equivalent to QTableView(0).


QTableView

public QTableView(QWidget parent)

Constructs a table view with a parent to represent the data.

See Also:
QAbstractItemModel
Method Detail

columnAt

public final int columnAt(int x)

Returns the column in which the given x-coordinate, x, in contents coordinates is located.

See Also:
rowAt

columnCountChanged

protected final void columnCountChanged(int oldCount,
                                        int newCount)

This slot is called whenever columns are added or deleted. The previous number of columns is specified by oldCount, and the new number of columns is specified by newCount.


columnMoved

protected final void columnMoved(int column,
                                 int oldIndex,
                                 int newIndex)

This slot is called to change the index of the given column in the table view. The old index is specified by oldIndex, and the new index by newIndex.

See Also:
rowMoved

columnResized

protected final void columnResized(int column,
                                   int oldWidth,
                                   int newWidth)

This slot is called to change the width of the given column. The old width is specified by oldWidth, and the new width by newWidth.

See Also:
rowResized

columnSpan

public final int columnSpan(int row,
                            int column)

Returns the column span of the table element at (row, column). The default is 1.

See Also:
setSpan, rowSpan

columnViewportPosition

public final int columnViewportPosition(int column)

Returns the x-coordinate in contents coordinates of the given column.


columnWidth

public final int columnWidth(int column)

Returns the width of the given column.

See Also:
setColumnWidth, resizeColumnToContents, rowHeight

gridStyle

public final Qt.PenStyle gridStyle()

Returns the pen style used to draw the grid..

This property holds the style used when drawing the grid (see showGrid).

See Also:
setGridStyle

hideColumn

public final void hideColumn(int column)

Hide the given column.

See Also:
showColumn, hideRow

hideRow

public final void hideRow(int row)

Hide the given row.

See Also:
showRow, hideColumn

horizontalHeader

public final QHeaderView horizontalHeader()

Returns the table view's horizontal header.

See Also:
setHorizontalHeader, verticalHeader, QAbstractItemModel::headerData

isColumnHidden

public final boolean isColumnHidden(int column)

Returns true if the given column is hidden; otherwise returns false.

See Also:
isRowHidden

isCornerButtonEnabled

public final boolean isCornerButtonEnabled()

Returns whether the button in the top-left corner is enabled.

If this property is true then button in the top-left corner of the table view is enabled. Clicking on this button will select all the cells in the table view.

This property is true by default.


isRowHidden

public final boolean isRowHidden(int row)

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

See Also:
isColumnHidden

isSortingEnabled

public final boolean isSortingEnabled()

Returns whether sorting is enabled.

If this property is true, sorting is enabled for the table; if the property is false, sorting is not enabled. The default value is false.

See Also:
sortByColumn

resizeColumnToContents

public final void resizeColumnToContents(int column)

Resizes the given column based on the size hints of the delegate used to render each item in the column.


resizeColumnsToContents

public final void resizeColumnsToContents()

Resizes all columns based on the size hints of the delegate used to render each item in the columns.


resizeRowToContents

public final void resizeRowToContents(int row)

Resizes the given row based on the size hints of the delegate used to render each item in the row.


resizeRowsToContents

public final void resizeRowsToContents()

Resizes all rows based on the size hints of the delegate used to render each item in the rows.


rowAt

public final int rowAt(int y)

Returns the row in which the given y-coordinate, y, in contents coordinates is located.

See Also:
columnAt

rowCountChanged

protected final void rowCountChanged(int oldCount,
                                     int newCount)

This slot is called whenever rows are added or deleted. The previous number of rows is specified by oldCount, and the new number of rows is specified by newCount.


rowHeight

public final int rowHeight(int row)

Returns the height of the given row.

See Also:
setRowHeight, resizeRowToContents, columnWidth

rowMoved

protected final void rowMoved(int row,
                              int oldIndex,
                              int newIndex)

This slot is called to change the index of the given row in the table view. The old index is specified by oldIndex, and the new index by newIndex.

See Also:
columnMoved

rowResized

protected final void rowResized(int row,
                                int oldHeight,
                                int newHeight)

This slot is called to change the height of the given row. The old height is specified by oldHeight, and the new height by newHeight.

See Also:
columnResized

rowSpan

public final int rowSpan(int row,
                         int column)

Returns the row span of the table element at (row, column). The default is 1.

See Also:
setSpan, columnSpan

rowViewportPosition

public final int rowViewportPosition(int row)

Returns the y-coordinate in contents coordinates of the given row.


selectColumn

public final void selectColumn(int column)

Selects the given column in the table view if the current SelectionMode and SelectionBehavior allows columns to be selected.

See Also:
selectRow

selectRow

public final void selectRow(int row)

Selects the given row in the table view if the current SelectionMode and SelectionBehavior allows rows to be selected.

See Also:
selectColumn

setColumnHidden

public final void setColumnHidden(int column,
                                  boolean hide)

If hide is true the given column will be hidden; otherwise it will be shown.

See Also:
isColumnHidden, setRowHidden

setColumnWidth

public final void setColumnWidth(int column,
                                 int width)

Sets the width of the given column to be width.

See Also:
columnWidth

setCornerButtonEnabled

public final void setCornerButtonEnabled(boolean enable)

Sets whether the button in the top-left corner is enabled to enable.

If this property is true then button in the top-left corner of the table view is enabled. Clicking on this button will select all the cells in the table view.

This property is true by default.

See Also:
isCornerButtonEnabled

setGridStyle

public final void setGridStyle(Qt.PenStyle style)

Sets the pen style used to draw the grid. to style.

This property holds the style used when drawing the grid (see showGrid).

See Also:
gridStyle

setHorizontalHeader

public final void setHorizontalHeader(QHeaderView header)

Sets the widget to use for the vertical header to header.

See Also:
horizontalHeader, setVerticalHeader

setRowHeight

public final void setRowHeight(int row,
                               int height)

Sets the height of the given row to be height.

See Also:
rowHeight

setRowHidden

public final void setRowHidden(int row,
                               boolean hide)

If hide is true row will be hidden, otherwise it will be shown.

See Also:
isRowHidden, setColumnHidden

setShowGrid

public final void setShowGrid(boolean show)

Sets whether the grid is shown to show.

If this property is true a grid is drawn for the table; if the property is false, no grid is drawn. The default value is true.

See Also:
showGrid

setSortingEnabled

public final void setSortingEnabled(boolean enable)

Sets whether sorting is enabled to enable.

If this property is true, sorting is enabled for the table; if the property is false, sorting is not enabled. The default value is false.

See Also:
isSortingEnabled, sortByColumn

setSpan

public final void setSpan(int row,
                          int column,
                          int rowSpan,
                          int columnSpan)

Sets the span of the table element at (row, column) to (rowSpan, columnSpan).

See Also:
rowSpan, columnSpan

setVerticalHeader

public final void setVerticalHeader(QHeaderView header)

Sets the widget to use for the horizontal header to header.

See Also:
verticalHeader, setHorizontalHeader

setWordWrap

public final void setWordWrap(boolean on)

Sets the item text word-wrapping policy to on.

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

See Also:
wordWrap

showColumn

public final void showColumn(int column)

Show the given column.

See Also:
hideColumn, showRow

showGrid

public final boolean showGrid()

Returns whether the grid is shown.

If this property is true a grid is drawn for the table; if the property is false, no grid is drawn. The default value is true.

See Also:
setShowGrid

showRow

public final void showRow(int row)

Show the given row.

See Also:
hideRow, showColumn

sortByColumn

public final void sortByColumn(int column,
                               Qt.SortOrder order)

Sorts the model by the values in the given column in the given order.

See Also:
sortingEnabled

verticalHeader

public final QHeaderView verticalHeader()

Returns the table view's vertical header.

See Also:
setVerticalHeader, horizontalHeader, QAbstractItemModel::headerData

wordWrap

public final boolean wordWrap()

Returns the item text word-wrapping policy.

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

See Also:
setWordWrap

currentChanged

protected void currentChanged(QModelIndex current,
                              QModelIndex previous)

This function is reimplemented for internal reasons.

Overrides:
currentChanged in class QAbstractItemView

horizontalOffset

protected int horizontalOffset()

Returns the horizontal offset of the items in the table view.

Note that the table view uses the horizontal header section positions to determine the positions of columns in the view.

Specified by:
horizontalOffset in class QAbstractItemView
See Also:
verticalOffset

horizontalScrollbarAction

protected void horizontalScrollbarAction(int action)

This function is reimplemented for internal reasons.

Overrides:
horizontalScrollbarAction in class QAbstractItemView

indexAt

public QModelIndex indexAt(QPoint p)

Returns the index position of the model item corresponding to the table item at position p in contents coordinates.

Specified by:
indexAt in class QAbstractItemView
See Also:
visualRect

isIndexHidden

protected boolean isIndexHidden(QModelIndex index)

This function is reimplemented for internal reasons.

Specified by:
isIndexHidden in class QAbstractItemView

moveCursor

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

Moves the cursor in accordance with the given cursorAction, using the information provided by the modifiers.

Specified by:
moveCursor in class QAbstractItemView
See Also:
QAbstractItemView::CursorAction

paintEvent

protected void paintEvent(QPaintEvent e)

Paints the table on receipt of the given paint event e.

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

scrollContentsBy

protected void scrollContentsBy(int dx,
                                int dy)

This function is reimplemented for internal reasons.

Overrides:
scrollContentsBy in class QAbstractScrollArea

scrollTo

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

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

In the base class this is a pure virtual function.

Specified by:
scrollTo in class QAbstractItemView

selectedIndexes

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

This function is reimplemented for internal reasons.

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

selectionChanged

protected void selectionChanged(QItemSelection selected,
                                QItemSelection deselected)

This function is reimplemented for internal reasons.

Overrides:
selectionChanged in class QAbstractItemView
See Also:
setSelection

setModel

public void setModel(QAbstractItemModel model)

This function is reimplemented for internal reasons.

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

setRootIndex

public void setRootIndex(QModelIndex index)

This function is reimplemented for internal reasons.

Overrides:
setRootIndex in class QAbstractItemView
See Also:
rootIndex

setSelection

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

Selects the items within the given rect and in accordance with the specified selection command.

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

setSelectionModel

public void setSelectionModel(QItemSelectionModel selectionModel)

This function is reimplemented for internal reasons.

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

sizeHintForColumn

public int sizeHintForColumn(int column)

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

If you need to set the width of a given column to a fixed value, call QHeaderView::resizeSection() on the table's horizontal header.

If you reimplement this function in a subclass, note that the value you return is only used when resizeColumnToContents is called. In that case, if a larger column width is required by either the horizontal header or the item delegate, that width will be used instead.

Overrides:
sizeHintForColumn in class QAbstractItemView
See Also:
QWidget::sizeHint, horizontalHeader

sizeHintForRow

public int sizeHintForRow(int row)

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

If you need to set the height of a given row to a fixed value, call QHeaderView::resizeSection() on the table's vertical header.

If you reimplement this function in a subclass, note that the value you return is only used when resizeRowToContents is called. In that case, if a larger row height is required by either the vertical header or the item delegate, that width will be used instead.

Overrides:
sizeHintForRow in class QAbstractItemView
See Also:
QWidget::sizeHint, verticalHeader

timerEvent

protected void timerEvent(QTimerEvent event)

This function is reimplemented for internal reasons.

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

updateGeometries

protected void updateGeometries()

This function is reimplemented for internal reasons.

Overrides:
updateGeometries in class QAbstractItemView

verticalOffset

protected int verticalOffset()

Returns the vertical offset of the items in the table view.

Note that the table view uses the vertical header section positions to determine the positions of rows in the view.

Specified by:
verticalOffset in class QAbstractItemView
See Also:
horizontalOffset

verticalScrollbarAction

protected void verticalScrollbarAction(int action)

This function is reimplemented for internal reasons.

Overrides:
verticalScrollbarAction in class QAbstractItemView

viewOptions

protected QStyleOptionViewItem viewOptions()

This function is reimplemented for internal reasons.

Overrides:
viewOptions in class QAbstractItemView

visualRect

public QRect visualRect(QModelIndex index)

This function is reimplemented for internal reasons.

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

visualRegionForSelection

protected QRegion visualRegionForSelection(QItemSelection selection)

This function is reimplemented for internal reasons.

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

fromNativePointer

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

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

Qt Jambi Home