* Add ColorGrabWidget The new widget aims to decouple color grabbing from the SidePanelWidget. * Refactor SidePanelWidget to use ColorGrabWidget - All color grabbing functionality is now moved to ColorGrabWidget - SidePanelWidget now uses a more organized sigslot approach - Removed QColorPickingEventFilter * Fix bug and complete implementation Timer not yet implemented. Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com> * Add 0.5s timer Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com> * Fix failing builds Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com> * Add hex color editor Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com> * Add right mouse button instant preview Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com> * Make zoom widget toggle-able * Implement OverlayMessage class * Make Right click do the same as Space * Unzoom widget when mouse leaves it Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com> * Fix some small issues Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com> * Toggle panel when grabbing color Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com> * Show with timer even if magnifier active Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com> * Reduce timer delay Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com> * Fix OverlayMessage bug Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>
60 lines
1.3 KiB
C++
60 lines
1.3 KiB
C++
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
// SPDX-FileCopyrightText: 2017-2019 Alejandro Sirgo Rica & Contributors
|
|
|
|
#pragma once
|
|
|
|
#include "color_wheel.hpp"
|
|
#include <QWidget>
|
|
|
|
class QVBoxLayout;
|
|
class QPushButton;
|
|
class QLabel;
|
|
class QLineEdit;
|
|
class ColorGrabWidget;
|
|
class QColorPickingEventFilter;
|
|
class QSlider;
|
|
|
|
class SidePanelWidget : public QWidget
|
|
{
|
|
Q_OBJECT
|
|
|
|
friend class QColorPickingEventFilter;
|
|
|
|
public:
|
|
explicit SidePanelWidget(QPixmap* p, QWidget* parent = nullptr);
|
|
|
|
signals:
|
|
void colorChanged(const QColor& c);
|
|
void thicknessChanged(int t);
|
|
void togglePanel();
|
|
|
|
public slots:
|
|
void updateColor(const QColor& c);
|
|
void updateColorNoWheel(const QColor& c);
|
|
void updateThickness(const int& t);
|
|
|
|
private slots:
|
|
void startColorGrab();
|
|
void onColorGrabFinished();
|
|
void onColorGrabAborted();
|
|
void onColorUpdated(const QColor& color);
|
|
|
|
private:
|
|
void finalizeGrab();
|
|
|
|
bool eventFilter(QObject* obj, QEvent* event) override;
|
|
void hideEvent(QHideEvent* event) override;
|
|
|
|
QVBoxLayout* m_layout;
|
|
QPushButton* m_colorGrabButton;
|
|
ColorGrabWidget* m_colorGrabber;
|
|
color_widgets::ColorWheel* m_colorWheel;
|
|
QLabel* m_colorLabel;
|
|
QLineEdit* m_colorHex;
|
|
QPixmap* m_pixmap;
|
|
QColor m_color;
|
|
QColor m_revertColor;
|
|
QSlider* m_thicknessSlider;
|
|
int m_thickness;
|
|
};
|