mirror of
https://github.com/huderlem/porymap.git
synced 2026-08-20 07:36:31 -05:00
add a color picker dialog to palette editor
This commit is contained in:
33
include/ui/colorpicker.h
Normal file
33
include/ui/colorpicker.h
Normal 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
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user