Home | All Classes | Main Classes | Annotated | Grouped Classes | Functions |

# QRubberBand Class Reference

The QRubberBand class provides a rectangle or line that can indicate a selection or a boundary. More...

    #include <QRubberBand>

Inherits QWidget.

- List of all members, including inherited members

### Public Types

- enum Shape { Line, Rectangle }

### Writable Properties

- 33 writable properties inherited from QWidget
- 1 writable property inherited from QObject

### Read-Only Properties

- 24 read-only properties inherited from QWidget

### Public Functions

- QRubberBand ( Shape , QWidget * = 0 )
- ~QRubberBand ()
- void move ( int x, int y )
- void move ( const QPoint & p )
- void resize ( int width, int height )
- void resize ( const QSize & size )
- void setGeometry ( int x, int y, int w, int h )
- void setGeometry ( const QRect & rect )
- Shape shape () const

- 83 public functions inherited from QWidget
- 24 public functions inherited from QObject
- 2 public functions inherited from QPaintDevice

### Public Slots

- 16 public slots inherited from QWidget
- 1 public slot inherited from QObject

### Signals

- 1 signal inherited from QObject

### Static Public Members

- 4 static public members inherited from QWidget
- 4 static public members inherited from QObject

### Protected Functions

- virtual void drawRubberBand ( QPainter * p )
- virtual void drawRubberBandMask ( QPainter * p )

- 44 protected functions inherited from QWidget
- 9 protected functions inherited from QObject

## Detailed Description

The QRubberBand class provides a rectangle or line that can indicate a selection or a boundary.

A rubber band is often used to show a new bounding area (as in a QSplitter or a QDockWindow that is undocking). Commonly this has been implemented using a QPainter and XOR, but this approach doesn't always work properly since rendering can happen in the window below the rubber band, but before the rubber band has been "erased".

You can create a QRubberBand whenever you need to render a rubber band around a given area (or to represent a single line), then call setGeometry(), move() or resize() to position and size it; hiding (or destroying) the widget will make the rubber band disappear. The rubber band can be a `Rectangle` or a `Line`, depending on the shape() it was given when constructed.

## Member Type Documentation

### enum QRubberBand::Shape

`QRubberBand::Line` |
`QRubberBand::Rectangle` |

## Member Function Documentation

### QRubberBand::QRubberBand ( Shape , QWidget * = 0 )

### QRubberBand::~QRubberBand ()

Destructor.

### void QRubberBand::drawRubberBand ( QPainter * p ) `[virtual protected]`

Virtual function that draws the contents of a QRubberBand using painter p.

The drawing is themed (using QStyle), but you can reimplement it to achieve custom effects.

### void QRubberBand::drawRubberBandMask ( QPainter * p ) `[virtual protected]`

Virtual function that draws the mask of a QRubberBand using painter p.

The drawing is themed (using QStyle), but you can reimplement it to achieve custom effects.

### void QRubberBand::move ( int x, int y )

Moves the rubberband to point (x, y).

### void QRubberBand::move ( const QPoint & p )

This is an overloaded member function, provided for convenience. It behaves essentially like the above function.

Moves the rubberband to point p.

### void QRubberBand::resize ( int width, int height )

Resizes the rubberband so that its width is width, and its height is height.

### void QRubberBand::resize ( const QSize & size )

This is an overloaded member function, provided for convenience. It behaves essentially like the above function.

Resizes the rubberband so that its new size is size.

### void QRubberBand::setGeometry ( int x, int y, int w, int h )

Changes the rubberband's geometry to have a top-left corner of (x, y), a width of w, and a height of h.

### void QRubberBand::setGeometry ( const QRect & rect )

This is an overloaded member function, provided for convenience. It behaves essentially like the above function.

Changes the rubberband's geometry to the geometry of the rectangle rect.

### Shape QRubberBand::shape () const

Returns the shape of this rubber band. The shape can only be set upon construction.