NDEVR
API Documentation
QCustomStackedWidgetBase

A base class for a series of widgets where all widgets occupy the same same and only one widget is shown at a time. More...

Inheritance diagram for QCustomStackedWidgetBase:
[legend]
Collaboration diagram for QCustomStackedWidgetBase:
[legend]

Public Types

enum  StackAnimationDirection {
  e_left_to_right , e_right_to_left , e_top_to_bottom , e_bottom_to_top ,
  e_automatic
}
 Defines the direction of slide animations between stacked pages. More...

Public Member Functions

void animationFinished ()
 Signal emitted when a slide animation completes.
QSize minimumSizeHint () const override
 Returns the minimum recommended size for the stacked widget.
void setAnimation (enum QEasingCurve::Type animationtype)
 Sets the easing curve type used for slide animations.
virtual void setCurrentIdx (uint04 current_index)
 Sets the current visible page index without animation.
void setCustomPixmap (QPixmap *pixmap)
 Sets a custom pixmap to render during slide transitions instead of widget captures.
void setSpeed (int speed)
 Sets the animation duration in milliseconds for slide transitions.
void setVerticalMode (bool vertical=true)
 Enables or disables vertical slide animation mode.
void setWrap (bool wrap)
 Sets whether page navigation wraps around from last to first and vice versa.
QSize sizeHint () const override
 Returns the recommended size for the stacked widget.

Static Public Attributes

static ApplicationOption< sint04default_stack_animation_speed
 Default time in milliseconds to animate a slide transition.

Protected Member Functions

 QCustomStackedWidgetBase (QWidget *parent=nullptr)
 Constructs the stacked widget base.
uint04 activeIndex () const
 Returns the index of the currently active (or animating-to) widget.
QWidget * activeWidget () const
 Returns the currently active (or animating-to) widget.
virtual uint04 addWidget (QWidget *w)
 Adds a widget as a new page in the stacked widget.
void animationDoneSlot ()
 Slot called when the slide animation completes to finalize the transition.
double animationPercent () const
 Returns the current animation interpolation percent.
void childDestroyedSlot (QObject *widget)
 Slot called when a child widget is destroyed, to remove it from the page list.
uint04 count () const
 Returns the number of pages in the stacked widget.
uint04 currentIndex () const
 Returns the index of the currently displayed page.
QWidget * currentWidget () const
 Returns the currently displayed widget.
bool eventFilter (QObject *object, QEvent *event) override
 Filters events for child widgets to handle layout and visibility changes.
uint04 indexOf (QWidget *widget) const
 Returns the index of the given widget in the stacked widget.
void insertWidget (uint04 index, QWidget *w)
 Inserts a widget at a specific index in the stacked widget.
virtual void moveContent (uint04 from, uint04 to)
 Moves a child widget from one index to another.
void paintEvent (QPaintEvent *) override
 Custom paint event that renders slide transition animations.
void removeWidget (QWidget *widget)
 Removes a widget from the stacked widget.
void removeWidget (QWidget *widget, QWidget *slide_to_if_active)
 Removes a widget and slides to a replacement widget if it was the active page.
void resizeEvent (QResizeEvent *event) override
 Handles resize events to update child widget geometries.
void setAnimationPercent (double animation_percent)
 Sets the current animation interpolation percent for the Q_PROPERTY system.
void showEvent (QShowEvent *event) override
 Handles show events to ensure proper layout of the active widget.
virtual void slideInAnimation (enum StackAnimationDirection direction=e_automatic, bool cache_in_image=false)
 Executes the slide animation between the current and next pages.
virtual void slideInAnimation (PopupInfo origin_rect, enum StackAnimationDirection direction=e_automatic, bool cache_in_image=false)
 Executes the slide animation using popup origin information.
virtual void slideInIdx (uint04 idx, enum StackAnimationDirection direction)
 Slides to the page at the given index with the specified direction.
virtual void slideInIdx (uint04 idx, int delay_time=0, enum StackAnimationDirection direction=e_automatic)
 Slides to the page at the given index with animation.
virtual void slideInIdx (uint04 idx, PopupInfo origin_rect, int delay_time=0, enum StackAnimationDirection direction=e_automatic)
 Slides to the page at the given index with animation and popup origin info.
virtual void slideInNext ()
 Slides to the next page with animation.
virtual void slideInPrev ()
 Slides to the previous page with animation.
virtual void slideInWgt (QWidget *widget, enum StackAnimationDirection direction=e_automatic, bool force_slide=false)
 Slides to a specific widget with animation.
virtual void swapIndices (uint04 a, uint04 b)
 Swaps two child widgets at the given indices.
QWidget * widget (uint04 index) const
 Returns the widget at the given index.

Protected Attributes

double m_animation_percent
 The current animation interpolation percent (0.0 to 1.0).
enum QEasingCurve::Type m_animationtype
 The easing curve type for slide animations.
Buffer< QWidget * > m_child_widgets
 The list of child page widgets.
uint04 m_current_index
 The index of the currently displayed page.
bool m_is_animating
 Whether a slide animation is currently in progress.
uint04 m_last
 The index of the previously displayed page.
int m_last_animation_time
 The duration of the last animation in milliseconds.
QPointer< QPropertyAnimation > m_move_animation
 The property animation driving slide transitions.
uint04 m_next
 The index of the page being animated to.
uint04 m_now
 The index of the currently displayed page during animation.
QPoint m_offset
 The pixel offset used during slide animation rendering.
PopupInfo m_popup_info
 The popup info used for animation origin calculations.
int m_speed
 The animation duration in milliseconds.
bool m_vertical
 Whether slide animations are in vertical mode.
bool m_wrap = false
 Whether page navigation wraps around at boundaries.

Detailed Description

A base class for a series of widgets where all widgets occupy the same same and only one widget is shown at a time.


Definition at line 50 of file QCustomStackedWidget.h.

Member Enumeration Documentation

◆ StackAnimationDirection

Defines the direction of slide animations between stacked pages.

Enumerator
e_left_to_right 

Slide from left to right.

e_right_to_left 

Slide from right to left.

e_top_to_bottom 

Slide from top to bottom.

e_bottom_to_top 

Slide from bottom to top.

e_automatic 

Automatically determine direction based on index order.

Definition at line 58 of file QCustomStackedWidget.h.

Constructor & Destructor Documentation

◆ QCustomStackedWidgetBase()

QCustomStackedWidgetBase::QCustomStackedWidgetBase ( QWidget * parent = nullptr)
explicitprotected

Constructs the stacked widget base.

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

References QCustomStackedWidgetBase().

Referenced by QCustomStackedWidget::QCustomStackedWidget(), and QCustomStackedWidgetBase().

Member Function Documentation

◆ activeIndex()

uint04 QCustomStackedWidgetBase::activeIndex ( ) const
protected

Returns the index of the currently active (or animating-to) widget.

Returns
The active widget index.

Referenced by QCustomStackedWidget::activeIndex().

◆ activeWidget()

QWidget * QCustomStackedWidgetBase::activeWidget ( ) const
protected

Returns the currently active (or animating-to) widget.

Returns
A pointer to the active widget, or nullptr.

Referenced by QCustomStackedWidget::activeWidget().

◆ addWidget()

virtual uint04 QCustomStackedWidgetBase::addWidget ( QWidget * w)
protectedvirtual

Adds a widget as a new page in the stacked widget.

Parameters
[in]wThe widget to add.
Returns
The index of the newly added widget.

Reimplemented in QCustomStackedWidget, QCustomTabWidget, and QCustomToolBox.

Referenced by QCustomStackedWidget::addWidget().

◆ animationPercent()

double QCustomStackedWidgetBase::animationPercent ( ) const
inlineprotected

Returns the current animation interpolation percent.

Returns
The animation percent from 0.0 to 1.0.

Definition at line 132 of file QCustomStackedWidget.h.

References m_animation_percent.

◆ childDestroyedSlot()

void QCustomStackedWidgetBase::childDestroyedSlot ( QObject * widget)
protected

Slot called when a child widget is destroyed, to remove it from the page list.

Parameters
[in]widgetThe destroyed widget object.

References widget().

◆ count()

uint04 QCustomStackedWidgetBase::count ( ) const
protected

Returns the number of pages in the stacked widget.

Returns
The page count.

Referenced by QCustomStackedWidget::count().

◆ currentIndex()

uint04 QCustomStackedWidgetBase::currentIndex ( ) const
inlineprotected

Returns the index of the currently displayed page.

Returns
The current page index.

Definition at line 211 of file QCustomStackedWidget.h.

References m_current_index.

◆ currentWidget()

QWidget * QCustomStackedWidgetBase::currentWidget ( ) const
protected

Returns the currently displayed widget.

Returns
A pointer to the current widget, or nullptr.

Referenced by QCustomStackedWidget::currentWidget().

◆ eventFilter()

bool QCustomStackedWidgetBase::eventFilter ( QObject * object,
QEvent * event )
overrideprotected

Filters events for child widgets to handle layout and visibility changes.

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

◆ indexOf()

uint04 QCustomStackedWidgetBase::indexOf ( QWidget * widget) const
protected

Returns the index of the given widget in the stacked widget.

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

References widget().

Referenced by QCustomStackedWidget::hasWidget(), and QCustomStackedWidget::indexOf().

◆ insertWidget()

void QCustomStackedWidgetBase::insertWidget ( uint04 index,
QWidget * w )
protected

Inserts a widget at a specific index in the stacked widget.

Parameters
[in]indexThe position at which to insert the widget.
[in]wThe widget to insert.

Referenced by QCustomStackedWidget::insertWidget().

◆ minimumSizeHint()

QSize QCustomStackedWidgetBase::minimumSizeHint ( ) const
override

Returns the minimum recommended size for the stacked widget.

Returns
The minimum QSize for layout calculations.

◆ moveContent()

virtual void QCustomStackedWidgetBase::moveContent ( uint04 from,
uint04 to )
protectedvirtual

Moves a child widget from one index to another.

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

Reimplemented in QCustomStackedWidget.

Referenced by QCustomStackedWidget::moveContent().

◆ paintEvent()

void QCustomStackedWidgetBase::paintEvent ( QPaintEvent * )
overrideprotected

Custom paint event that renders slide transition animations.

Parameters
[in]eventThe paint event.

◆ removeWidget() [1/2]

void QCustomStackedWidgetBase::removeWidget ( QWidget * widget)
protected

Removes a widget from the stacked widget.

Parameters
[in]widgetThe widget to remove.

References widget().

Referenced by QCustomStackedWidget::removeWidget(), and QCustomStackedWidget::removeWidget().

◆ removeWidget() [2/2]

void QCustomStackedWidgetBase::removeWidget ( QWidget * widget,
QWidget * slide_to_if_active )
protected

Removes a widget and slides to a replacement widget if it was the active page.

Parameters
[in]widgetThe widget to remove.
[in]slide_to_if_activeThe widget to slide to if the removed widget was active.

References widget().

◆ resizeEvent()

void QCustomStackedWidgetBase::resizeEvent ( QResizeEvent * event)
overrideprotected

Handles resize events to update child widget geometries.

Parameters
[in]eventThe resize event.

◆ setAnimation()

void QCustomStackedWidgetBase::setAnimation ( enum QEasingCurve::Type animationtype)

Sets the easing curve type used for slide animations.

Parameters
[in]animationtypeThe QEasingCurve type to use.

◆ setAnimationPercent()

void QCustomStackedWidgetBase::setAnimationPercent ( double animation_percent)
protected

Sets the current animation interpolation percent for the Q_PROPERTY system.

Parameters
[in]animation_percentThe animation percent from 0.0 to 1.0.

◆ setCurrentIdx()

virtual void QCustomStackedWidgetBase::setCurrentIdx ( uint04 current_index)
virtual

Sets the current visible page index without animation.

Parameters
[in]current_indexThe index of the page to display.

Referenced by QCustomStackedWidget::setCurrentIndex().

◆ setCustomPixmap()

void QCustomStackedWidgetBase::setCustomPixmap ( QPixmap * pixmap)

Sets a custom pixmap to render during slide transitions instead of widget captures.

Parameters
[in]pixmapThe custom pixmap to use, or nullptr to use default rendering.

◆ setSpeed()

void QCustomStackedWidgetBase::setSpeed ( int speed)

Sets the animation duration in milliseconds for slide transitions.

Parameters
[in]speedThe animation duration in milliseconds.

◆ setVerticalMode()

void QCustomStackedWidgetBase::setVerticalMode ( bool vertical = true)

Enables or disables vertical slide animation mode.

Parameters
[in]verticalTrue for vertical animations, false for horizontal.

◆ setWrap()

void QCustomStackedWidgetBase::setWrap ( bool wrap)

Sets whether page navigation wraps around from last to first and vice versa.

Parameters
[in]wrapTrue to enable wrapping, false to stop at boundaries.

References wrap().

◆ showEvent()

void QCustomStackedWidgetBase::showEvent ( QShowEvent * event)
overrideprotected

Handles show events to ensure proper layout of the active widget.

Parameters
[in]eventThe show event.

◆ sizeHint()

QSize QCustomStackedWidgetBase::sizeHint ( ) const
override

Returns the recommended size for the stacked widget.

Returns
The recommended QSize for layout calculations.

◆ slideInAnimation() [1/2]

virtual void QCustomStackedWidgetBase::slideInAnimation ( enum StackAnimationDirection direction = e_automatic,
bool cache_in_image = false )
protectedvirtual

Executes the slide animation between the current and next pages.

Parameters
[in]directionThe animation direction.
[in]cache_in_imageWhether to cache the incoming widget as an image during animation.

Reimplemented in QCustomStackedWidget.

References e_automatic.

◆ slideInAnimation() [2/2]

virtual void QCustomStackedWidgetBase::slideInAnimation ( PopupInfo origin_rect,
enum StackAnimationDirection direction = e_automatic,
bool cache_in_image = false )
protectedvirtual

Executes the slide animation using popup origin information.

Parameters
[in]origin_rectThe popup info describing the animation origin.
[in]directionThe animation direction.
[in]cache_in_imageWhether to cache the incoming widget as an image during animation.

Reimplemented in QCustomStackedWidget.

References e_automatic.

Referenced by QCustomStackedWidget::slideInAnimation(), and QCustomStackedWidget::slideInAnimation().

◆ slideInIdx() [1/3]

virtual void QCustomStackedWidgetBase::slideInIdx ( uint04 idx,
enum StackAnimationDirection direction )
protectedvirtual

Slides to the page at the given index with the specified direction.

Parameters
[in]idxThe target page index.
[in]directionThe animation direction.

Reimplemented in QCustomStackedWidget, and Ribbon.

◆ slideInIdx() [2/3]

virtual void QCustomStackedWidgetBase::slideInIdx ( uint04 idx,
int delay_time = 0,
enum StackAnimationDirection direction = e_automatic )
protectedvirtual

Slides to the page at the given index with animation.

Parameters
[in]idxThe target page index.
[in]delay_timeDelay in milliseconds before starting the animation.
[in]directionThe animation direction.

Reimplemented in QCustomStackedWidget.

References e_automatic.

◆ slideInIdx() [3/3]

virtual void QCustomStackedWidgetBase::slideInIdx ( uint04 idx,
PopupInfo origin_rect,
int delay_time = 0,
enum StackAnimationDirection direction = e_automatic )
protectedvirtual

Slides to the page at the given index with animation and popup origin info.

Parameters
[in]idxThe target page index.
[in]origin_rectThe popup info describing the animation origin.
[in]delay_timeDelay in milliseconds before starting the animation.
[in]directionThe animation direction.

Reimplemented in QCustomStackedWidget.

References e_automatic.

Referenced by QCustomStackedWidget::slideInIdx(), QCustomStackedWidget::slideInIdx(), QCustomStackedWidget::slideInIdx(), and Ribbon::slideInIdx().

◆ slideInWgt()

virtual void QCustomStackedWidgetBase::slideInWgt ( QWidget * widget,
enum StackAnimationDirection direction = e_automatic,
bool force_slide = false )
protectedvirtual

Slides to a specific widget with animation.

Parameters
[in]widgetThe widget to slide to.
[in]directionThe animation direction.
[in]force_slideWhether to force the slide even if the widget is already active.

Reimplemented in QCustomStackedWidget.

References e_automatic, and widget().

Referenced by QCustomStackedWidget::slideInWgt().

◆ swapIndices()

virtual void QCustomStackedWidgetBase::swapIndices ( uint04 a,
uint04 b )
protectedvirtual

Swaps two child widgets at the given indices.

Parameters
[in]aThe index of the first widget.
[in]bThe index of the second widget.

Reimplemented in QCustomStackedWidget.

Referenced by QCustomStackedWidget::swapIndices().

◆ widget()

QWidget * QCustomStackedWidgetBase::widget ( uint04 index) const
protected

Returns the widget at the given index.

Parameters
[in]indexThe index of the widget to retrieve.
Returns
A pointer to the widget, or nullptr if the index is invalid.

Referenced by Ribbon::addBottomRightWidget(), DatasetView::addCustomDockWidget(), Ribbon::addTopLeftWidget(), childDestroyedSlot(), ContainerWidgetBase::event(), indexOf(), removeWidget(), removeWidget(), slideInWgt(), and QCustomStackedWidget::widget().


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