9#include <QVariantAnimation>
12#include <dtkwidget_global.h>
14DWIDGET_BEGIN_NAMESPACE
17class DAbstractStackWidgetTransitionPrivate;
29 QWidget *oldWidget =
nullptr;
30 QWidget *newWidget =
nullptr;
39 virtual void updateVariant(
const QVariant& variant) = 0;
61 void updateVariant(
const QVariant &variant) Q_DECL_OVERRIDE;
65class DStackWidget :
public QWidget,
public DTK_CORE_NAMESPACE::DObject
70 Q_PROPERTY(
bool busy READ busy NOTIFY busyChanged FINAL)
72 Q_PROPERTY(
int depth READ depth NOTIFY depthChanged FINAL)
73 Q_PROPERTY(
int currentIndex READ currentIndex NOTIFY currentIndexChanged)
74 Q_PROPERTY(QWidget* currentWidget READ currentWidget NOTIFY currentWidgetChanged)
76 Q_PROPERTY(
int animationDuration READ animationDuration WRITE setAnimationDuration)
85 int currentIndex()
const;
86 QWidget* currentWidget()
const;
89 int animationDuration()
const;
93 int pushWidget(QWidget *widget,
bool enableTransition =
true);
94 void insertWidget(
int index, QWidget *widget,
bool enableTransition =
true);
98 void popWidget(QWidget *widget =
nullptr,
bool isDelete =
true,
99 int count = 1,
bool enableTransition =
true);
102 int indexOf(QWidget *widget)
const;
103 QWidget* getWidgetByIndex(
int index)
const;
106 void setAnimationDuration(
int animationDuration);
116 void widgetDepthChanged(QWidget *widget,
int depth);
123 void setCurrentIndex(
int currentIndex,
124 DAbstractStackWidgetTransition::TransitionType type = DAbstractStackWidgetTransition::Push,
125 bool enableTransition =
true);
126 void setCurrentWidget(QWidget* currentWidget,
127 DAbstractStackWidgetTransition::TransitionType type = DAbstractStackWidgetTransition::Push,
128 bool enableTransition =
true);