-
Notifications
You must be signed in to change notification settings - Fork 0
/
qanimatedmainwindowlayout.h
116 lines (94 loc) · 3.63 KB
/
qanimatedmainwindowlayout.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
#ifndef QANIMATEDMAINWINDOWLAYOUT_H
#define QANIMATEDMAINWINDOWLAYOUT_H
#include <QLayout>
class QAnimatedMainWindowLayoutPrivate;
class QEasingCurve;
class QAnimatedMainWindowLayout : public QLayout
{
Q_OBJECT
Q_PROPERTY(int leftStretch READ leftStretch WRITE setLeftStretch)
Q_PROPERTY(int rightStretch READ rightStretch WRITE setRightStretch)
Q_PROPERTY(int topStretch READ topStretch WRITE setTopStretch)
Q_PROPERTY(int bottomStretch READ bottomStretch WRITE setBottomStretch)
Q_PROPERTY(int centerStretch READ centerStretch WRITE setCenterStretch)
Q_PROPERTY(qreal leftPercentage READ leftPercentage WRITE setLeftPercentage)
Q_PROPERTY(qreal rightPercentage READ rightPercentage WRITE setRightPercentage)
Q_PROPERTY(qreal topPercentage READ topPercentage WRITE setTopPercentage)
Q_PROPERTY(qreal bottomPercentage READ bottomPercentage WRITE setBottomPercentage)
Q_PROPERTY(qreal centerPercentage READ centerPercentage WRITE setCenterPercentage)
Q_PROPERTY(int spacing READ spacing WRITE setSpacing)
Q_PROPERTY(bool animationEnabled READ isAnimationEnabled WRITE setAnimationEnabled)
Q_PROPERTY(uint animationDuration READ animationDuration WRITE setAnimationDuration)
public:
enum LayoutAreas {
LeftLayoutArea = 0,
RightLayoutArea,
TopLayoutArea,
BottomLayoutArea,
CenterLayoutArea,
LayoutAreasMax
};
public:
explicit QAnimatedMainWindowLayout(QWidget *parent = 0);
virtual ~QAnimatedMainWindowLayout();
void addLeftWidget(QWidget *item);
void addRightWidget(QWidget *item);
void addTopWidget(QWidget *item);
void addBottomWidget(QWidget *item);
void addCenterWidget(QWidget *item);
void addWidget(QWidget *item, LayoutAreas area);
signals:
void animationFinished();
public slots:
void setLeftStretch(int stretch);
void setRightStretch(int stretch);
void setTopStretch(int stretch);
void setBottomStretch(int stretch);
void setCenterStretch(int stretch);
void setLeftPercentage(qreal stretch);
void setRightPercentage(qreal stretch);
void setTopPercentage(qreal stretch);
void setBottomPercentage(qreal stretch);
void setCenterPercentage(qreal stretch);
void setSpacing(int space);
void setAnimationEnabled(bool enabled);
void setAnimationDuration(uint duration);
void setEasingCurve(const QEasingCurve &easing);
public:
int leftStretch() const;
int rightStretch() const;
int topStretch() const;
int bottomStretch() const;
int centerStretch() const;
qreal leftPercentage() const;
qreal rightPercentage() const;
qreal topPercentage() const;
qreal bottomPercentage() const;
qreal centerPercentage() const;
int spacing() const;
bool isAnimationEnabled() const;
uint animationDuration() const;
const QEasingCurve & easingCurve() const;
// QLayout interface
private:
virtual void addItem(QLayoutItem *);
public:
virtual QLayoutItem *itemAt(int index) const;
virtual QLayoutItem *takeAt(int index);
virtual int count() const;
// QLayoutItem interface
public:
virtual QSize sizeHint() const;
virtual QSize minimumSize() const;
virtual void setGeometry(const QRect &rect);
virtual bool isEmpty() const;
virtual bool hasHeightForWidth() const;
virtual void invalidate();
private:
// Q_DISABLE_COPY
QAnimatedMainWindowLayout(const QAnimatedMainWindowLayout &);
QAnimatedMainWindowLayout &operator=(const QAnimatedMainWindowLayout &);
QAnimatedMainWindowLayoutPrivate * m_private;
friend class QAnimatedMainWindowLayoutPrivate;
};
#endif // QANIMATEDMAINWINDOWLAYOUT_H