NDEVR
API Documentation
QCustomSplitter

A splitter lets the user control the size of 2 child widgets by dragging the boundary between them. More...

Public Member Functions

 QCustomSplitter (Qt::Orientation orientation, QWidget *parent=nullptr)
 Constructs a splitter with the specified orientation.
 QCustomSplitter (QWidget *parent=nullptr)
 Constructs a splitter with default orientation.
int availableSize () const
 Returns the available space for child widgets, excluding splitter handle widths.
void childEvent (QChildEvent *c) override
 Handles child widget add and remove events, temporarily hiding and re-showing the splitter on removal to avoid layout artifacts.
bool event (QEvent *e) override
 Handles events, optionally blocking them during visibility toggling to prevent recursive layout issues.
bool eventFilter (QObject *object, QEvent *event) override
 Filters events for child widgets, refreshing sizes on layout requests.
QSize minimumSizeHint () const override
 Returns a minimal size hint to allow the splitter to be as small as possible.
void refreshSizes ()
 Recalculates and applies proportional sizes for all child widgets based on their size hints and the available space.
void refreshSizes (int offset)
 Recalculates and applies proportional sizes for all child widgets with an additional offset applied to each widget size.
void setAnimating (bool animating)
 Sets whether the splitter is currently in an animation state.
sint04 sizeIfAdded (sint04 preferred_size, sint04 min_size, sint04 current_size) const
 Calculates the size a widget would be given if added to the splitter, accounting for proportional scaling of all children.
fltp08 sizeMultiple ()
 Calculates the ratio of the total preferred size of all child widgets to the available splitter space.

Public Attributes

bool m_block_events = false
 Whether to block events during visibility toggling.
bool m_is_animating = false
 Whether the splitter is currently in an animation state.

Detailed Description

A splitter lets the user control the size of 2 child widgets by dragging the boundary between them.


Definition at line 44 of file QCustomSplitter.h.

Constructor & Destructor Documentation

◆ QCustomSplitter() [1/2]

QCustomSplitter::QCustomSplitter ( QWidget * parent = nullptr)
inlineexplicit

Constructs a splitter with default orientation.

Parameters
[in]parentThe parent widget, or nullptr for no parent.

Definition at line 52 of file QCustomSplitter.h.

References m_is_animating.

◆ QCustomSplitter() [2/2]

QCustomSplitter::QCustomSplitter ( Qt::Orientation orientation,
QWidget * parent = nullptr )
inlineexplicit

Constructs a splitter with the specified orientation.

Parameters
[in]orientationThe orientation of the splitter (horizontal or vertical).
[in]parentThe parent widget, or nullptr for no parent.

Definition at line 61 of file QCustomSplitter.h.

References m_is_animating.

Member Function Documentation

◆ availableSize()

int QCustomSplitter::availableSize ( ) const
inline

Returns the available space for child widgets, excluding splitter handle widths.

Returns
The available size in pixels along the splitter orientation.

Definition at line 102 of file QCustomSplitter.h.

Referenced by refreshSizes(), sizeIfAdded(), and sizeMultiple().

◆ childEvent()

void QCustomSplitter::childEvent ( QChildEvent * c)
inlineoverride

Handles child widget add and remove events, temporarily hiding and re-showing the splitter on removal to avoid layout artifacts.

Parameters
[in]cThe child event to process.

Definition at line 255 of file QCustomSplitter.h.

References m_block_events.

◆ event()

bool QCustomSplitter::event ( QEvent * e)
inlineoverride

Handles events, optionally blocking them during visibility toggling to prevent recursive layout issues.

Parameters
[in]eThe event to handle.
Returns
True if the event was handled, false otherwise.

Definition at line 243 of file QCustomSplitter.h.

References m_block_events.

Referenced by eventFilter().

◆ eventFilter()

bool QCustomSplitter::eventFilter ( QObject * object,
QEvent * event )
inlineoverride

Filters events for child widgets, refreshing sizes on layout requests.

Parameters
[in]objectThe object that generated the event.
[in]eventThe event to filter.
Returns
True if the event was handled, false otherwise.

Definition at line 157 of file QCustomSplitter.h.

References event(), and refreshSizes().

◆ minimumSizeHint()

QSize QCustomSplitter::minimumSizeHint ( ) const
inlineoverride

Returns a minimal size hint to allow the splitter to be as small as possible.

Returns
A QSize of (1, 1).

Definition at line 147 of file QCustomSplitter.h.

◆ refreshSizes()

void QCustomSplitter::refreshSizes ( int offset)
inline

Recalculates and applies proportional sizes for all child widgets with an additional offset applied to each widget size.

Parameters
[in]offsetThe pixel offset to add to each child widget size.

Definition at line 210 of file QCustomSplitter.h.

References availableSize(), cast(), and getMax().

◆ setAnimating()

void QCustomSplitter::setAnimating ( bool animating)
inline

Sets whether the splitter is currently in an animation state.

When animation ends, sizes are refreshed automatically.

Parameters
[in]animatingTrue if the splitter is animating, false otherwise.

Definition at line 73 of file QCustomSplitter.h.

References m_is_animating, and refreshSizes().

◆ sizeIfAdded()

sint04 QCustomSplitter::sizeIfAdded ( sint04 preferred_size,
sint04 min_size,
sint04 current_size ) const
inline

Calculates the size a widget would be given if added to the splitter, accounting for proportional scaling of all children.

Parameters
[in]preferred_sizeThe preferred size of the widget to add.
[in]min_sizeThe minimum acceptable size of the widget.
[in]current_sizeThe current size of the widget being replaced or resized.
Returns
The calculated size in pixels the widget would receive.

Definition at line 116 of file QCustomSplitter.h.

References availableSize(), cast(), and getMax().

◆ sizeMultiple()

fltp08 QCustomSplitter::sizeMultiple ( )
inline

Calculates the ratio of the total preferred size of all child widgets to the available splitter space.

Returns
The size multiple ratio. Returns 1.0 if no space or children are available.

Definition at line 86 of file QCustomSplitter.h.

References availableSize(), and cast().


The documentation for this class was generated from the following file: