Add color input to grid settings

This commit is contained in:
GriffinR
2024-09-28 03:50:51 -04:00
parent 2cd4cb9334
commit 274d95eef5
7 changed files with 652 additions and 58 deletions

View File

@@ -0,0 +1,45 @@
#ifndef COLORINPUTWIDGET_H
#define COLORINPUTWIDGET_H
#include <QGroupBox>
#include <QValidator>
namespace Ui {
class ColorInputWidget;
}
class ColorInputWidget : public QGroupBox {
Q_OBJECT
public:
explicit ColorInputWidget(QWidget *parent = nullptr);
explicit ColorInputWidget(const QString &title, QWidget *parent = nullptr);
~ColorInputWidget();
void setColor(QRgb color);
QRgb color() const { return m_color; }
bool setBitDepth(int bits);
int bitDepth() const { return m_bitDepth; }
signals:
void colorChanged(QRgb color);
void bitDepthChanged(int bits);
private:
Ui::ColorInputWidget *ui;
QRgb m_color = 0;
int m_bitDepth = 0;
void init();
void updateColorUi();
void pickColor();
void blockEditSignals(bool block);
void setRgbFromSliders();
void setRgbFromSpinners();
void setRgbFromHexString(const QString &);
};
#endif // COLORINPUTWIDGET_H

View File

@@ -34,6 +34,7 @@ private slots:
void on_spinBox_X_valueChanged(int value);
void on_spinBox_Y_valueChanged(int value);
void on_comboBox_Style_currentIndexChanged(int index);
void onColorChanged(QRgb color);
};
inline bool operator==(const struct GridSettings &a, const struct GridSettings &b) {