File indexing completed on 2024-05-12 04:20:05

0001 /**
0002  * SPDX-FileCopyrightText: 2001-2015 Klaralvdalens Datakonsult AB. All rights reserved.
0003  *
0004  * This file is part of the KD Chart library.
0005  *
0006  * SPDX-License-Identifier: GPL-2.0-or-later
0007  */
0008 
0009 #ifndef COLORSLIDER_H
0010 #define COLORSLIDER_H
0011 
0012 #include <QAbstractSlider>
0013 
0014 class ColorSlider : public QAbstractSlider
0015 {
0016     Q_OBJECT
0017     Q_PROPERTY( QColor startColor READ startColor WRITE setStartColor NOTIFY startColorChanged )
0018     Q_PROPERTY( QColor endColor READ endColor WRITE setStartColor NOTIFY endColorChanged )
0019 public:
0020     explicit ColorSlider( QWidget *parent = nullptr );
0021     ~ColorSlider() override;
0022     QColor startColor() const;
0023     void setStartColor( const QColor &color );
0024     QColor endColor() const;
0025     void setEndColor( const QColor &color );
0026     QSize sizeHint() const override;
0027 
0028 protected:
0029     void paintEvent( QPaintEvent *event ) override;
0030     void mousePressEvent(QMouseEvent *event ) override;
0031     void mouseReleaseEvent(QMouseEvent *event ) override;
0032     void mouseMoveEvent( QMouseEvent *event ) override;
0033 
0034 Q_SIGNALS:
0035     void startColorChanged();
0036     void endColorChanged();
0037 
0038 public Q_SLOTS:
0039 private:
0040     class Private;
0041     Private *d;
0042 
0043 };
0044 
0045 #endif // COLORSLIDER_H