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

## com.trolltech.qt.gui
Class QRubberBand

    java.lang.Object
      com.trolltech.qt.internal.QSignalEmitterInternal
          com.trolltech.qt.QSignalEmitter
              com.trolltech.qt.QtJambiObject
                  com.trolltech.qt.core.QObject
                      com.trolltech.qt.gui.QWidget
                          com.trolltech.qt.gui.QRubberBand

All Implemented Interfaces:
  QPaintDeviceInterface, QtJambiInterface

    public class QRubberBand

extends QWidget

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 `QDockWidget` that is undocking). Historically 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. A common pattern is to do this in conjunction with mouse events. For example:

            protected void mousePressEvent(QMouseEvent event)
            {
                origin = event.pos();
                if (rubberBand != null)
                    rubberBand = new QRubberBand(QRubberBand.Shape.Rectangle, this);
                rubberBand.setGeometry(new QRect(origin, new QSize()));
                rubberBand.show();
            }

            protected void mouseMoveEvent(QMouseEvent event)
            {
                rubberBand.setGeometry(new QRect(origin, event.pos()).normalized());
            }

            protected void mouseReleaseEvent(QMouseEvent event)
            {
                rubberBand.hide();
                // determine selection, for example using QRect.intersects()
                // and QRect.contains().
            }

If you pass a parent to `QRubberBand`'s constructor, the rubber band will display only inside its parent, but stays on top of other child widgets. If no parent is passed, `QRubberBand` will act as a top-level widget.

Call `show()` to make the rubber band visible; also when the rubber band is not a top-level. Hiding or destroying the widget will make the rubber band disappear. The rubber band can be a `Rectangle` or a `Line` (vertical or horizontal), depending on the `shape()` it was given when constructed.

Nested Class Summary
`static class` | `QRubberBand.Shape` This enum type lists the built-in shapes supported by `QTabBar`.

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, QSignalEmitter.Signal2, QSignalEmitter.Signal3, QSignalEmitter.Signal4, QSignalEmitter.Signal5, QSignalEmitter.Signal6, QSignalEmitter.Signal7, QSignalEmitter.Signal8, QSignalEmitter.Signal9`

Nested classes/interfaces inherited from class com.trolltech.qt.internal.QSignalEmitterInternal
`com.trolltech.qt.internal.QSignalEmitterInternal.AbstractSignalInternal`

Field Summary

Fields inherited from class com.trolltech.qt.gui.QWidget
`customContextMenuRequested`

Fields inherited from class com.trolltech.qt.internal.QSignalEmitterInternal
`currentSender`

Constructor Summary
`QRubberBand(QRubberBand.Shape arg__1)` Constructs a rubber band of shape `s`, with parent `p`.
`QRubberBand(QRubberBand.Shape arg__1, QWidget arg__2)` Constructs a rubber band of shape `s`, with parent `p`.

Method Summary
`protected void` | `initStyleOption(QStyleOptionRubberBand option)` This is a overloaded function provided for convenience.
`void` | `moveRubberBand(int x, int y)` Moves the rubberband to point (`x`, `y`).
`void` | `moveRubberBand(QPoint p)` Moves the rubberband to point `p`.
`void` | `resizeRubberBand(int w, int h)` Resizes the rubberband so that its width is `width`, and its height is `height`.
`void` | `resizeRubberBand(QSize s)` Resizes the rubberband so that its new size is `size`.
`void` | `setRubberBandGeometry(int x, int y, int w, int h)` Sets the geometry of the rubberband to the rectangle whose top-left corner lies at the point (`x`, `y`), and with dimensions specified by `width` and `height`.
`void` | `setRubberBandGeometry(QRect r)` Sets the geometry of the rubber band to `rect`, specified in the coordinate system of its parent widget.
`QRubberBand.Shape` | `shape()` Returns the shape of this rubber band.

Methods inherited from class com.trolltech.qt.gui.QWidget
`acceptDrops, accessibleDescription, accessibleName, actionEvent, actions, activateWindow, addAction, addActions, adjustSize, autoFillBackground, backgroundRole, baseSize, changeEvent, childAt, childAt, childrenRect, childrenRegion, clearFocus, clearMask, close, closeEvent, contentsRect, contextMenuEvent, contextMenuPolicy, cursor, depth, destroy, destroy, destroy, dragEnterEvent, dragLeaveEvent, dragMoveEvent, dropEvent, effectiveWinId, 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, isMaximized, isMinimized, isModal, isVisible, isVisibleTo, isWindow, isWindowModified, keyboardGrabber, keyPressEvent, keyReleaseEvent, languageChange, layout, layoutDirection, leaveEvent, locale, logicalDpiX, logicalDpiY, lower, mapFrom, mapFromGlobal, mapFromParent, mapTo, mapToGlobal, mapToParent, mask, maximumHeight, maximumSize, maximumWidth, metric, minimumHeight, minimumSize, minimumSizeHint, minimumWidth, mouseDoubleClickEvent, mouseGrabber, mouseMoveEvent, mousePressEvent, mouseReleaseEvent, move, move, moveEvent, nativeParentWidget, nextInFocusChain, normalGeometry, numColors, overrideWindowFlags, overrideWindowFlags, paintEngine, paintEvent, paintingActive, palette, parentWidget, physicalDpiX, physicalDpiY, pos, raise, rect, releaseKeyboard, releaseMouse, releaseShortcut, removeAction, render, render, render, render, render, render, render, render, render, repaint, repaint, repaint, repaint, resetInputContext, resize, resize, resizeEvent, 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, setWindowFilePath, setWindowFlags, setWindowFlags, setWindowIcon, setWindowIconText, setWindowModality, setWindowModified, setWindowOpacity, setWindowRole, setWindowState, setWindowState, setWindowTitle, show, showEvent, showFullScreen, showMaximized, showMinimized, showNormal, size, sizeHint, sizeIncrement, sizePolicy, stackUnder, statusTip, style, styleSheet, tabletEvent, testAttribute, toolTip, underMouse, unsetCursor, unsetLayoutDirection, unsetLocale, update, update, update, update, updateGeometry, updateMicroFocus, updatesEnabled, visibleRegion, whatsThis, wheelEvent, width, widthMM, window, windowFilePath, windowFlags, windowIcon, windowIconText, windowModality, windowOpacity, windowRole, windowState, windowTitle, windowType, winId, x, y`

Methods inherited from class com.trolltech.qt.core.QObject
`childEvent, children, connectSlotsByName, customEvent, disposeLater, dumpObjectInfo, dumpObjectTree, dynamicPropertyNames, event, eventFilter, findChild, findChild, findChild, findChildren, findChildren, findChildren, findChildren, indexOfProperty, installEventFilter, isWidgetType, killTimer, moveToThread, objectName, parent, properties, property, removeEventFilter, setObjectName, setParent, setProperty, startTimer, timerEvent, toString, userProperty`

Methods inherited from class com.trolltech.qt.QtJambiObject
`dispose, disposed, equals, finalize, reassignNativeResources, tr, tr, tr`

Methods inherited from class com.trolltech.qt.QSignalEmitter
`blockSignals, disconnect, disconnect, signalsBlocked, signalSender, thread`

Methods inherited from class com.trolltech.qt.internal.QSignalEmitterInternal
`__qt_signalInitialization`

Methods inherited from class java.lang.Object
`clone, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Methods inherited from interface com.trolltech.qt.QtJambiInterface
`disableGarbageCollection, nativeId, nativePointer, reenableGarbageCollection, setJavaOwnership`

Constructor Detail

### QRubberBand

    public QRubberBand(QRubberBand.Shape arg__1)

  Constructs a rubber band of shape `s`, with parent `p`.

  By default a rectangular rubber band (`s` is `Rectangle`) will use a mask, so that a small border of the rectangle is all that is visible. Some styles (e.g., native Mac OS X) will change this and call `QWidget::setWindowOpacity()` to make a semi-transparent filled selection rectangle.

### QRubberBand

    public QRubberBand(QRubberBand.Shape arg__1,
                       QWidget arg__2)

  Constructs a rubber band of shape `s`, with parent `p`.

  By default a rectangular rubber band (`s` is `Rectangle`) will use a mask, so that a small border of the rectangle is all that is visible. Some styles (e.g., native Mac OS X) will change this and call `QWidget::setWindowOpacity()` to make a semi-transparent filled selection rectangle.

Method Detail

### moveRubberBand

    public final void moveRubberBand(QPoint p)

  Moves the rubberband to point `p`.

See also:
  resize().

### moveRubberBand

    public final void moveRubberBand(int x,
                                     int y)

  Moves the rubberband to point (`x`, `y`).

See also:
  resize().

### resizeRubberBand

    public final void resizeRubberBand(QSize s)

  Resizes the rubberband so that its new size is `size`.

See also:
  move().

### resizeRubberBand

    public final void resizeRubberBand(int w,
                                       int h)

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

See also:
  move().

### setRubberBandGeometry

    public final void setRubberBandGeometry(QRect r)

  Sets the geometry of the rubber band to `rect`, specified in the coordinate system of its parent widget.

See also:
  `QWidget::geometry`.

### setRubberBandGeometry

    public final void setRubberBandGeometry(int x,
                                            int y,
                                            int w,
                                            int h)

  Sets the geometry of the rubberband to the rectangle whose top-left corner lies at the point (`x`, `y`), and with dimensions specified by `width` and `height`. The geometry is specified in the parent widget's coordinate system.

### shape

    public final QRubberBand.Shape shape()

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

### initStyleOption

    protected final void initStyleOption(QStyleOptionRubberBand option)

  This is a overloaded function provided for convenience.

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