一.使用示例代码
包含fingerswipegesture和slidingstackedwidget两个类,使用如下:
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <QLabel>
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent)
, ui(new Ui::MainWindow)
{
ui->setupUi(this);
setAttribute(Qt::WA_AcceptTouchEvents);
connect(ui->stackedWidget, SIGNAL(fingerGesture(SlidingStackedWidget::SlideDirection)),
this, SLOT(onFingerGesture(SlidingStackedWidget::SlideDirection)));
}
void MainWindow::onFingerGesture(SlidingStackedWidget::SlideDirection direction)
{
if (direction == SlidingStackedWidget::LeftToRight)
ui->stackedWidget->slideInIdx(1);
else if (direction == SlidingStackedWidget::RightToLeft)
ui->stackedWidget->slideInIdx(0);
}
MainWindow::~MainWindow()
{
delete ui;
}