Qt Jambi Home

com.trolltech.qt.gui
Class QSplitterHandle

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.QSplitterHandle
All Implemented Interfaces:
QPaintDeviceInterface, QtJambiInterface

public class QSplitterHandle
extends QWidget

The QSplitterHandle class provides handle functionality of the splitter.

QSplitterHandle is typically what people think about when they think about a splitter. It is the handle that is used to resize the widgets.

A typical developer using QSplitter will never have to worry about QSplitterHandle. It is provided for developers who want splitter handles that provide extra features, such as popup menus.

The typical way one would create splitter handles is to subclass QSplitter then reimplement QSplitter::createHandle() to instantiate the custom splitter handle. For example, a minimum QSplitter subclass might look like this:

    class Splitter : public QSplitter
    {
    public:
        Splitter(Qt::Orientation orientation, QWidget *parent = 0);

    protected:
        QSplitterHandle *createHandle();
    };

The createHandle() implementation simply constructs a custom splitter handle, called Splitter in this example:

    QSplitterHandle *Splitter::createHandle()
    {
        return new SplitterHandle(orientation(), this);
    }

Information about a given handle can be obtained using functions like orientation and opaqueResize, and is retrieved from its parent splitter. Details like these can be used to give custom handles different appearances depending on the splitter's orientation.

The complexity of a custom handle subclass depends on the tasks that it needs to perform. A simple subclass might only provide a paintEvent implementation:

    void SplitterHandle::paintEvent(QPaintEvent *event)
    {
        QPainter painter(this);
        if (orientation() == Qt::Horizontal) {
            gradient.setStart(rect().left(), rect().height()/2);
            gradient.setFinalStop(rect().right(), rect().height()/2);
        } else {
            gradient.setStart(rect().width()/2, rect().top());
            gradient.setFinalStop(rect().width()/2, rect().bottom());
        }
        painter.fillRect(event->rect(), QBrush(gradient));
    }

In this example, a predefined gradient is set up differently depending on the orientation of the handle. QSplitterHandle provides a reasonable size hint for the handle, so the subclass does not need to provide a reimplementation of sizeHint unless the handle has special size requirements.

See Also:
QSplitter

Nested Class Summary
 
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
QSplitterHandle(Qt.Orientation o, QSplitter parent)
          Creates a QSplitter handle with the given o and QSplitter parent.
 
Method Summary
protected  int closestLegalPosition(int p)
          Returns the closest legal position to p of the splitter handle.
 boolean event(QEvent arg__1)
          This function is reimplemented for internal reasons.
static QSplitterHandle fromNativePointer(QNativePointer nativePointer)
          This function returns the QSplitterHandle instance pointed to by nativePointer
protected  void mouseMoveEvent(QMouseEvent arg__1)
          This function is reimplemented for internal reasons.
protected  void mousePressEvent(QMouseEvent arg__1)
          This function is reimplemented for internal reasons.
protected  void mouseReleaseEvent(QMouseEvent arg__1)
          This function is reimplemented for internal reasons.
protected  void moveSplitter(int p)
          Tells the splitter to move this handle to position p, which is the distance from the left or top edge of the widget.
 boolean opaqueResize()
          Returns true if widgets are resized dynamically (opaquely), otherwise returns false.
 Qt.Orientation orientation()
          Returns the handle's orientation.
protected  void paintEvent(QPaintEvent arg__1)
          This function is reimplemented for internal reasons.
 void setOrientation(Qt.Orientation o)
          Sets the orientation of the splitter handle to o.
 QSize sizeHint()
          This function is reimplemented for internal reasons.
 QSplitter splitter()
          Returns the splitter associated with this splitter handle.
 
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, createWinId, cursor, depth, destroy, destroy, destroy, devType, dragEnterEvent, dragLeaveEvent, dragMoveEvent, dropEvent, 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, keyPressEvent, keyReleaseEvent, layout, layoutDirection, leaveEvent, locale, logicalDpiX, logicalDpiY, lower, mapFrom, mapFromGlobal, mapFromParent, mapTo, mapToGlobal, mapToParent, mask, maximumHeight, maximumSize, maximumWidth, metric, minimumHeight, minimumSize, minimumSizeHint, minimumWidth, mouseDoubleClickEvent, mouseGrabber, move, move, moveEvent, nextInFocusChain, normalGeometry, numColors, overrideWindowFlags, overrideWindowFlags, overrideWindowState, overrideWindowState, paintEngine, paintingActive, palette, parentWidget, physicalDpiX, physicalDpiY, pos, raise, rect, releaseKeyboard, releaseMouse, releaseShortcut, removeAction, 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, 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, wheelEvent, 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

QSplitterHandle

public QSplitterHandle(Qt.Orientation o,
                       QSplitter parent)

Creates a QSplitter handle with the given o and QSplitter parent.

Method Detail

closestLegalPosition

protected final int closestLegalPosition(int p)

Returns the closest legal position to p of the splitter handle. The positions are measured from the left or top edge of the splitter, even for right-to-left languages.

See Also:
QSplitter::closestLegalPosition, moveSplitter

moveSplitter

protected final void moveSplitter(int p)

Tells the splitter to move this handle to position p, which is the distance from the left or top edge of the widget.

Note that p is also measured from the left (or top) for right-to-left languages. This function will map p to the appropriate position before calling QSplitter::moveSplitter().

See Also:
QSplitter::moveSplitter, closestLegalPosition

opaqueResize

public final boolean opaqueResize()

Returns true if widgets are resized dynamically (opaquely), otherwise returns false. This value is controlled by the QSplitter.

See Also:
QSplitter::opaqueResize

orientation

public final Qt.Orientation orientation()

Returns the handle's orientation. This is usually propagated from the QSplitter.

See Also:
setOrientation, QSplitter::orientation

setOrientation

public final void setOrientation(Qt.Orientation o)

Sets the orientation of the splitter handle to o. This is usually propogated from the QSplitter.

See Also:
orientation, QSplitter::setOrientation

splitter

public final QSplitter splitter()

Returns the splitter associated with this splitter handle.

See Also:
QSplitter::handle

event

public boolean event(QEvent arg__1)

This function is reimplemented for internal reasons.

Overrides:
event in class QWidget
See Also:
closeEvent, focusInEvent, focusOutEvent, enterEvent, keyPressEvent, keyReleaseEvent, leaveEvent, mouseDoubleClickEvent, mouseMoveEvent, mousePressEvent, mouseReleaseEvent, moveEvent, paintEvent, resizeEvent, QObject::event, QObject::timerEvent

mouseMoveEvent

protected void mouseMoveEvent(QMouseEvent arg__1)

This function is reimplemented for internal reasons.

Overrides:
mouseMoveEvent in class QWidget
See Also:
setMouseTracking, mousePressEvent, mouseReleaseEvent, mouseDoubleClickEvent, event, QMouseEvent, Example

mousePressEvent

protected void mousePressEvent(QMouseEvent arg__1)

This function is reimplemented for internal reasons.

Overrides:
mousePressEvent in class QWidget
See Also:
mouseReleaseEvent, mouseDoubleClickEvent, mouseMoveEvent, event, QMouseEvent, Example

mouseReleaseEvent

protected void mouseReleaseEvent(QMouseEvent arg__1)

This function is reimplemented for internal reasons.

Overrides:
mouseReleaseEvent in class QWidget
See Also:
mousePressEvent, mouseDoubleClickEvent, mouseMoveEvent, event, QMouseEvent, Example

paintEvent

protected void paintEvent(QPaintEvent arg__1)

This function is reimplemented for internal reasons.

Overrides:
paintEvent in class QWidget
See Also:
event, repaint, update, QPainter, QPixmap, QPaintEvent, Analog Clock Example

sizeHint

public QSize sizeHint()

This function is reimplemented for internal reasons.

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

fromNativePointer

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

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

Qt Jambi Home