Overview | Package | Class | Tree | Deprecated | Index | Help
Qt Jambi Home |
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.trolltech.qt.gui
Class QAbstractScrollArea

    java.lang.Object
      com.trolltech.qt.QSignalEmitter
          com.trolltech.qt.QtJambiObject
              com.trolltech.qt.core.QObject
                  com.trolltech.qt.gui.QWidget
                      com.trolltech.qt.gui.QFrame
                          com.trolltech.qt.gui.QAbstractScrollArea

All Implemented Interfaces:
  QPaintDeviceInterface, QtJambiInterface

Direct Known Subclasses:
  QAbstractItemView, QGraphicsView, QMdiArea, QScrollArea, QTextEdit

    public class QAbstractScrollArea

extends QFrame

The `QAbstractScrollArea` widget provides a scrolling area with on-demand scroll bars.

`QAbstractScrollArea` is a low-level abstraction of a scrolling area. The area provides a central widget called the viewport, in which the contents of the area is to be scrolled (i.e, the visible parts of the contents are rendered in the viewport).

Next to the viewport is a vertical scroll bar, and below is a horizontal scroll bar. When all of the area contents fits in the viewport, each scroll bar can be either visible or hidden depending on the scroll bar's Qt::ScrollBarPolicy. When a scroll bar is hidden, the viewport expands in order to cover all available space. When a scroll bar becomes visible again, the viewport shrinks in order to make room for the scroll bar.

It is possible to reserve a margin area around the viewport, see `setViewportMargins`. The feature is mostly used to place a `QHeaderView` widget above or beside the scrolling area. Subclasses of `QAbstractScrollArea` should implement margins.

When inheriting `QAbstractScrollArea`, you need to do the following:

- Control the scroll bars by setting their range, value, page step, and tracking their movements.
- Draw the contents of the area in the viewport according to the values of the scroll bars.
- Handle events received by the viewport in `viewportEvent` - notably resize events.

With a scroll bar policy of Qt::ScrollBarAsNeeded (the default), `QAbstractScrollArea` shows scroll bars when they provide a non-zero scrolling range, and hides them otherwise.

The scroll bars and viewport should be updated whenever the viewport receives a resize event or the size of the contents changes. The viewport also needs to be updated when the scroll bars values change. The initial values of the scroll bars are often set when the area receives new contents.

We give a simple example, in which we have implemented a scroll area that can scroll any `QWidget`. We make the widget a child of the viewport; this way, we do not have to calculate which part of the widget to draw but can simply move the widget with QWidget::move(). When the area contents or the viewport size changes, we do the following:

            QSize areaSize = viewport()->size();
            QSize  widgetSize = widget->size();

            verticalScrollBar()->setPageStep(widgetSize.height());
            horizontalScrollBar()->setPageStep(widgetSize.width());
            verticalScrollBar()->setRange(0, widgetSize.height() - areaSize.height());
            horizontalScrollBar()->setRange(0, widgetSize.width() - areaSize.width());
            updateWidgetPosition();

When the scroll bars change value, we need to update the widget position, i.e., find the part of the widget that is to be drawn in the viewport:

            int hvalue = horizontalScrollBar()->value();
            int vvalue = verticalScrollBar()->value();
            QPoint topLeft = viewport()->rect().topLeft();

            widget->move(topLeft.x() - hvalue, topLeft.y() - vvalue);

In order to track scroll bar movements, reimplement the virtual function `scrollContentsBy`. In order to fine-tune scrolling behavior, connect to a scroll bar's QAbstractSlider::actionTriggered() signal and adjust the `QAbstractSlider::sliderPosition` as you wish.

For convenience, `QAbstractScrollArea` makes all viewport events available in the virtual `viewportEvent` handler. `QWidget`'s specialized handlers are remapped to viewport events in the cases where this makes sense. The remapped specialized handlers are: `paintEvent`, `mousePressEvent`, `mouseReleaseEvent`, `mouseDoubleClickEvent`, `mouseMoveEvent`, `wheelEvent`, `dragEnterEvent`, `dragMoveEvent`, `dragLeaveEvent`, `dropEvent`, `contextMenuEvent`, and `resizeEvent`.

`QScrollArea`, which inherits `QAbstractScrollArea`, provides smooth scrolling for any `QWidget` (i.e., the widget is scrolled pixel by pixel). You only need to subclass `QAbstractScrollArea` if you need more specialized behavior. This is, for instance, true if the entire contents of the area is not suitable for being drawn on a `QWidget` or if you do not want smooth scrolling.

See Also:
  `QScrollArea`

Nested Class Summary

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.QWidget
`customContextMenuRequested`

Constructor Summary
`QAbstractScrollArea()` Equivalent to `QAbstractScrollArea`(0).
`QAbstractScrollArea(QWidget parent)` Constructs a viewport.

Method Summary
`void` | `addScrollBarWidget(QWidget widget, Qt.Alignment alignment)` Adds `widget` as a scroll bar widget in the location specified by `alignment`.
`void` | `addScrollBarWidget(QWidget widget, Qt.AlignmentFlag... alignment)` Adds `widget` as a scroll bar widget in the location specified by `alignment`.
`protected void` | `contextMenuEvent(QContextMenuEvent arg__1)` This event handler can be reimplemented in a subclass to receive context menu events for the `viewport` widget.
`QWidget` | `cornerWidget()` Returns the widget in the corner between the two scroll bars.
`protected void` | `dragEnterEvent(QDragEnterEvent arg__1)` This event handler can be reimplemented in a subclass to receive drag enter events (passed in `arg__1`), for the `viewport` widget.
`protected void` | `dragLeaveEvent(QDragLeaveEvent arg__1)` This event handler can be reimplemented in a subclass to receive drag leave events (passed in `arg__1`), for the `viewport` widget.
`protected void` | `dragMoveEvent(QDragMoveEvent arg__1)` This event handler can be reimplemented in a subclass to receive drag move events (passed in `arg__1`), for the `viewport` widget.
`protected void` | `dropEvent(QDropEvent arg__1)` This event handler can be reimplemented in a subclass to receive drop events (passed in `arg__1`), for the `viewport` widget.
`boolean` | `event(QEvent arg__1)` This function is reimplemented for internal reasons.
`static QAbstractScrollArea` | `fromNativePointer(QNativePointer nativePointer)` This function returns the QAbstractScrollArea instance pointed to by nativePointer
`QScrollBar` | `horizontalScrollBar()` Returns the horizontal scroll bar.
`Qt.ScrollBarPolicy` | `horizontalScrollBarPolicy()` Returns the policy for the horizontal scroll bar.
`protected void` | `keyPressEvent(QKeyEvent arg__1)` This function is called with key event `arg__1` when key presses occur.
`QSize` | `maximumViewportSize()` Returns the size of the viewport as if the scroll bars had no valid scrolling range.
`QSize` | `minimumSizeHint()` This function is reimplemented for internal reasons.
`protected void` | `mouseDoubleClickEvent(QMouseEvent arg__1)` This event handler can be reimplemented in a subclass to receive mouse double click events for the `viewport` widget.
`protected void` | `mouseMoveEvent(QMouseEvent arg__1)` This event handler can be reimplemented in a subclass to receive mouse move events for the `viewport` widget.
`protected void` | `mousePressEvent(QMouseEvent arg__1)` This event handler can be reimplemented in a subclass to receive mouse press events for the `viewport` widget.
`protected void` | `mouseReleaseEvent(QMouseEvent arg__1)` This event handler can be reimplemented in a subclass to receive mouse release events for the `viewport` widget.
`QPaintEngine` | `paintEngine()` Returns the widget's paint engine.
`protected void` | `paintEvent(QPaintEvent arg__1)` This event handler can be reimplemented in a subclass to receive paint events (passed in `arg__1`), for the `viewport` widget.
`protected void` | `resizeEvent(QResizeEvent arg__1)` This event handler can be reimplemented in a subclass to receive resize events (passed in `arg__1`), for the `viewport` widget.
`java.util.List<QWidget>` | `scrollBarWidgets(Qt.Alignment alignment)` Returns a list of the currently set scroll bar widgets.
`java.util.List<QWidget>` | `scrollBarWidgets(Qt.AlignmentFlag... alignment)` Returns a list of the currently set scroll bar widgets.
`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` | `setCornerWidget(QWidget widget)` Sets the widget in the corner between the two scroll bars to be `widget`.
`void` | `setHorizontalScrollBar(QScrollBar scrollbar)` Replaces the existing horizontal scroll bar with `scrollbar`, and sets all the former scroll bar's slider properties on the new scroll bar.
`void` | `setHorizontalScrollBarPolicy(Qt.ScrollBarPolicy arg__1)` Sets the policy for the horizontal scroll bar to `arg__1`.
`protected void` | `setupViewport(QWidget viewport)` This slot is called by `QAbstractScrollArea` after `setViewport`(`viewport`) has been called.
`void` | `setVerticalScrollBar(QScrollBar scrollbar)` Replaces the existing vertical scroll bar with `scrollbar`, and sets all the former scroll bar's slider properties on the new scroll bar.
`void` | `setVerticalScrollBarPolicy(Qt.ScrollBarPolicy arg__1)` Sets the policy for the vertical scroll bar to `arg__1`.
`void` | `setViewport(QWidget widget)` Sets the viewport to be the given `widget`.
`protected void` | `setViewportMargins(int left, int top, int right, int bottom)` Sets the margins around the scrolling area to `left`, `top`, `right` and `bottom`.
`QSize` | `sizeHint()` This function is reimplemented for internal reasons.
`QScrollBar` | `verticalScrollBar()` Returns the vertical scroll bar.
`Qt.ScrollBarPolicy` | `verticalScrollBarPolicy()` Returns the policy for the vertical scroll bar.
`QWidget` | `viewport()` Returns the viewport widget.
`protected boolean` | `viewportEvent(QEvent arg__1)` The main event handler for the scrolling area (the `viewport` widget).
`protected void` | `wheelEvent(QWheelEvent arg__1)` This event handler can be reimplemented in a subclass to receive wheel events for the `viewport` widget.

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, focusInEvent, focusNextChild, focusNextPrevChild, focusOutEvent, 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, inputMethodEvent, inputMethodQuery, 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, timerEvent`

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

### QAbstractScrollArea

    public QAbstractScrollArea()

  Equivalent to `QAbstractScrollArea`(0).

### QAbstractScrollArea

    public QAbstractScrollArea(QWidget parent)

  Constructs a viewport.

  The `parent` arguments is sent to the `QWidget` constructor.

Method Detail

### addScrollBarWidget

    public final void addScrollBarWidget(QWidget widget,
                                         Qt.AlignmentFlag... alignment)

  Adds `widget` as a scroll bar widget in the location specified by `alignment`.

  Scroll bar widgets are shown next to the horizontal or vertical scroll bar, and can be placed on either side of it. If you want the scroll bar widgets to be always visible, set the scrollBarPolicy for the corresponding scroll bar to `AlwaysOn`.

  `alignment` must be one of Qt::Alignleft and Qt::AlignRight, which maps to the horizontal scroll bar, or Qt::AlignTop and Qt::AlignBottom, which maps to the vertical scroll bar.

  A scroll bar widget can be removed by either re-parenting the widget or deleting it. It's also possible to hide a widget with QWidget::hide()

  The scroll bar widget will be resized to fit the scroll bar geometry for the current style. The following describes the case for scroll bar widgets on the horizontal scroll bar:

  The height of the widget will be set to match the height of the scroll bar. To control the width of the widget, use QWidget::setMinimumWidth and QWidget::setMaximumWidth, or implement QWidget::sizeHint() and set a horizontal size policy. If you want a square widget, call QStyle::pixelMetric(QStyle::PM_ScrollBarExtent) and set the width to this value.

  See Also:
    `scrollBarWidgets`

### addScrollBarWidget

    public final void addScrollBarWidget(QWidget widget,
                                         Qt.Alignment alignment)

  Adds `widget` as a scroll bar widget in the location specified by `alignment`.

  Scroll bar widgets are shown next to the horizontal or vertical scroll bar, and can be placed on either side of it. If you want the scroll bar widgets to be always visible, set the scrollBarPolicy for the corresponding scroll bar to `AlwaysOn`.

  `alignment` must be one of Qt::Alignleft and Qt::AlignRight, which maps to the horizontal scroll bar, or Qt::AlignTop and Qt::AlignBottom, which maps to the vertical scroll bar.

  A scroll bar widget can be removed by either re-parenting the widget or deleting it. It's also possible to hide a widget with QWidget::hide()

  The scroll bar widget will be resized to fit the scroll bar geometry for the current style. The following describes the case for scroll bar widgets on the horizontal scroll bar:

  The height of the widget will be set to match the height of the scroll bar. To control the width of the widget, use QWidget::setMinimumWidth and QWidget::setMaximumWidth, or implement QWidget::sizeHint() and set a horizontal size policy. If you want a square widget, call QStyle::pixelMetric(QStyle::PM_ScrollBarExtent) and set the width to this value.

  See Also:
    `scrollBarWidgets`

### cornerWidget

    public final QWidget cornerWidget()

  Returns the widget in the corner between the two scroll bars.

  By default, no corner widget is present.

  See Also:
    `setCornerWidget`

### horizontalScrollBar

    public final QScrollBar horizontalScrollBar()

  Returns the horizontal scroll bar.

  See Also:
    `setHorizontalScrollBar`, `horizontalScrollBarPolicy`, `verticalScrollBar`

### horizontalScrollBarPolicy

    public final Qt.ScrollBarPolicy horizontalScrollBarPolicy()

  Returns the policy for the horizontal scroll bar.

  The default policy is Qt::ScrollBarAsNeeded.

  See Also:
    `setHorizontalScrollBarPolicy`, `verticalScrollBarPolicy`

### maximumViewportSize

    public final QSize maximumViewportSize()

  Returns the size of the viewport as if the scroll bars had no valid scrolling range.

### scrollBarWidgets

    public final java.util.List<QWidget> scrollBarWidgets(Qt.AlignmentFlag... alignment)

  Returns a list of the currently set scroll bar widgets. `alignment` can be any combination of the four location flags.

  See Also:
    `addScrollBarWidget`

### scrollBarWidgets

    public final java.util.List<QWidget> scrollBarWidgets(Qt.Alignment alignment)

  Returns a list of the currently set scroll bar widgets. `alignment` can be any combination of the four location flags.

  See Also:
    `addScrollBarWidget`

### setCornerWidget

    public final void setCornerWidget(QWidget widget)

  Sets the widget in the corner between the two scroll bars to be `widget`.

  You will probably also want to set at least one of the scroll bar modes to `AlwaysOn`.

  Passing 0 shows no widget in the corner.

  Any previous corner widget is hidden.

  You may call `setCornerWidget` with the same widget at different times.

  All widgets set here will be deleted by the scroll area when it is destroyed unless you separately reparent the widget after setting some other corner widget (or 0).

  Any newly set widget should have no current parent.

  By default, no corner widget is present.

  See Also:
    `cornerWidget`, `horizontalScrollBarPolicy`, `horizontalScrollBarPolicy`

### setHorizontalScrollBar

    public final void setHorizontalScrollBar(QScrollBar scrollbar)

  Replaces the existing horizontal scroll bar with `scrollbar`, and sets all the former scroll bar's slider properties on the new scroll bar. The former scroll bar is then deleted.

  `QAbstractScrollArea` already provides horizontal and vertical scroll bars by default. You can call this function to replace the default horizontal scroll bar with your own custom scroll bar.

  See Also:
    `horizontalScrollBar`, `setVerticalScrollBar`

### setHorizontalScrollBarPolicy

    public final void setHorizontalScrollBarPolicy(Qt.ScrollBarPolicy arg__1)

  Sets the policy for the horizontal scroll bar to `arg__1`.

  The default policy is Qt::ScrollBarAsNeeded.

  See Also:
    `horizontalScrollBarPolicy`, `verticalScrollBarPolicy`

### setVerticalScrollBar

    public final void setVerticalScrollBar(QScrollBar scrollbar)

  Replaces the existing vertical scroll bar with `scrollbar`, and sets all the former scroll bar's slider properties on the new scroll bar. The former scroll bar is then deleted.

  `QAbstractScrollArea` already provides vertical and horizontal scroll bars by default. You can call this function to replace the default vertical scroll bar with your own custom scroll bar.

  See Also:
    `verticalScrollBar`, `setHorizontalScrollBar`

### setVerticalScrollBarPolicy

    public final void setVerticalScrollBarPolicy(Qt.ScrollBarPolicy arg__1)

  Sets the policy for the vertical scroll bar to `arg__1`.

  The default policy is Qt::ScrollBarAsNeeded.

  See Also:
    `verticalScrollBarPolicy`, `horizontalScrollBarPolicy`

### setViewport

    public final void setViewport(QWidget widget)

  Sets the viewport to be the given `widget`. The `QAbstractScrollArea` will take ownership of the given `widget`.

  If `widget` is 0, `QAbstractScrollArea` will assign a new `QWidget` instance for the viewport.

  See Also:
    `viewport`

### setViewportMargins

    protected final void setViewportMargins(int left,
                                            int top,
                                            int right,
                                            int bottom)

  Sets the margins around the scrolling area to `left`, `top`, `right` and `bottom`. This is useful for applications such as spreadsheets with "locked" rows and columns. The marginal space is is left blank; put widgets in the unused area.

  Note that this function is frequently called by `QTreeView` and `QTableView`, so margins must be implemented by `QAbstractScrollArea` subclasses. Also, if the subclasses are to be used in item views, they should not call this function.

  By default all margins are zero.

### setupViewport

    protected void setupViewport(QWidget viewport)

  This slot is called by `QAbstractScrollArea` after `setViewport`(`viewport`) has been called. Reimplement this function in a subclass of `QAbstractScrollArea` to initialize the new `viewport` before it is used.

  See Also:
    `setViewport`

### verticalScrollBar

    public final QScrollBar verticalScrollBar()

  Returns the vertical scroll bar.

  See Also:
    `setVerticalScrollBar`, `verticalScrollBarPolicy`, `horizontalScrollBar`

### verticalScrollBarPolicy

    public final Qt.ScrollBarPolicy verticalScrollBarPolicy()

  Returns the policy for the vertical scroll bar.

  The default policy is Qt::ScrollBarAsNeeded.

  See Also:
    `setVerticalScrollBarPolicy`, `horizontalScrollBarPolicy`

### viewport

    public final QWidget viewport()

  Returns the viewport widget.

  Use the QScrollArea::widget() function to retrieve the contents of the viewport widget.

  See Also:
    `setViewport`, `QScrollArea::widget`

### contextMenuEvent

    protected void contextMenuEvent(QContextMenuEvent arg__1)

  This event handler can be reimplemented in a subclass to receive context menu events for the `viewport` widget. The event is passed in `arg__1`.

  Overrides:
    `contextMenuEvent` in class `QWidget`
  See Also:
    `QWidget::contextMenuEvent`

### dragEnterEvent

    protected void dragEnterEvent(QDragEnterEvent arg__1)

  This event handler can be reimplemented in a subclass to receive drag enter events (passed in `arg__1`), for the `viewport` widget.

  Overrides:
    `dragEnterEvent` in class `QWidget`
  See Also:
    `QWidget::dragEnterEvent`

### dragLeaveEvent

    protected void dragLeaveEvent(QDragLeaveEvent arg__1)

  This event handler can be reimplemented in a subclass to receive drag leave events (passed in `arg__1`), for the `viewport` widget.

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

### dragMoveEvent

    protected void dragMoveEvent(QDragMoveEvent arg__1)

  This event handler can be reimplemented in a subclass to receive drag move events (passed in `arg__1`), for the `viewport` widget.

  Overrides:
    `dragMoveEvent` in class `QWidget`
  See Also:
    `QWidget::dragMoveEvent`

### dropEvent

    protected void dropEvent(QDropEvent arg__1)

  This event handler can be reimplemented in a subclass to receive drop events (passed in `arg__1`), for the `viewport` widget.

  Overrides:
    `dropEvent` in class `QWidget`
  See Also:
    `QWidget::dropEvent`

### event

    public boolean event(QEvent arg__1)

  This function is reimplemented for internal reasons.

  Overrides:
    `event` in class `QFrame`
  See Also:
    `QEvent::type`

### keyPressEvent

    protected void keyPressEvent(QKeyEvent arg__1)

  This function is called with key event `arg__1` when key presses occur. It handles PageUp, PageDown, Up, Down, Left, and Right, and ignores all other key presses.

  Overrides:
    `keyPressEvent` in class `QWidget`
  See Also:
    `keyReleaseEvent`, `QKeyEvent::ignore`, `setFocusPolicy`, `focusInEvent`, `focusOutEvent`, `event`, `QKeyEvent`, Tetrix Example

### minimumSizeHint

    public QSize minimumSizeHint()

  This function is reimplemented for internal reasons.

  Overrides:
    `minimumSizeHint` in class `QWidget`
  See Also:
    `QSize::isValid`, `resize`, `setMinimumSize`, `sizePolicy`

### mouseDoubleClickEvent

    protected void mouseDoubleClickEvent(QMouseEvent arg__1)

  This event handler can be reimplemented in a subclass to receive mouse double click events for the `viewport` widget. The event is passed in `arg__1`.

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

### mouseMoveEvent

    protected void mouseMoveEvent(QMouseEvent arg__1)

  This event handler can be reimplemented in a subclass to receive mouse move events for the `viewport` widget. The event is passed in `arg__1`.

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

### mousePressEvent

    protected void mousePressEvent(QMouseEvent arg__1)

  This event handler can be reimplemented in a subclass to receive mouse press events for the `viewport` widget. The event is passed in `arg__1`.

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

### mouseReleaseEvent

    protected void mouseReleaseEvent(QMouseEvent arg__1)

  This event handler can be reimplemented in a subclass to receive mouse release events for the `viewport` widget. The event is passed in `arg__1`.

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

### paintEvent

    protected void paintEvent(QPaintEvent arg__1)

  This event handler can be reimplemented in a subclass to receive paint events (passed in `arg__1`), for the `viewport` widget.

  Note: If you open a painter, make sure to open it on the `viewport`.

  Overrides:
    `paintEvent` in class `QFrame`
  See Also:
    `QWidget::paintEvent`

### resizeEvent

    protected void resizeEvent(QResizeEvent arg__1)

  This event handler can be reimplemented in a subclass to receive resize events (passed in `arg__1`), for the `viewport` widget.

  When `resizeEvent` is called, the viewport already has its new geometry: Its new size is accessible through the QResizeEvent::size() function, and the old size through QResizeEvent::oldSize().

  Overrides:
    `resizeEvent` in class `QWidget`
  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).

### sizeHint

    public QSize sizeHint()

  This function is reimplemented for internal reasons.

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

### viewportEvent

    protected boolean viewportEvent(QEvent arg__1)

  The main event handler for the scrolling area (the `viewport` widget). It handles the `arg__1` specified, and can be called by subclasses to provide reasonable default behavior.

  Returns true to indicate to the event system that the event has been handled, and needs no further processing; otherwise returns false to indicate that the event should be propagated further.

  You can reimplement this function in a subclass, but we recommend using one of the specialized event handlers instead.

  Specialised handlers for viewport events are: `paintEvent`, `mousePressEvent`, `mouseReleaseEvent`, `mouseDoubleClickEvent`, `mouseMoveEvent`, `wheelEvent`, `dragEnterEvent`, `dragMoveEvent`, `dragLeaveEvent`, `dropEvent`, `contextMenuEvent`, and `resizeEvent`.

### wheelEvent

    protected void wheelEvent(QWheelEvent arg__1)

  This event handler can be reimplemented in a subclass to receive wheel events for the `viewport` widget. The event is passed in `arg__1`.

  Overrides:
    `wheelEvent` in class `QWidget`
  See Also:
    `QWidget::wheelEvent`

### fromNativePointer

    public static QAbstractScrollArea fromNativePointer(QNativePointer nativePointer)

  This function returns the QAbstractScrollArea instance pointed to by nativePointer

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

### paintEngine

    public QPaintEngine paintEngine()

  Returns the widget's paint engine.

  Specified by:
    `paintEngine` in interface `QPaintDeviceInterface`
  Overrides:
    `paintEngine` in class `QWidget`

Overview | Package | Class | Tree | Deprecated | Index | Help
Qt Jambi Home |
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD