NDEVR
API Documentation
QCustomStackedWidget

The main class for a layout where all widgets occupy the same same and only one widget is shown at a time. More...

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

Public Member Functions

 QCustomStackedWidget (QWidget *parent=nullptr)
 Constructs a stacked widget.
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) override
 Adds a widget as a new page in the stacked widget.
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 hasWidget (QWidget *widget) const
 Checks whether the given widget is contained in the stacked widget.
uint04 indexOf (QWidget *widget) const
 Returns the index of the given widget.
void insertWidget (uint04 index, QWidget *w)
 Inserts a widget at a specific index.
void moveContent (uint04 from, uint04 to) override
 Moves a child widget from one index to another.
void removeWidget (QWidget *widget)
 Removes a widget from the stacked widget.
void removeWidget (QWidget *widget, QWidget *slide_in)
 Removes a widget and slides to a replacement widget if it was active.
void setCurrentIndex (uint04 idx)
 Sets the current visible page index without animation.
void slideInAnimation (enum StackAnimationDirection direction=e_automatic, bool cache_in_image=false) override
 Executes the slide animation between the current and next pages.
void slideInAnimation (PopupInfo origin_rect, enum StackAnimationDirection direction=e_automatic, bool cache_in_image=false) override
 Executes the slide animation using popup origin information.
void slideInIdx (uint04 idx, enum StackAnimationDirection direction) override
 Slides to the page at the given index with the specified direction.
void slideInIdx (uint04 idx, int delay_time=0, enum StackAnimationDirection direction=e_automatic) override
 Slides to the page at the given index with animation.
void slideInIdx (uint04 idx, PopupInfo origin_rect, int delay_time=0, enum StackAnimationDirection direction=e_automatic) override
 Slides to the page at the given index with animation and popup origin info.
virtual void slideInNext () override
 Slides to the next page with animation.
virtual void slideInPrev () override
 Slides to the previous page with animation.
void slideInWgt (QWidget *widget, enum StackAnimationDirection direction=e_automatic, bool force_slide=false) override
 Slides to a specific widget with animation.
void swapIndices (uint04 a, uint04 b) override
 Swaps two child widgets at the given indices.
QWidget * widget (uint04 idx) const
 Returns the widget at the given index.
Public Member Functions inherited from QCustomStackedWidgetBase
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.

Additional Inherited Members

Public Types inherited from QCustomStackedWidgetBase
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...
Static Public Attributes inherited from QCustomStackedWidgetBase
static ApplicationOption< sint04default_stack_animation_speed
 Default time in milliseconds to animate a slide transition.
Protected Member Functions inherited from QCustomStackedWidgetBase
 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.
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.
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.
QWidget * widget (uint04 index) const
 Returns the widget at the given index.
Protected Attributes inherited from QCustomStackedWidgetBase
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

The main class for a layout where all widgets occupy the same same and only one widget is shown at a time.


Definition at line 313 of file QCustomStackedWidget.h.

Constructor & Destructor Documentation

◆ QCustomStackedWidget()

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

Constructs a stacked widget.

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

Definition at line 320 of file QCustomStackedWidget.h.

References QCustomStackedWidgetBase::QCustomStackedWidgetBase().

Member Function Documentation

◆ activeIndex()

uint04 QCustomStackedWidget::activeIndex ( ) const
inline

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

Returns
The active widget index.

Definition at line 419 of file QCustomStackedWidget.h.

References QCustomStackedWidgetBase::activeIndex().

◆ activeWidget()

QWidget * QCustomStackedWidget::activeWidget ( ) const
inline

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

Returns
A pointer to the active widget, or nullptr.

Definition at line 426 of file QCustomStackedWidget.h.

References QCustomStackedWidgetBase::activeWidget().

◆ addWidget()

virtual uint04 QCustomStackedWidget::addWidget ( QWidget * w)
inlineoverridevirtual

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 from QCustomStackedWidgetBase.

Definition at line 324 of file QCustomStackedWidget.h.

References QCustomStackedWidgetBase::addWidget().

◆ count()

uint04 QCustomStackedWidget::count ( ) const
inline

Returns the number of pages in the stacked widget.

Returns
The page count.

Definition at line 433 of file QCustomStackedWidget.h.

References QCustomStackedWidgetBase::count().

◆ currentIndex()

uint04 QCustomStackedWidget::currentIndex ( ) const
inline

Returns the index of the currently displayed page.

Returns
The current page index.

Definition at line 449 of file QCustomStackedWidget.h.

References QCustomStackedWidgetBase::m_current_index.

◆ currentWidget()

QWidget * QCustomStackedWidget::currentWidget ( ) const
inline

Returns the currently displayed widget.

Returns
A pointer to the current widget, or nullptr.

Definition at line 460 of file QCustomStackedWidget.h.

References QCustomStackedWidgetBase::currentWidget().

◆ hasWidget()

bool QCustomStackedWidget::hasWidget ( QWidget * widget) const
inline

Checks whether the given widget is contained in the stacked widget.

Parameters
[in]widgetThe widget to check for.
Returns
True if the widget is found, false otherwise.

Definition at line 441 of file QCustomStackedWidget.h.

References QCustomStackedWidgetBase::indexOf(), IsValid(), and widget().

◆ indexOf()

uint04 QCustomStackedWidget::indexOf ( QWidget * widget) const
inline

Returns the index of the given widget.

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

Definition at line 455 of file QCustomStackedWidget.h.

References QCustomStackedWidgetBase::indexOf(), and widget().

◆ insertWidget()

void QCustomStackedWidget::insertWidget ( uint04 index,
QWidget * w )
inline

Inserts a widget at a specific index.

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

Definition at line 401 of file QCustomStackedWidget.h.

References QCustomStackedWidgetBase::insertWidget().

◆ moveContent()

void QCustomStackedWidget::moveContent ( uint04 from,
uint04 to )
inlineoverridevirtual

Moves a child widget from one index to another.

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

Reimplemented from QCustomStackedWidgetBase.

Definition at line 406 of file QCustomStackedWidget.h.

References QCustomStackedWidgetBase::moveContent().

◆ removeWidget() [1/2]

void QCustomStackedWidget::removeWidget ( QWidget * widget)
inline

Removes a widget from the stacked widget.

Parameters
[in]widgetThe widget to remove.

Definition at line 374 of file QCustomStackedWidget.h.

References QCustomStackedWidgetBase::removeWidget(), and widget().

◆ removeWidget() [2/2]

void QCustomStackedWidget::removeWidget ( QWidget * widget,
QWidget * slide_in )
inline

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

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

Definition at line 383 of file QCustomStackedWidget.h.

References QCustomStackedWidgetBase::removeWidget(), and widget().

◆ setCurrentIndex()

void QCustomStackedWidget::setCurrentIndex ( uint04 idx)
inline

Sets the current visible page index without animation.

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

Definition at line 341 of file QCustomStackedWidget.h.

References QCustomStackedWidgetBase::setCurrentIdx().

◆ slideInAnimation() [1/2]

void QCustomStackedWidget::slideInAnimation ( enum StackAnimationDirection direction = e_automatic,
bool cache_in_image = false )
inlineoverridevirtual

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 from QCustomStackedWidgetBase.

Definition at line 363 of file QCustomStackedWidget.h.

References QCustomStackedWidgetBase::e_automatic, and QCustomStackedWidgetBase::slideInAnimation().

◆ slideInAnimation() [2/2]

void QCustomStackedWidget::slideInAnimation ( PopupInfo origin_rect,
enum StackAnimationDirection direction = e_automatic,
bool cache_in_image = false )
inlineoverridevirtual

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 from QCustomStackedWidgetBase.

Definition at line 359 of file QCustomStackedWidget.h.

References QCustomStackedWidgetBase::e_automatic, and QCustomStackedWidgetBase::slideInAnimation().

◆ slideInIdx() [1/3]

void QCustomStackedWidget::slideInIdx ( uint04 idx,
enum StackAnimationDirection direction )
inlineoverridevirtual

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

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

Reimplemented from QCustomStackedWidgetBase.

Definition at line 355 of file QCustomStackedWidget.h.

References QCustomStackedWidgetBase::slideInIdx().

◆ slideInIdx() [2/3]

void QCustomStackedWidget::slideInIdx ( uint04 idx,
int delay_time = 0,
enum StackAnimationDirection direction = e_automatic )
inlineoverridevirtual

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 from QCustomStackedWidgetBase.

Definition at line 351 of file QCustomStackedWidget.h.

References QCustomStackedWidgetBase::e_automatic, and QCustomStackedWidgetBase::slideInIdx().

◆ slideInIdx() [3/3]

void QCustomStackedWidget::slideInIdx ( uint04 idx,
PopupInfo origin_rect,
int delay_time = 0,
enum StackAnimationDirection direction = e_automatic )
inlineoverridevirtual

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 from QCustomStackedWidgetBase.

Definition at line 346 of file QCustomStackedWidget.h.

References QCustomStackedWidgetBase::e_automatic, and QCustomStackedWidgetBase::slideInIdx().

◆ slideInNext()

virtual void QCustomStackedWidget::slideInNext ( )
inlineoverridevirtual

Slides to the next page with animation.

Reimplemented from QCustomStackedWidgetBase.

Definition at line 330 of file QCustomStackedWidget.h.

References QCustomStackedWidgetBase::slideInNext().

◆ slideInPrev()

virtual void QCustomStackedWidget::slideInPrev ( )
inlineoverridevirtual

Slides to the previous page with animation.

Reimplemented from QCustomStackedWidgetBase.

Definition at line 334 of file QCustomStackedWidget.h.

References QCustomStackedWidgetBase::slideInPrev().

◆ slideInWgt()

void QCustomStackedWidget::slideInWgt ( QWidget * widget,
enum StackAnimationDirection direction = e_automatic,
bool force_slide = false )
inlineoverridevirtual

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 from QCustomStackedWidgetBase.

Definition at line 367 of file QCustomStackedWidget.h.

References QCustomStackedWidgetBase::e_automatic, QCustomStackedWidgetBase::slideInWgt(), and widget().

◆ swapIndices()

void QCustomStackedWidget::swapIndices ( uint04 a,
uint04 b )
inlineoverridevirtual

Swaps two child widgets at the given indices.

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

Reimplemented from QCustomStackedWidgetBase.

Definition at line 411 of file QCustomStackedWidget.h.

References QCustomStackedWidgetBase::swapIndices().

◆ widget()

QWidget * QCustomStackedWidget::widget ( uint04 idx) const
inline

Returns the widget at the given index.

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

Definition at line 392 of file QCustomStackedWidget.h.

References QCustomStackedWidgetBase::widget().

Referenced by hasWidget(), indexOf(), removeWidget(), removeWidget(), and slideInWgt().


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