forked from timschneeb/SlidingStackedWidget
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathdemo.cpp
32 lines (30 loc) · 838 Bytes
/
demo.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
#include "demo.h"
#include "ui_demo.h"
demo::demo(QWidget *parent) :
QDialog(parent),
ui(new Ui::demo)
{
ui->setupUi(this);
ui->stackedWidget->setAnimation(QEasingCurve::Type::OutQuart);
ui->stackedWidget->setSpeed(650);
connect(ui->prev,&QAbstractButton::clicked,[this]{
if(ui->stackedWidget->slideInPrev()){
ui->prev->setEnabled(false);
ui->next->setEnabled(false);
}
});
connect(ui->next,&QAbstractButton::clicked,[this]{
if(ui->stackedWidget->slideInNext()){
ui->prev->setEnabled(false);
ui->next->setEnabled(false);
}
});
connect(ui->stackedWidget,&SlidingStackedWidget::animationFinished,[this]{
ui->prev->setEnabled(true);
ui->next->setEnabled(true);
});
}
demo::~demo()
{
delete ui;
}