CopperSpice API  1.9.1
QSplitter Class Reference

The QSplitter class implements a splitter widget. More...

Inheritance diagram for QSplitter:
QFrame QWidget QObject QPaintDevice

Public Signals

void splitterMoved (int pos, int index)
- Public Signals inherited from QWidget
void customContextMenuRequested (const QPoint &pos)
void windowIconChanged (const QIcon &icon)
void windowIconTextChanged (const QString &iconText)
void windowTitleChanged (const QString &title)
- Public Signals inherited from QObject
void destroyed (QObject *obj=nullptr)
void objectNameChanged (const QString &objectName)

Public Methods

 QSplitter (Qt::Orientation orientation, QWidget *parent=nullptr)
 QSplitter (QWidget *parent=nullptr)
 ~QSplitter ()
void addWidget (QWidget *widget)
bool childrenCollapsible () const
int count () const
void getRange (int index, int *min, int *max) const
QSplitterHandlehandle (int index) const
int handleWidth () const
int indexOf (QWidget *widget) const
void insertWidget (int index, QWidget *widget)
bool isCollapsible (int index) const
QSize minimumSizeHint () const override
bool opaqueResize () const
Qt::Orientation orientation () const
void refresh ()
bool restoreState (const QByteArray &state)
QByteArray saveState () const
void setChildrenCollapsible (bool value)
void setCollapsible (int index, bool collapse)
void setHandleWidth (int width)
void setOpaqueResize (bool opaque=true)
void setOrientation (Qt::Orientation value)
void setSizes (const QList< int > &list)
void setStretchFactor (int index, int stretch)
QSize sizeHint () const override
QList< int > sizes () const
QWidgetwidget (int index) const
- Public Methods inherited from QFrame
 QFrame (QWidget *parent=nullptr, Qt::WindowFlags flags=Qt::EmptyFlag)
 ~QFrame ()
QRect frameRect () const
Shadow frameShadow () const
Shape frameShape () const
int frameStyle () const
int frameWidth () const
int lineWidth () const
int midLineWidth () const
void setFrameRect (const QRect &rect)
void setFrameShadow (Shadow value)
void setFrameShape (Shape value)
void setFrameStyle (int style)
void setLineWidth (int width)
void setMidLineWidth (int width)
- Public Methods inherited from QWidget
 QWidget (QWidget *parent=nullptr, Qt::WindowFlags flags=Qt::EmptyFlag)
 ~QWidget ()
bool acceptDrops () const
QString accessibleDescription () const
QString accessibleName () const
QList< QAction * > actions () const
void activateWindow ()
void addAction (QAction *action)
void addActions (const QList< QAction * > &actions)
void adjustSize ()
bool autoFillBackground () const
QPalette::ColorRole backgroundRole () const
QBackingStorebackingStore () const
QSize baseSize () const
QWidget * childAt (const QPoint &position) const
QWidget * childAt (int x, int y) const
QRect childrenRect () const
QRegion childrenRegion () const
void clearFocus ()
void clearMask ()
QMargins contentsMargins () const
QRect contentsRect () const
Qt::ContextMenuPolicy contextMenuPolicy () const
QCursor cursor () const
WId effectiveWinId () const
void ensurePolished () const
Qt::FocusPolicy focusPolicy () const
QWidget * focusProxy () const
QWidget * focusWidget () const
const QFontfont () const
QFontInfo fontInfo () const
QFontMetrics fontMetrics () const
QPalette::ColorRole foregroundRole () const
QRect frameGeometry () const
QSize frameSize () const
const QRectgeometry () const
void getContentsMargins (int *left, int *top, int *right, int *bottom) const
QPixmap grab (const QRect &rectangle=QRect (QPoint (0, 0), QSize (-1,-1)))
void grabGesture (Qt::GestureType gestureType, Qt::GestureFlags flags=Qt::GestureFlags ())
void grabKeyboard ()
void grabMouse ()
void grabMouse (const QCursor &cursor)
int grabShortcut (const QKeySequence &key, Qt::ShortcutContext context=Qt::WindowShortcut)
QGraphicsEffectgraphicsEffect () const
QGraphicsProxyWidgetgraphicsProxyWidget () const
bool hasEditFocus () const
bool hasFocus () const
virtual bool hasHeightForWidth () const
bool hasMouseTracking () const
int height () const
virtual int heightForWidth (int width) const
Qt::InputMethodHints inputMethodHints () const
virtual QVariant inputMethodQuery (Qt::InputMethodQuery query) const
void insertAction (QAction *before, QAction *action)
void insertActions (QAction *before, QList< QAction * > actions)
bool isActiveWindow () const
bool isAncestorOf (const QWidget *child) const
bool isEnabled () const
bool isEnabledTo (const QWidget *parent) const
bool isEnabledToTLW () const
bool isFullScreen () const
bool isHidden () const
bool isMaximized () const
bool isMinimized () const
bool isModal () const
bool isTopLevel () const
bool isVisible () const
bool isVisibleTo (const QWidget *parent) const
bool isWindow () const
bool isWindowModified () const
QLayoutlayout () const
Qt::LayoutDirection layoutDirection () const
QLocale locale () const
QPoint mapFrom (const QWidget *parent, const QPoint &pos) const
QPoint mapFromGlobal (const QPoint &pos) const
QPoint mapFromParent (const QPoint &pos) const
QPoint mapTo (const QWidget *parent, const QPoint &pos) const
QPoint mapToGlobal (const QPoint &pos) const
QPoint mapToParent (const QPoint &pos) const
QRegion mask () const
int maximumHeight () const
QSize maximumSize () const
int maximumWidth () const
int minimumHeight () const
QSize minimumSize () const
int minimumWidth () const
void move (const QPoint &point)
void move (int x, int y)
QWidget * nativeParentWidget () const
QWidget * nextInFocusChain () const
QRect normalGeometry () const
void overrideWindowFlags (Qt::WindowFlags flags)
QPaintEnginepaintEngine () const override
const QPalettepalette () const
QWidget * parentWidget () const
QPoint pos () const
QWidget * previousInFocusChain () const
QRect rect () const
void releaseKeyboard ()
void releaseMouse ()
void releaseShortcut (int id)
void removeAction (QAction *action)
void render (QPaintDevice *target, const QPoint &targetOffset=QPoint (), const QRegion &sourceRegion=QRegion (), RenderFlags renderFlags=RenderFlags (DrawWindowBackground|DrawChildren))
void render (QPainter *painter, const QPoint &targetOffset=QPoint (), const QRegion &sourceRegion=QRegion (), RenderFlags renderFlags=RenderFlags (DrawWindowBackground|DrawChildren))
void repaint (const QRect &rect)
void repaint (const QRegion &region)
void repaint (int x, int y, int w, int h)
void resize (const QSize &size)
void resize (int w, int h)
bool restoreGeometry (const QByteArray &geometry)
QByteArray saveGeometry () const
void scroll (int dx, int dy)
void scroll (int dx, int dy, const QRect &rect)
void setAcceptDrops (bool on)
void setAccessibleDescription (const QString &description)
void setAccessibleName (const QString &name)
void setAttribute (Qt::WidgetAttribute attribute, bool enable=true)
void setAutoFillBackground (bool enable)
void setBackgroundRole (QPalette::ColorRole role)
void setBaseSize (const QSize &size)
void setBaseSize (int basew, int baseh)
void setContentsMargins (const QMargins &margins)
void setContentsMargins (int left, int top, int right, int bottom)
void setContextMenuPolicy (Qt::ContextMenuPolicy policy)
void setCursor (const QCursor &cursor)
void setEditFocus (bool enable)
void setFixedHeight (int h)
void setFixedSize (const QSize &size)
void setFixedSize (int w, int h)
void setFixedWidth (int w)
void setFocus (Qt::FocusReason reason)
void setFocusPolicy (Qt::FocusPolicy policy)
void setFocusProxy (QWidget *widget)
void setFont (const QFont &font)
void setForegroundRole (QPalette::ColorRole role)
void setGeometry (const QRect &rect)
void setGeometry (int x, int y, int w, int h)
void setGraphicsEffect (QGraphicsEffect *effect)
void setInputMethodHints (Qt::InputMethodHints hints)
void setLayout (QLayout *layout)
void setLayoutDirection (Qt::LayoutDirection direction)
void setLocale (const QLocale &locale)
void setMask (const QBitmap &bitmap)
void setMask (const QRegion &region)
void setMaximumHeight (int maxh)
void setMaximumSize (const QSize &size)
void setMaximumSize (int maxw, int maxh)
void setMaximumWidth (int maxw)
void setMinimumHeight (int minh)
void setMinimumSize (const QSize &size)
void setMinimumSize (int minw, int minh)
void setMinimumWidth (int minw)
void setMouseTracking (bool enable)
void setPalette (const QPalette &palette)
void setParent (QWidget *parent)
void setParent (QWidget *parent, Qt::WindowFlags flags)
void setShortcutAutoRepeat (int id, bool enable=true)
void setShortcutEnabled (int id, bool enable=true)
void setSizeIncrement (const QSize &size)
void setSizeIncrement (int w, int h)
void setSizePolicy (QSizePolicy policy)
void setSizePolicy (QSizePolicy::Policy horizontal, QSizePolicy::Policy vertical)
void setStatusTip (const QString &data)
void setStyle (QStyle *style)
void setToolTip (const QString &data)
void setToolTipDuration (int msec)
void setUpdatesEnabled (bool enable)
void setWhatsThis (const QString &str)
void setWindowFilePath (const QString &filePath)
void setWindowFlags (Qt::WindowFlags flags)
void setWindowIcon (const QIcon &icon)
void setWindowModality (Qt::WindowModality windowModality)
void setWindowOpacity (qreal level)
void setWindowRole (const QString &role)
void setWindowState (Qt::WindowStates windowState)
QSize size () const
QSize sizeIncrement () const
QSizePolicy sizePolicy () const
void stackUnder (QWidget *widget)
QString statusTip () const
QStylestyle () const
QString styleSheet () const
bool testAttribute (Qt::WidgetAttribute attribute) const
QString toolTip () const
int toolTipDuration () const
QWidget * topLevelWidget () const
bool underMouse () const
void ungrabGesture (Qt::GestureType gestureType)
void unsetCursor ()
void unsetLayoutDirection ()
void unsetLocale ()
void update (const QRect &rect)
void update (const QRegion &region)
void update (int x, int y, int w, int h)
void updateGeometry ()
bool updatesEnabled () const
QRegion visibleRegion () const
QString whatsThis () const
int width () const
QWidget * window () const
QString windowFilePath () const
Qt::WindowFlags windowFlags () const
QWindowwindowHandle () const
QIcon windowIcon () const
Qt::WindowModality windowModality () const
qreal windowOpacity () const
QString windowRole () const
Qt::WindowStates windowState () const
QString windowTitle () const
Qt::WindowType windowType () const
WId winId () const
int x () const
int y () const
- Public Methods inherited from QObject
 QObject (QObject *parent=nullptr)
 ~QObject ()
bool blockSignals (bool block)
const QList< QObject * > & children () const
bool connect (const QObject *sender, const QString &signalMethod, const QString &location, const QString &slotMethod, Qt::ConnectionType type=Qt::AutoConnection)
bool connect (const QObject *sender, const QString &signalMethod, const QString &slotMethod, Qt::ConnectionType type=Qt::AutoConnection)
bool disconnect (const QObject *receiver, const QString &slotMethod=QString ()) const
bool disconnect (const QString &signalMethod, const QString &location, const QObject *receiver=nullptr, const QString &slotMethod=QString ()) const
bool disconnect (const QString &signalMethod=QString (), const QObject *receiver=nullptr, const QString &slotMethod=QString ()) const
void dumpObjectInfo ()
void dumpObjectTree ()
QList< QStringdynamicPropertyNames () const
virtual bool event (QEvent *event)
virtual bool eventFilter (QObject *watched, QEvent *event)
template<typename T >
findChild (const QString &childName=QString ()) const
template<class T >
QList< T > findChildren (const QRegularExpression &regExp, Qt::FindChildOptions options=Qt::FindChildrenRecursively) const
template<class T >
QList< T > findChildren (const QString &childName=QString (), Qt::FindChildOptions options=Qt::FindChildrenRecursively) const
bool inherits (const QString &className) const
void installEventFilter (QObject *filterObj)
bool isWidgetType () const
bool isWindowType () const
void killTimer (int id)
const QMetaObjectmetaObject () const
void moveToThread (QThread *targetThread)
QString objectName () const
QObject * parent () const
template<class T = QVariant>
property (const QString &name) const
void removeEventFilter (QObject *obj)
void setObjectName (const QString &name)
void setParent (QObject *parent)
bool setProperty (const QString &name, const QVariant &value)
bool signalsBlocked () const
int startTimer (int interval, Qt::TimerType timerType=Qt::CoarseTimer)
QThreadthread () const
- Public Methods inherited from QPaintDevice
virtual ~QPaintDevice ()
int colorCount () const
int depth () const
int devicePixelRatio () const
qreal devicePixelRatioF () const
int height () const
int heightMM () const
int logicalDpiX () const
int logicalDpiY () const
bool paintingActive () const
int physicalDpiX () const
int physicalDpiY () const
int width () const
int widthMM () const

Protected Methods

void changeEvent (QEvent *event) override
void childEvent (QChildEvent *event) override
int closestLegalPosition (int pos, int index)
virtual QSplitterHandlecreateHandle ()
bool event (QEvent *event) override
void moveSplitter (int pos, int index)
void resizeEvent (QResizeEvent *event) override
void setRubberBand (int pos)
- Protected Methods inherited from QFrame
void drawFrame (QPainter *painter)
bool event (QEvent *event) override
void initStyleOption (QStyleOptionFrame *option) const
void paintEvent (QPaintEvent *event) override
- Protected Methods inherited from QWidget
virtual void actionEvent (QActionEvent *event)
virtual void closeEvent (QCloseEvent *event)
virtual void contextMenuEvent (QContextMenuEvent *event)
void create (WId window=0, bool initializeWindow=true, bool destroyOldWindow=true)
void destroy (bool destroyWindow=true, bool destroySubWindows=true)
virtual void dragEnterEvent (QDragEnterEvent *event)
virtual void dragLeaveEvent (QDragLeaveEvent *event)
virtual void dragMoveEvent (QDragMoveEvent *event)
virtual void dropEvent (QDropEvent *event)
virtual void enterEvent (QEvent *event)
bool event (QEvent *event) override
virtual void focusInEvent (QFocusEvent *event)
bool focusNextChild ()
virtual bool focusNextPrevChild (bool next)
virtual void focusOutEvent (QFocusEvent *event)
bool focusPreviousChild ()
virtual void hideEvent (QHideEvent *event)
void initPainter (QPainter *painter) const override
virtual void inputMethodEvent (QInputMethodEvent *event)
virtual void keyPressEvent (QKeyEvent *event)
virtual void keyReleaseEvent (QKeyEvent *event)
virtual void leaveEvent (QEvent *event)
int metric (PaintDeviceMetric metric) const override
virtual void mouseDoubleClickEvent (QMouseEvent *event)
virtual void mouseMoveEvent (QMouseEvent *event)
virtual void mousePressEvent (QMouseEvent *event)
virtual void mouseReleaseEvent (QMouseEvent *event)
virtual void moveEvent (QMoveEvent *event)
virtual bool nativeEvent (const QByteArray &eventType, void *message, long *result)
virtual void showEvent (QShowEvent *event)
virtual void tabletEvent (QTabletEvent *event)
virtual void wheelEvent (QWheelEvent *event)
- Protected Methods inherited from QObject
virtual void childEvent (QChildEvent *event)
virtual void connectNotify (const QMetaMethod &signalMethod) const
virtual void customEvent (QEvent *event)
virtual void disconnectNotify (const QMetaMethod &signalMethod) const
bool isSignalConnected (const QMetaMethod &signalMethod) const
int receivers (const QString &signal) const
QObject * sender () const
int senderSignalIndex () const
virtual void timerEvent (QTimerEvent *event)
- Protected Methods inherited from QPaintDevice
 QPaintDevice ()


- Properties inherited from QFrame
- Properties inherited from QWidget
- Properties inherited from QObject


class QSplitterHandle

Additional Inherited Members

- Public Typedefs inherited from QWidget
using RenderFlags = QFlags< RenderFlag >
- Public Types inherited from QFrame
enum  Shadow
enum  Shape
enum  StyleMask
- Public Types inherited from QWidget
enum  RenderFlag
- Public Types inherited from QPaintDevice
enum  PaintDeviceMetric
- Public Slots inherited from QWidget
bool close ()
void hide ()
void lower ()
void raise ()
void repaint ()
void setDisabled (bool disable)
void setEnabled (bool enable)
void setFocus ()
void setHidden (bool hidden)
void setStyleSheet (const QString &styleSheet)
virtual void setVisible (bool visible)
void setWindowModified (bool modified)
void setWindowTitle (const QString &title)
void show ()
void showFullScreen ()
void showMaximized ()
void showMinimized ()
void showNormal ()
void update ()
- Public Slots inherited from QObject
void deleteLater ()
- Static Public Methods inherited from QWidget
static QWidget * createWindowContainer (QWindow *window, QWidget *parent=nullptr, Qt::WindowFlags flags=Qt::EmptyFlag)
static QWidget * find (WId id)
static QWidget * keyboardGrabber ()
static QWidget * mouseGrabber ()
static void setTabOrder (QWidget *firstWidget, QWidget *secondWidget)
- Static Public Methods inherited from QObject
static bool connect (const QObject *sender, const QMetaMethod &signalMethod, const QObject *receiver, const QMetaMethod &slotMethod, Qt::ConnectionType type=Qt::AutoConnection)
static bool connect (const QObject *sender, const QString &signalMethod, const QObject *receiver, const QString &slotMethod, Qt::ConnectionType type=Qt::AutoConnection, const QString &location=QString ())
static bool connect (const QObject *sender, const QString &signalMethod, const QString &location, const QObject *receiver, const QString &slotMethod, Qt::ConnectionType type=Qt::AutoConnection)
template<class Sender , class SignalClass , class... SignalArgs, class Receiver , class SlotClass , class... SlotArgs, class SlotReturn >
static bool connect (const Sender *sender, void (SignalClass::*signalMethod)(SignalArgs...), const Receiver *receiver, SlotReturn (SlotClass::*slotMethod)(SlotArgs...), Qt::ConnectionType type=Qt::AutoConnection)
template<class Sender , class SignalClass , class... SignalArgs, class Receiver , class T >
static bool connect (const Sender *sender, void (SignalClass::*signalMethod)(SignalArgs...), const Receiver *receiver, T slotLambda, Qt::ConnectionType type=Qt::AutoConnection)
static bool disconnect (const QObject *sender, const QMetaMethod &signalMethod, const QObject *receiver, const QMetaMethod &slotMethod)
static bool disconnect (const QObject *sender, const QString &signalMethod, const QObject *receiver, const QString &slotMethod)
static bool disconnect (const QObject *sender, const QString &signalMethod, const QString &location, const QObject *receiver, const QString &slotMethod)
static bool disconnect (const QObject *sender, std::nullptr_t, const QObject *receiver, std::nullptr_t)
template<class Sender , class SignalClass , class... SignalArgs, class Receiver , class SlotClass , class... SlotArgs, class SlotReturn >
static bool disconnect (const Sender *sender, void (SignalClass::*signalMethod)(SignalArgs...), const Receiver *receiver, SlotReturn (SlotClass::*slotMethod)(SlotArgs...))
template<class Sender , class SignalClass , class... SignalArgs, class Receiver >
static bool disconnect (const Sender *sender, void (SignalClass::*signalMethod)(SignalArgs...), const Receiver *receiver, std::nullptr_t slotMethod=nullptr)
template<class Sender , class SignalClass , class... SignalArgs, class Receiver , class T >
static bool disconnect (const Sender *sender, void (SignalClass::*signalMethod)(SignalArgs...), const Receiver *receiver, T slotMethod)
static QMetaObjectstaticMetaObject ()
static QString tr (const char *text, const char *comment=nullptr, std::optional< int > numArg=std::optional< int >())
- Protected Slots inherited from QWidget
void updateMicroFocus ()

Detailed Description

The QSplitter class implements a splitter widget.

A splitter lets the user control the size of child widgets by dragging the boundary between the children. Any number of widgets may be controlled by a single splitter. The typical use of a QSplitter is to create several widgets and add them using insertWidget() or addWidget().

The following example will show a QListView, QTreeView, and QTextEdit side by side, with two splitter handles:

QSplitter *splitter = new QSplitter(parent);
QListView *listview = new QListView;
QTreeView *treeview = new QTreeView;
QTextEdit *textedit = new QTextEdit;

If a widget is already inside a QSplitter when insertWidget() or addWidget() is called, it will move to the new position. This can be used to reorder widgets in the splitter later. You can use indexOf(), widget(), and count() to get access to the widgets inside the splitter.

A default QSplitter lays out its children horizontally (side by side); you can use setOrientation(Qt::Vertical) to lay its children out vertically.

By default, all widgets can be as large or as small as the user wishes, between the minimumSizeHint() (or minimumSize()) and maximumSize() of the widgets.

QSplitter resizes its children dynamically by default. If you would rather have QSplitter resize the children only at the end of a resize operation, call setOpaqueResize(false).

The initial distribution of size between the widgets is determined by multiplying the initial size with the stretch factor. You can also use setSizes() to set the sizes of all the widgets. The function sizes() returns the sizes set by the user. Alternatively, you can save and restore the sizes of the widgets from a QByteArray using saveState() and restoreState() respectively.

When you hide() a child its space will be distributed among the other children. It will be reinstated when you show() it again.

See also
QSplitterHandle, QHBoxLayout, QVBoxLayout, QTabWidget

Constructor & Destructor Documentation

QSplitter::QSplitter ( QWidget parent = nullptr)

Constructs a horizontal splitter with the parent argument passed on to the QFrame constructor.

See also
QSplitter::QSplitter ( Qt::Orientation  orientation,
QWidget parent = nullptr 

Constructs a splitter with the given orientation and parent.

See also
QSplitter::~QSplitter ( )

Destroys the splitter. All children are deleted.

Method Documentation

void QSplitter::addWidget ( QWidget widget)

Adds the given widget to the splitter's layout after all the other items. If widget is already in the splitter, it will be moved to the new position.

See also
insertWidget(), widget(), indexOf()
void QSplitter::changeEvent ( QEvent event)

Reimplemented from QFrame::changeEvent()

void QSplitter::childEvent ( QChildEvent event)

Tells the splitter that the child widget described by event has been inserted or removed.

This method is also used to handle the situation where a widget is created with the splitter as a parent but not explicitly added with insertWidget() or addWidget(). This is for compatibility and not the recommended way of putting widgets into a splitter in new code. Please use insertWidget() or addWidget() in new code.

See also
addWidget(), insertWidget()
bool QSplitter::childrenCollapsible ( ) const

Returns the value of the property.

int QSplitter::closestLegalPosition ( int  pos,
int  index 

Returns the closest legal position to pos of the widget with index. For right-to-left languages such as Arabic and Hebrew, the layout of horizontal splitters is reversed. Positions are then measured from the right edge of the widget.

See also
int QSplitter::count ( ) const

Returns the number of widgets contained in the splitter's layout.

See also
widget(), handle()
QSplitterHandle * QSplitter::createHandle ( )

Returns a new splitter handle as a child widget of this splitter. This function can be reimplemented in subclasses to provide support for custom handles.

See also
handle(), indexOf()
bool QSplitter::event ( QEvent event)

Reimplemented from QFrame::event()

void QSplitter::getRange ( int  index,
int *  min,
int *  max 
) const

Returns the valid range of the splitter with index in min and max, if min and max are not nullptr.

QSplitterHandle * QSplitter::handle ( int  index) const

Returns a pointer to the handle which appears to the left or above the given index. The handle at index 0 is always hidden.

For right-to-left languages such as Arabic and Hebrew, the layout of horizontal splitters is reversed. The handle will be to the right of the widget at index.

See also
count(), widget(), indexOf(), createHandle(), setHandleWidth()
int QSplitter::handleWidth ( ) const

Returns the value of the property.

int QSplitter::indexOf ( QWidget widget) const

Returns the index in the splitter's layout for the specified widget or handle. Handles are numbered starting from 0. The number of handles is always equal to the number of child widgets, but the handle at position 0 is always hidden.

If the widget or handle is not found this method returns -1.

See also
count(), widget()
void QSplitter::insertWidget ( int  index,
QWidget widget 

Inserts the widget specified into the splitter's layout at the given index. If widget is already in the splitter, it will be moved to the new position. if index is invalid, then the widget will be inserted at the end.

See also
addWidget(), indexOf(), widget()
bool QSplitter::isCollapsible ( int  index) const

Returns true if the widget at index is collapsible, otherwise returns false.

QSize QSplitter::minimumSizeHint ( ) const

Reimplemented from QWidget::minimumSizeHint()

void QSplitter::moveSplitter ( int  pos,
int  index 

Moves the left or top edge of the splitter handle at index as close as possible to position pos, which is the distance from the left or top edge of the widget.

For right-to-left languages such as Arabic and Hebrew, the layout of horizontal splitters is reversed. The value for pos is then the distance from the right edge of the widget.

See also
splitterMoved(), closestLegalPosition(), getRange()
bool QSplitter::opaqueResize ( ) const

Returns the value of the property.

Qt::Orientation QSplitter::orientation ( ) const

Returns the value of the property.

void QSplitter::refresh ( )

Updates the splitter's state. Calling this method is not typically required.

void QSplitter::resizeEvent ( QResizeEvent event)

Reimplemented from QWidget::resizeEvent()

bool QSplitter::restoreState ( const QByteArray state)

Restores the splitter's layout to the state specified. Returns true if the state is restored, otherwise returns false. Typically this is used in conjunction with QSettings to restore the size from a past session.

The following example restores the splitter's state. Railure to restore the splitter's layout may result from either invalid or out-of-date data in the supplied byte array.

QSettings settings;
See also
QByteArray QSplitter::saveState ( ) const

Saves the state of the splitter's layout. Typically this is used in conjunction with QSettings to remember the size for a future session. A version number is stored as part of the data.

QSettings settings;
settings.setValue("splitterSizes", splitter->saveState());
See also
void QSplitter::setChildrenCollapsible ( bool  value)

Sets the value of the property to value.

void QSplitter::setCollapsible ( int  index,
bool  collapse 

If collapse is true, then the child widget at index is set to collapsible. Otherwise, set the child widget to not collapsible.

By default children are collapsible. This means the user can resize them down to size 0 even if they have a non-zero minimumSize() or minimumSizeHint(). This behavior can be changed on a per-widget basis by calling this method or for all the widgets in the splitter by setting the childrenCollapsible property.

See also
isCollapsible(), childrenCollapsible
void QSplitter::setHandleWidth ( int  width)

Sets the value of the property to width.

void QSplitter::setOpaqueResize ( bool  opaque = true)

Sets the value of the property to opaque.

void QSplitter::setOrientation ( Qt::Orientation  value)

Sets the value of the property to value.

void QSplitter::setRubberBand ( int  pos)

Displays a rubber band at position pos. If pos is negative, the rubber band is removed.

void QSplitter::setSizes ( const QList< int > &  list)

Sets the child widgets respective sizes to the values given in the list. If the splitter is horizontal, the values set the widths of each widget in pixels, from left to right. If the splitter is vertical, the heights of each widget is set, from top to bottom.

Extra values in the list will be ignored. If the list does not contain enough values, the result may be unpredictable but the QSplitter will remain in a valid state.

The overall size of the splitter widget is not affected. Instead, any additional/missing space is distributed among the widgets according to the relative weight of the sizes. If you specify a size of 0, the widget will be invisible. The size policies of the widgets are preserved. That is, a value smaller then the minimal size hint of the respective widget will be replaced by the value of the hint.

See also
void QSplitter::setStretchFactor ( int  index,
int  stretch 

Updates the size policy of the widget at position index to have a stretch factor of stretch. The stretch is not the effective stretch factor. The effective stretch factor is calculated by taking the initial size of the widget and multiplying it with stretch.

This method is equivalent to the following example.

QWidget *widget = splitter->widget(index);
See also
setSizes(), widget()
QSize QSplitter::sizeHint ( ) const

Reimplemented from QFrame::sizeHint()

QList< int > QSplitter::sizes ( ) const

Returns a list of the sizes of all the widgets in this splitter. If the splitter's orientation is horizontal, the list contains the widgets width in pixels from left to right. If the orientation is vertical the list contains the widgets height in pixels from top to bottom. Invisible widgets have a size of 0.

Passing this list to the setSizes() method on a different QSplitter object will produce a splitter with the same layout as this one.

See also
void QSplitter::splitterMoved ( int  pos,
int  index 

This signal is emitted when the splitter handle at a particular index has been moved to position pos. For right-to-left languages such as Arabic and Hebrew, the layout of horizontal splitters is reversed. The value for pos is then the distance from the right edge of the widget.

See also
QWidget * QSplitter::widget ( int  index) const

Returns the widget at the given index in the splitter's layout.

See also
count(), handle(), indexOf(), insertWidget()

Property Documentation


This property holds whether child widgets can be resized down to size 0 by the user. By default, children are collapsible. It is possible to enable and disable the collapsing of individual children using setCollapsible().

See also
PropertiesClass Methods
read childrenCollapsible
write setChildrenCollapsible

This property holds the width of the splitter handles. If you set handleWidth to 1, the actual grab area will grow to overlap a few pixels of its respective widgets. By default, this property contains a value that depends on the user's platform and style preferences.

PropertiesClass Methods
read handleWidth
write setHandleWidth

This property holds whether resizing is opaque. Opaque resizing is on by default.

PropertiesClass Methods
read opaqueResize
write setOpaqueResize

This property holds the orientation of the splitter. By default the orientation is horizontal (i.e., the widgets are laid out side by side). The possible orientations are Qt::Horizontal and Qt::Vertical.

See also
PropertiesClass Methods
read orientation
write setOrientation