Viadeo Twitter Google Bookmarks ! Facebook Digg del.icio.us MySpace Yahoo MyWeb Blinklist Netvouz Reddit Simpy StumbleUpon Bookmarks Windows Live Favorites 
Logo Documentation Qt ·  Page d'accueil  ·  Toutes les classes  ·  Classes principales  ·  Annotées  ·  Classes groupées  ·  Modules  ·  Fonctions  · 

QAbstractScrollArea Class Reference
[QtGui module]

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

#include <QAbstractScrollArea>

Inherits QFrame.

Inherited by QAbstractItemView, QScrollArea, and QTextEdit.

Properties

  • 6 properties inherited from QFrame
  • 52 properties inherited from QWidget
  • 1 property inherited from QObject

Public Functions

  • 13 public functions inherited from QFrame
  • 184 public functions inherited from QWidget
  • 28 public functions inherited from QObject
  • 10 public functions inherited from QPaintDevice

Protected Functions

  • 39 protected functions inherited from QWidget
  • 7 protected functions inherited from QObject

Additional Inherited Members

  • 17 public slots inherited from QWidget
  • 1 public slot inherited from QObject
  • 1 signal inherited from QWidget
  • 1 signal inherited from QObject
  • 2 static public members inherited from QFrame
  • 4 static public members inherited from QWidget
  • 4 static public members inherited from QObject

Detailed Description

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

QAbstractScrollArea is a low-level abstraction of a scrolling area. It gives you full control of the scroll bars, at the cost of simplicity. In most cases, using a QScrollArea is preferable.

QAbstractScrollArea's central child widget is the scrolling area itself, called viewport(). The viewport widget uses all available space. Next to the viewport is a vertical scroll bar (accessible with verticalScrollBar()), and below a horizontal scroll bar (accessible with horizontalScrollBar()). Each scroll bar can be either visible or hidden, depending on the scroll bar's policy (see verticalScrollBarPolicy and horizontalScrollBarPolicy). 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.

With a scroll bar policy of Qt::ScrollBarAsNeeded (the default), QAbstractScrollArea shows scroll bars when those provide a non-zero scrolling range, and hides them otherwise. You control the range of each scroll bar with QAbstractSlider::setRange().

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.

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.

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


Property Documentation

horizontalScrollBarPolicy : Qt::ScrollBarPolicy

This property holds the policy for the horizontal scroll bar.

The default policy is Qt::ScrollBarAsNeeded.

Access functions:

  • Qt::ScrollBarPolicy horizontalScrollBarPolicy () const
  • void setHorizontalScrollBarPolicy ( Qt::ScrollBarPolicy )

See also verticalScrollBarPolicy.

verticalScrollBarPolicy : Qt::ScrollBarPolicy

This property holds the policy for the vertical scroll bar.

The default policy is Qt::ScrollBarAsNeeded.

Access functions:

  • Qt::ScrollBarPolicy verticalScrollBarPolicy () const
  • void setVerticalScrollBarPolicy ( Qt::ScrollBarPolicy )

See also horizontalScrollBarPolicy.


Member Function Documentation

QAbstractScrollArea::QAbstractScrollArea ( QWidget * parent = 0 )

Constructs a viewport.

The parent arguments is sent to the QWidget constructor.

QAbstractScrollArea::~QAbstractScrollArea ()

Destroys the viewport.

void QAbstractScrollArea::contextMenuEvent ( QContextMenuEvent * e )   [virtual protected]

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

Reimplemented from QWidget.

See also QWidget::contextMenuEvent().

void QAbstractScrollArea::dragEnterEvent ( QDragEnterEvent * event )   [virtual protected]

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

Reimplemented from QWidget.

See also QWidget::dragEnterEvent().

void QAbstractScrollArea::dragLeaveEvent ( QDragLeaveEvent * event )   [virtual protected]

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

Reimplemented from QWidget.

See also QWidget::dragLeaveEvent().

void QAbstractScrollArea::dragMoveEvent ( QDragMoveEvent * event )   [virtual protected]

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

Reimplemented from QWidget.

See also QWidget::dragMoveEvent().

void QAbstractScrollArea::dropEvent ( QDropEvent * event )   [virtual protected]

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

Reimplemented from QWidget.

See also QWidget::dropEvent().

bool QAbstractScrollArea::event ( QEvent * e )   [virtual protected]

This is the main event handler for the QAbstractScrollArea widget (not the scrolling area viewport()). The event is passed in e.

Reimplemented from QObject.

QScrollBar * QAbstractScrollArea::horizontalScrollBar () const

Returns the horizontal scroll bar.

See also horizontalScrollBarPolicy and verticalScrollBar().

void QAbstractScrollArea::keyPressEvent ( QKeyEvent * e )   [virtual protected]

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

Reimplemented from QWidget.

QSize QAbstractScrollArea::maximumViewportSize () const

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

void QAbstractScrollArea::mouseDoubleClickEvent ( QMouseEvent * e )   [virtual protected]

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

Reimplemented from QWidget.

See also QWidget::mouseDoubleClickEvent().

void QAbstractScrollArea::mouseMoveEvent ( QMouseEvent * e )   [virtual protected]

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

Reimplemented from QWidget.

See also QWidget::mouseMoveEvent().

void QAbstractScrollArea::mousePressEvent ( QMouseEvent * e )   [virtual protected]

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

Reimplemented from QWidget.

See also QWidget::mousePressEvent().

void QAbstractScrollArea::mouseReleaseEvent ( QMouseEvent * e )   [virtual protected]

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

Reimplemented from QWidget.

See also QWidget::mouseReleaseEvent().

void QAbstractScrollArea::paintEvent ( QPaintEvent * event )   [virtual protected]

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

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

Reimplemented from QWidget.

See also QWidget::paintEvent().

void QAbstractScrollArea::resizeEvent ( QResizeEvent * event )   [virtual protected]

This event handler can be reimplemented in a subclass to receive resize events (passed in event), for the viewport() widget. When resizeEvent() is called, the viewport already has its new geometry. The old size is accessible through QResizeEvent::oldSize().

Reimplemented from QWidget.

See also QWidget::resizeEvent().

void QAbstractScrollArea::scrollContentsBy ( int dx, int dy )   [virtual protected]

Scrolls the viewport's contents by dx, dy.

void QAbstractScrollArea::setViewportMargins ( int left, int top, int right, int bottom )   [protected]

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.

By default all margins are zero.

QScrollBar * QAbstractScrollArea::verticalScrollBar () const

Returns the vertical scroll bar.

See also verticalScrollBarPolicy and horizontalScrollBar().

QWidget * QAbstractScrollArea::viewport () const

Returns the viewport widget.

bool QAbstractScrollArea::viewportEvent ( QEvent * e )   [virtual protected]

The main event handler for the scrolling area (the viewport() widget). It handles event e.

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

void QAbstractScrollArea::wheelEvent ( QWheelEvent * e )   [virtual protected]

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

Reimplemented from QWidget.

See also QWidget::wheelEvent().

Cette page est une traduction d'une page de la documentation de Qt, écrite par Nokia Corporation and/or its subsidiary(-ies). Les éventuels problèmes résultant d'une mauvaise traduction ne sont pas imputables à Nokia. Qt 4.0
Copyright © 2012 Developpez LLC. Tous droits réservés Developpez LLC. Aucune reproduction, même partielle, ne peut être faite de ce site et de l'ensemble de son contenu : textes, documents et images sans l'autorisation expresse de Developpez LLC. Sinon, vous encourez selon la loi jusqu'à 3 ans de prison et jusqu'à 300 000 E de dommages et intérêts. Cette page est déposée à la SACD.
Vous avez déniché une erreur ? Un bug ? Une redirection cassée ? Ou tout autre problème, quel qu'il soit ? Ou bien vous désirez participer à ce projet de traduction ? N'hésitez pas à nous contacter ou par MP !
 
 
 
 
Partenaires

Hébergement Web