-
Notifications
You must be signed in to change notification settings - Fork 0
/
mainwindow.cpp
46 lines (36 loc) · 1.55 KB
/
mainwindow.cpp
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
#include "mainwindow.h"
#include <QEasingCurve>
#include "qanimatedmainwindowlayout.h"
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent)
{
setupUi(this);
QAnimatedMainWindowLayout * amwl = new QAnimatedMainWindowLayout;
connect(leftDoubleSpinBox, SIGNAL(valueChanged(double)), amwl, SLOT(setLeftPercentage(qreal)));
connect(rightDoubleSpinBox, SIGNAL(valueChanged(double)), amwl, SLOT(setRightPercentage(qreal)));
connect(topDoubleSpinBox, SIGNAL(valueChanged(double)), amwl, SLOT(setTopPercentage(qreal)));
connect(bottomDoubleSpinBox, SIGNAL(valueChanged(double)), amwl, SLOT(setBottomPercentage(qreal)));
connect(centerDoubleSpinBox, SIGNAL(valueChanged(double)), amwl, SLOT(setCenterPercentage(qreal)));
amwl->addLeftWidget(leftGroupBox);
amwl->addRightWidget(rightGroupBox);
amwl->addTopWidget(topGroupBox);
amwl->addBottomWidget(bottomGroupBox);
amwl->addCenterWidget(centerGroupBox);
amwl->setEasingCurve(QEasingCurve::OutBack);
amwl->setAnimationDuration(500);
// disable animation for initialization
amwl->setAnimationEnabled(false);
amwl->setLeftPercentage(leftDoubleSpinBox->value());
amwl->setRightPercentage(rightDoubleSpinBox->value());
amwl->setTopPercentage(topDoubleSpinBox->value());
amwl->setBottomPercentage(bottomDoubleSpinBox->value());
amwl->setCenterPercentage(centerDoubleSpinBox->value());
amwl->setAnimationEnabled(true);
QLayout * fl = frame->layout();
if (fl)
delete fl;
frame->setLayout(amwl);
}
MainWindow::~MainWindow()
{
}