File indexing completed on 2024-05-26 04:32:50

0001 /*
0002  * SPDX-FileCopyrightText: 2020 Mathias Wein <lynx.mw+kde@gmail.com>
0003  *
0004  * SPDX-License-Identifier: GPL-3.0-or-later
0005  */
0006 
0007 #ifndef WGSHADESELECTOR_H
0008 #define WGSHADESELECTOR_H
0009 
0010 #include <WGSelectorWidgetBase.h>
0011 
0012 #include <QObject>
0013 #include <QWidget>
0014 #include <QVector>
0015 #include <QVector4D>
0016 
0017 class WGShadeSlider;
0018 
0019 class WGShadeSelector : public WGSelectorWidgetBase
0020 {
0021     Q_OBJECT
0022 
0023 public:
0024     WGShadeSelector(WGSelectorDisplayConfigSP displayConfig, KisVisualColorModelSP colorModel, QWidget *parent = nullptr);
0025 
0026     void setModel(KisVisualColorModelSP colorModel) override;
0027     void updateSettings() override;
0028 protected:
0029     void mousePressEvent(QMouseEvent *event) override;
0030 
0031     void connectToModel();
0032 
0033 public Q_SLOTS:
0034     void slotChannelValuesChanged(const QVector4D &values);
0035 private Q_SLOTS:
0036     void slotSliderValuesChanged(const QVector4D &values);
0037     void slotSliderInteraction(bool active);
0038     void slotReset();
0039 
0040 private:
0041     KisVisualColorModelSP m_model;
0042     QVector<WGShadeSlider *> m_sliders;
0043     int m_lineHeight {10};
0044     bool m_resetOnExternalUpdate {true};
0045     bool m_resetOnInteractions {false};
0046     bool m_resetOnRightClick {true};
0047     bool m_allowUpdates {true};
0048     bool m_initialized {false};
0049 };
0050 
0051 #endif // WGSHADESELECTOR_H