You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.
/******************************************************************
Copyright © Deng Zhimao Co., Ltd. 1990-2021. All rights reserved.
* @projectName slidepage
* @brief slidepage.h
* @author Deng Zhimao
* @email 1252699831@qq.com
* @net www.openedv.com
* @date 2021-06-09
*******************************************************************/
# ifndef climate_H
# define climate_H
# include <QWidget>
# include <QHBoxLayout>
# include <QMouseEvent>
# include <QScroller>
# include <QScrollBar>
# include <QScrollArea>
# include <QTimer>
# include <QHBoxLayout>
# include <QLabel>
# include <QPropertyAnimation>
# include <QParallelAnimationGroup>
# include <QDebug>
# include <QMouseEvent>
class SlidePage : public QWidget
{
Q_OBJECT
public :
SlidePage ( QWidget * parent = nullptr ) ;
~ SlidePage ( ) ;
/* 添加新的页面 */
void addPage ( QWidget * ) ;
/* 页面总数 */
int getPageCount ( ) ;
/* 当前页面 */
int getCurrentPageIndex ( ) ;
int press_x = 0 ; //摁下的x坐标
int press_y = 0 ;
int relea_x = 0 ;
int relea_y = 0 ;
private :
/* 滚动区域 */
QScrollArea * scrollArea ;
/* 主Widget */
QWidget * mainWidget ;
/* 水平布局 */
QHBoxLayout * hBoxLayout ;
/* 滚屏对象 */
QScroller * scroller ;
/* 重设大小 */
void resizeEvent ( QResizeEvent * event ) ;
/* 定时器,用于检测用户是否在拖动屏幕 */
QTimer * timer ;
/* 当前页数下标 */
int pageIndex ;
/* 总页数 */
int pageCount ;
/* 拖动标志位 */
bool draggingFlag ;
/* 底部Wiget, 用于逗点分页显示 */
QWidget * bottomWidget ;
/* 分点逗点 */
QVector < QLabel * > pageIndicator ;
/* 底部分页逗点布局 */
QHBoxLayout * bottomHBoxLayout ;
bool eventFilter ( QObject * watch , QEvent * evn ) ; //事件监听函数
private slots :
/* 水平滚动条值变化 */
void hScrollBarValueChanged ( int ) ;
/* 滚动对象的状态 */
void onStateChanged ( QScroller : : State ) ;
/* 定时器超时槽函数 */
void onTimerTimeOut ( ) ;
/* 分页逗点槽函数 */
void onCurrentPageIndexChanged ( int ) ;
signals :
void currentPageIndexChanged ( int ) ;
} ;
# endif // climate_H