103 lines
2.7 KiB
C++
103 lines
2.7 KiB
C++
/*
|
||
* Copyright (C) 2019 Tianjin KYLIN Information Technology Co., Ltd.
|
||
*
|
||
* This program is free software; you can redistribute it and/or modify
|
||
* it under the terms of the GNU General Public License as published by
|
||
* the Free Software Foundation; either version 3, or (at your option)
|
||
* any later version.
|
||
*
|
||
* This program is distributed in the hope that it will be useful,
|
||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
* GNU General Public License for more details.
|
||
*
|
||
* You should have received a copy of the GNU General Public License
|
||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||
*
|
||
*/
|
||
#ifndef VERTICALSCROLL_24_H
|
||
#define VERTICALSCROLL_24_H
|
||
|
||
#include <QWidget>
|
||
#include <QPropertyAnimation>
|
||
#include <QPainter>
|
||
#include <QStyleOption>
|
||
#include "baseverticalscroll.h"
|
||
|
||
namespace Ui {
|
||
|
||
class VerticalScroll_24;
|
||
|
||
}
|
||
class Clock;
|
||
class VerticalScroll_24 : public BaseVerticalScroll
|
||
|
||
{
|
||
Q_OBJECT
|
||
|
||
Q_PROPERTY(int deviation READ readDeviation WRITE setDeviation )
|
||
|
||
public:
|
||
|
||
explicit VerticalScroll_24(QWidget *parent = 0, Clock *clock = 0);
|
||
|
||
~VerticalScroll_24();
|
||
//设置范围
|
||
// set range
|
||
void setRange(int min, int max);
|
||
//获取当前值
|
||
// Get current value
|
||
int readValue();
|
||
Clock *m_Pclock;
|
||
|
||
protected:
|
||
//鼠标按压选择当前值
|
||
// Press the mouse to select the current value
|
||
void mousePressEvent(QMouseEvent *) override;
|
||
//鼠标拖动,滚轮滚动
|
||
// Mouse drag, scroll wheel
|
||
//鼠标释放,数值弹回正中间
|
||
// Release the mouse, and the value will bounce back to the middle
|
||
void mouseReleaseEvent(QMouseEvent *) override;
|
||
//鼠标滑轮滚动,数值滚动
|
||
// Mouse wheel scrolling, numerical scrolling
|
||
//绘制当前数值轮画面
|
||
// Draw the current numerical wheel screen
|
||
void paintEvent(QPaintEvent *) override;
|
||
|
||
void enterEvent ( QEvent * event ) override;
|
||
void leaveEvent ( QEvent * event ) override;
|
||
|
||
//描绘数字
|
||
//使选中的数字回到屏幕中间
|
||
//Bring the selected number back to the middle of the screen
|
||
//鼠标移动偏移量,默认为0
|
||
// Mouse movement offset, default is 0
|
||
int readDeviation();
|
||
//设置偏移量
|
||
// Set offset
|
||
void setDeviation(int n);
|
||
|
||
void setupUi(QWidget *VerticalScroll_24);
|
||
|
||
void retranslateUi(QWidget *VerticalScroll_24);
|
||
|
||
signals:
|
||
|
||
void currentValueChanged(int value);
|
||
|
||
void deviationChange(int deviation);
|
||
|
||
|
||
|
||
private:
|
||
|
||
Ui::VerticalScroll_24 *ui;
|
||
|
||
private:
|
||
void paintNum_24(QPainter &painter, int Height);
|
||
void paintNum_12(QPainter &painter, int Height);
|
||
};
|
||
|
||
#endif // VERTICALSCROLL_24_H
|