An enhanced QStackedWidget with animated card transitions. More...
#include <CardStackWidget.h>
Public Types | |
enum class | CardTransitionMode { Slide , Fade } |
Available transition animation modes. More... | |
Public Member Functions | |
CardStackWidget (QWidget *parent=nullptr) | |
Constructs a CardStackWidget. | |
void | setCardTransitionMode (CardTransitionMode mode) |
Sets the transition animation mode. | |
CardTransitionMode | cardTransitionMode () const |
Gets the current transition mode. | |
void | slideTo (int newIndex) |
Animates transition to a specific card. | |
void | setablility_of_autoSwitch (bool ability) |
Enables/disables automatic card switching. | |
bool | autoSwitchAbility () |
Checks if auto-switching is enabled. | |
Static Public Attributes | |
static constexpr ValueLimitSimplePair | animation_bound { 250, 500 } |
static constexpr ValueLimitSimplePair | timer_switch_invoker { 3000, 10000 } |
Protected Member Functions | |
void | mousePressEvent (QMouseEvent *event) override |
Handles mouse press events for drag detection. | |
void | mouseReleaseEvent (QMouseEvent *event) override |
Handles mouse release events for drag completion. | |
void | mouseMoveEvent (QMouseEvent *event) override |
Handles mouse move events for drag tracking. | |
An enhanced QStackedWidget with animated card transitions.
Provides a stack of widgets with customizable transition animations (slide/fade) and optional automatic switching between cards.
|
strong |
|
explicit |
Constructs a CardStackWidget.
parent | Parent widget (optional) |
bool CardStackWidget::autoSwitchAbility | ( | ) |
Checks if auto-switching is enabled.
CardStackWidget::CardTransitionMode CardStackWidget::cardTransitionMode | ( | ) | const |
Gets the current transition mode.
|
overrideprotected |
Handles mouse move events for drag tracking.
event | The mouse event |
|
overrideprotected |
Handles mouse press events for drag detection.
event | The mouse event |
|
overrideprotected |
Handles mouse release events for drag completion.
event | The mouse event |
void CardStackWidget::setablility_of_autoSwitch | ( | bool | ability | ) |
Enables/disables automatic card switching.
ability | true to enable, false to disable |
void CardStackWidget::setCardTransitionMode | ( | CardTransitionMode | mode | ) |
Sets the transition animation mode.
mode | The transition mode to use |
void CardStackWidget::slideTo | ( | int | newIndex | ) |
Animates transition to a specific card.
newIndex | Index of the card to transition to |
|
staticconstexpr |
Bounds for animation duration
|
staticconstexpr |
Bounds for auto-switch timer