NDEVR
API Documentation
SectionWidget

SectionWidget manages multiple instances of SectionContent. More...

Public Member Functions

 SectionWidget (ContainerWidgetBase *parent, RibbonArea ribbon_area)
 Constructs a SectionWidget within the given container and ribbon area.
uint04 activeIndex () const
 Returns the index of the currently active (visible) content.
void addContent (SectionContent *c)
 Adds section content to this widget without animation.
void addContent (SectionContent *data, bool animate)
 Adds section content to this widget with optional animation.
ContainerWidgetBasecontainerWidget () const
 Returns the container widget that owns this section widget.
uint04 contentCount () const
 Returns the number of section contents managed by this widget.
const Buffer< SectionContent * > & contents () const
 Returns the buffer of all section contents managed by this widget.
uint04 currentIndex () const
 Returns the index of the currently selected content.
void finishAnimation ()
 Immediately finishes any in-progress collapse or expand animation.
bool hasVisibleTab () const
 Returns whether at least one tab is currently visible.
void hideCurrentSection ()
 Hides the currently displayed section content.
uint04 indexOf (SectionContent *c)
 Returns the index of the given section content.
uint04 indexOfContent (SectionContent *c) const
 Returns the index of the given section content within this widget.
uint04 indexOfContentByTitlePos (const QPoint &pos, QWidget *exclude=nullptr) const
 Finds the index of section content whose tab title is at the given position.
uint04 indexOfContentByUid (UUID uid) const
 Finds the index of section content by its UUID.
void insertContent (uint04 index, SectionContent *data, bool animate)
 Inserts section content at the specified index with optional animation.
bool isLayoutVertical () const
 Returns whether the content layout direction is vertical.
bool isRibbonHorizontal () const
 Returns whether the ribbon area is oriented horizontally (top or bottom).
bool isRibbonLayoutHorizontal () const
 Returns whether the ribbon layout direction is horizontal.
bool minimizeAllowed ()
 Returns whether the section widget can be minimized (collapsed).
QSize minimumSizeHint () const override
 Returns the minimum recommended size for this section widget.
void moveContent (uint04 from, uint04 to)
 Moves content from one index to another.
RibbonArea ribbonArea () const
 Returns the ribbon area where this section widget is docked.
void ribbonLocationChangedSignal (RibbonArea area)
 Emitted when the ribbon docking location changes.
void setAnimationProgress (double width)
 Sets the animation progress for the collapse or expand animation.
void setCurrentIndex (uint04 index, bool animate)
 Sets the currently displayed content by index with optional animation.
void setMinimizeAllowed (bool allowed)
 Sets whether the section widget can be minimized (collapsed).
void setRibbonArea (RibbonArea area)
 Sets the ribbon area where this section widget is docked.
void setTabLock (bool tab_lock)
 Locks or unlocks tab dragging and reordering.
void setTabVisible (bool visible)
 Sets whether the tab bar is visible.
void setupAsBoxWidget (bool is_box_widget)
 Configures this section widget to behave as a box widget with simplified layout.
bool showTabs () const
 Returns whether the tab bar is currently shown.
QSize sizeHint () const override
 Returns the recommended size for this section widget.
void swapIndices (uint04 from, uint04 to)
 Swaps the content at two indices.
void tabChangedSignal (uint04 idx)
 Emitted when the active tab index changes.
SectionWidgetTabsScrollAreatabScrollArea ()
 Returns the scroll area widget that contains the tab bar.
bool takeContent (SectionContent *data)
 Removes and releases the given section content.
bool takeContent (uint04 index)
 Removes and releases section content at the given index.
QRect titleAreaGeometry () const
 Returns the geometry of the tab title area.
UUID uid () const
 Returns the unique identifier for this section widget.
void updateLayout (QBoxLayout *layout)
 Updates the internal layout using the provided box layout.
void updateTabs ()
 Updates the tab bar display to reflect the current content state.
void userChangedCurrentTabSignal (uint04 idx)
 Emitted when the user explicitly changes the active tab.

Protected Member Functions

bool event (QEvent *event) override
 Processes generic events such as style and layout changes.
void resizeEvent (QResizeEvent *event) override
 Handles resize events to update tab and content layout.
virtual void showEvent (QShowEvent *) override
 Handles the show event to initialize rendering state.
void updateLayout ()
 Updates the internal layout based on the current ribbon area and content.

Detailed Description

SectionWidget manages multiple instances of SectionContent.


It displays a title TAB, which is clickable and will switch to the contents associated to the title when clicked.

Definition at line 56 of file SectionWidget.h.

Constructor & Destructor Documentation

◆ SectionWidget()

SectionWidget::SectionWidget ( ContainerWidgetBase * parent,
RibbonArea ribbon_area )
explicit

Constructs a SectionWidget within the given container and ribbon area.

Parameters
[in]parentThe parent container widget.
[in]ribbon_areaThe ribbon area where this section widget is docked.

References SectionWidget().

Referenced by SectionWidget().

Member Function Documentation

◆ activeIndex()

uint04 SectionWidget::activeIndex ( ) const

Returns the index of the currently active (visible) content.

Returns
The active content index.

◆ addContent() [1/2]

void SectionWidget::addContent ( SectionContent * c)

Adds section content to this widget without animation.

Parameters
[in]cThe section content to add.

◆ addContent() [2/2]

void SectionWidget::addContent ( SectionContent * data,
bool animate )

Adds section content to this widget with optional animation.

Parameters
[in]dataThe section content to add.
[in]animateWhether to animate the addition.

◆ containerWidget()

ContainerWidgetBase * SectionWidget::containerWidget ( ) const

Returns the container widget that owns this section widget.

Returns
A pointer to the parent container widget.

◆ contentCount()

uint04 SectionWidget::contentCount ( ) const

Returns the number of section contents managed by this widget.

Returns
The content count.

◆ contents()

const Buffer< SectionContent * > & SectionWidget::contents ( ) const
inline

Returns the buffer of all section contents managed by this widget.

Returns
A const reference to the buffer of SectionContent pointers.

Definition at line 92 of file SectionWidget.h.

◆ currentIndex()

uint04 SectionWidget::currentIndex ( ) const

Returns the index of the currently selected content.

Returns
The current content index.

◆ event()

bool SectionWidget::event ( QEvent * event)
overrideprotected

Processes generic events such as style and layout changes.

Parameters
[in]eventThe event to process.
Returns
True if the event was handled.

References event().

Referenced by event(), and resizeEvent().

◆ hasVisibleTab()

bool SectionWidget::hasVisibleTab ( ) const

Returns whether at least one tab is currently visible.

Returns
True if any tab is visible.

◆ indexOf()

uint04 SectionWidget::indexOf ( SectionContent * c)

Returns the index of the given section content.

Parameters
[in]cThe section content to find.
Returns
The index of the content.

◆ indexOfContent()

uint04 SectionWidget::indexOfContent ( SectionContent * c) const

Returns the index of the given section content within this widget.

Parameters
[in]cThe section content to find.
Returns
The index of the content, or Constant<uint04>::Invalid if not found.

◆ indexOfContentByTitlePos()

uint04 SectionWidget::indexOfContentByTitlePos ( const QPoint & pos,
QWidget * exclude = nullptr ) const

Finds the index of section content whose tab title is at the given position.

Parameters
[in]posThe position to test in global coordinates.
[in]excludeAn optional widget to exclude from the search.
Returns
The index of the matching content.

◆ indexOfContentByUid()

uint04 SectionWidget::indexOfContentByUid ( UUID uid) const

Finds the index of section content by its UUID.

Parameters
[in]uidThe UUID to search for.
Returns
The index of the matching content, or Constant<uint04>::Invalid if not found.

References uid().

◆ insertContent()

void SectionWidget::insertContent ( uint04 index,
SectionContent * data,
bool animate )

Inserts section content at the specified index with optional animation.

Parameters
[in]indexThe position to insert at.
[in]dataThe section content to insert.
[in]animateWhether to animate the insertion.

◆ isLayoutVertical()

bool SectionWidget::isLayoutVertical ( ) const

Returns whether the content layout direction is vertical.

Returns
True if the layout is vertical.

◆ isRibbonHorizontal()

bool SectionWidget::isRibbonHorizontal ( ) const

Returns whether the ribbon area is oriented horizontally (top or bottom).

Returns
True if the ribbon is horizontal.

◆ isRibbonLayoutHorizontal()

bool SectionWidget::isRibbonLayoutHorizontal ( ) const

Returns whether the ribbon layout direction is horizontal.

Returns
True if the ribbon layout is horizontal.

◆ minimizeAllowed()

bool SectionWidget::minimizeAllowed ( )

Returns whether the section widget can be minimized (collapsed).

Returns
True if minimization is allowed.

◆ minimumSizeHint()

QSize SectionWidget::minimumSizeHint ( ) const
override

Returns the minimum recommended size for this section widget.

Returns
The minimum size hint.

◆ moveContent()

void SectionWidget::moveContent ( uint04 from,
uint04 to )

Moves content from one index to another.

Parameters
[in]fromThe source index.
[in]toThe destination index.

◆ resizeEvent()

void SectionWidget::resizeEvent ( QResizeEvent * event)
overrideprotected

Handles resize events to update tab and content layout.

Parameters
[in]eventThe resize event.

References event().

◆ ribbonArea()

RibbonArea SectionWidget::ribbonArea ( ) const
inline

Returns the ribbon area where this section widget is docked.

Returns
The current RibbonArea.

Definition at line 82 of file SectionWidget.h.

◆ ribbonLocationChangedSignal()

void SectionWidget::ribbonLocationChangedSignal ( RibbonArea area)

Emitted when the ribbon docking location changes.

Parameters
[in]areaThe new ribbon area.

◆ setAnimationProgress()

void SectionWidget::setAnimationProgress ( double width)

Sets the animation progress for the collapse or expand animation.

Parameters
[in]widthThe current animation progress value.

◆ setCurrentIndex()

void SectionWidget::setCurrentIndex ( uint04 index,
bool animate )

Sets the currently displayed content by index with optional animation.

Parameters
[in]indexThe index to switch to.
[in]animateWhether to animate the transition.

◆ setMinimizeAllowed()

void SectionWidget::setMinimizeAllowed ( bool allowed)

Sets whether the section widget can be minimized (collapsed).

Parameters
[in]allowedTrue to allow minimization.

◆ setRibbonArea()

void SectionWidget::setRibbonArea ( RibbonArea area)

Sets the ribbon area where this section widget is docked.

Parameters
[in]areaThe new ribbon area.

◆ setTabLock()

void SectionWidget::setTabLock ( bool tab_lock)

Locks or unlocks tab dragging and reordering.

Parameters
[in]tab_lockTrue to lock tabs in place.

◆ setTabVisible()

void SectionWidget::setTabVisible ( bool visible)

Sets whether the tab bar is visible.

Parameters
[in]visibleTrue to show the tab bar.

◆ setupAsBoxWidget()

void SectionWidget::setupAsBoxWidget ( bool is_box_widget)

Configures this section widget to behave as a box widget with simplified layout.

Parameters
[in]is_box_widgetTrue to enable box widget mode.

◆ showTabs()

bool SectionWidget::showTabs ( ) const
inline

Returns whether the tab bar is currently shown.

Returns
True if tabs are visible.

Definition at line 216 of file SectionWidget.h.

◆ sizeHint()

QSize SectionWidget::sizeHint ( ) const
override

Returns the recommended size for this section widget.

Returns
The size hint.

◆ swapIndices()

void SectionWidget::swapIndices ( uint04 from,
uint04 to )

Swaps the content at two indices.

Parameters
[in]fromThe first index.
[in]toThe second index.

◆ tabChangedSignal()

void SectionWidget::tabChangedSignal ( uint04 idx)

Emitted when the active tab index changes.

Parameters
[in]idxThe new tab index.

◆ tabScrollArea()

SectionWidgetTabsScrollArea * SectionWidget::tabScrollArea ( )
inline

Returns the scroll area widget that contains the tab bar.

Returns
A pointer to the tab scroll area.

Definition at line 211 of file SectionWidget.h.

◆ takeContent() [1/2]

bool SectionWidget::takeContent ( SectionContent * data)

Removes and releases the given section content.

Parameters
[in]dataThe section content to remove.
Returns
True if the content was successfully removed.

◆ takeContent() [2/2]

bool SectionWidget::takeContent ( uint04 index)

Removes and releases section content at the given index.

Parameters
[in]indexThe index of the content to remove.
Returns
True if the content was successfully removed.

◆ titleAreaGeometry()

QRect SectionWidget::titleAreaGeometry ( ) const

Returns the geometry of the tab title area.

Returns
The bounding rectangle of the title area.

◆ uid()

UUID SectionWidget::uid ( ) const

Returns the unique identifier for this section widget.

Returns
The UUID of this section widget.

Referenced by indexOfContentByUid().

◆ updateLayout()

void SectionWidget::updateLayout ( QBoxLayout * layout)

Updates the internal layout using the provided box layout.

Parameters
[in]layoutThe box layout to apply.

◆ userChangedCurrentTabSignal()

void SectionWidget::userChangedCurrentTabSignal ( uint04 idx)

Emitted when the user explicitly changes the active tab.

Parameters
[in]idxThe new tab index.

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