|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.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.QSplitterHandle
public class QSplitterHandle
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:
public class Splitter extends QSplitter { public Splitter(Qt.Orientation orientation, QWidget parent) { ... } protected QSplitterHandle createHandle() { ... } };The
createHandle()
implementation simply constructs a custom splitter handle, called Splitter in this example: protected QSplitterHandle 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:
protected void paintEvent(QPaintEvent event) { QPainter painter = new QPainter(this); if (orientation().equals(Qt.Orientation.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(), new 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.
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, 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 | |
---|---|
QSplitterHandle(Qt.Orientation o,
QSplitter parent)
Creates a QSplitter handle with the given orientation and QSplitter parent. |
Method Summary | |
---|---|
protected int |
closestLegalPosition(int p)
Returns the closest legal position to pos of the splitter handle. |
protected void |
moveSplitter(int p)
Tells the splitter to move this handle to position pos, 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. |
void |
setOrientation(Qt.Orientation o)
Sets the orientation of the splitter handle to orientation. |
QSplitter |
splitter()
Returns the splitter associated with this splitter handle. |
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 |
---|
public QSplitterHandle(Qt.Orientation o, QSplitter parent)
QSplitter
handle with the given orientation and QSplitter
parent.
Method Detail |
---|
protected final int closestLegalPosition(int p)
QSplitter::closestLegalPosition()
, and moveSplitter()
.
protected final void moveSplitter(int p)
Note that pos is also measured from the left (or top) for right-to-left languages. This function will map pos to the appropriate position before calling QSplitter::moveSplitter()
.
QSplitter::moveSplitter()
, and closestLegalPosition()
.
public final boolean opaqueResize()
QSplitter
. QSplitter::opaqueResize()
.
public final Qt.Orientation orientation()
QSplitter
. setOrientation()
, and QSplitter::orientation()
.
public final void setOrientation(Qt.Orientation o)
QSplitter
. orientation()
, and QSplitter::setOrientation()
.
public final QSplitter splitter()
QSplitter::handle()
.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |