/*
 * Copyright (C) 2022, KylinSoft 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 of the License, 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 <https://www.gnu.org/licenses/>.
 *
 * Authors: Xin Li <lixin@kylinos.cn>
 */
#ifndef CUSTOMSLIDER_H
#define CUSTOMSLIDER_H

#include <QWidget>
#include <QSlider>
#include <QMouseEvent>
#include <QEvent>
#include <QCoreApplication>
#include <QDebug>

class CustomSlider : public QSlider
{
    Q_OBJECT
public:
    explicit CustomSlider(QWidget *parent = nullptr);
    ~CustomSlider();

    void initStyle();
    void themeStyle(QString themeColor);

private:
    int m_value;       //滑动条的值
    bool m_mousePress; //鼠标是否按压

protected:
    void mousePressEvent(QMouseEvent *event) override; //单击

    void mouseReleaseEvent(QMouseEvent *event) override; //释放

signals:

    void sliderReleasedAt(int); //当鼠标释放时，抛出包含鼠标X坐标位置信息的信号

public slots:

    void changeThemeColorSlot(const QString &key);
};

#endif // CUSTOMSLIDER_H
