add a color picker dialog to palette editor

This commit is contained in:
garak
2022-06-17 15:04:12 -04:00
committed by garakmon
parent 11661818b6
commit 45cb2a19af
7 changed files with 2079 additions and 1163 deletions

33
include/ui/colorpicker.h Normal file
View File

@@ -0,0 +1,33 @@
#ifndef COLORPICKER_H
#define COLORPICKER_H
#include <QDialog>
#include <QGraphicsScene>
namespace Ui {
class ColorPicker;
}
class ColorPicker : public QDialog
{
Q_OBJECT
public:
explicit ColorPicker(QWidget *parent = nullptr);
~ColorPicker();
QColor getColor() { return this->color; }
private:
Ui::ColorPicker *ui;
QGraphicsScene *scene = nullptr;
QTimer *timer = nullptr;
QPoint lastCursorPos = QPoint(0, 0);
QColor color = Qt::white;
void hover(int mouseX, int mouseY);
};
#endif // COLORPICKER_H

View File

@@ -34,6 +34,7 @@ private:
QList<QList<QSlider*>> sliders;
QList<QFrame*> frames;
QList<QLabel*> rgbLabels;
QList<QToolButton *> pickButtons;
Tileset *primaryTileset;
Tileset *secondaryTileset;
QList<History<PaletteHistoryItem*>> palettesHistory;
@@ -48,6 +49,7 @@ private:
void restoreWindowState();
void setColorsFromHistory(PaletteHistoryItem*, int);
void closeEvent(QCloseEvent*);
void pickColor(int i);
signals:
void closed();