Commit d2408c04 authored by Jean-Baptiste Mardelle's avatar Jean-Baptiste Mardelle

Nicer look for color wheels, allow entering numbers in lift/gamma/gain.

Fixes #296
parent 0a631aaf
......@@ -317,6 +317,12 @@ const QString AssetPanel::getStyleSheet()
"border: 1px solid %1;} QAbstractSpinBox:hover#dragBox {border: 1px solid %2;} ")
// minimal double edit
QStringLiteral("QAbstractSpinBox#dragMinimal {border: 0px "
";padding-right:0px; background-color:transparent} QAbstractSpinBox::down-button#dragMinimal {width:0px;padding:0px;} QAbstractSpinBox:disabled#dragMinimal {border: 0px;; background-color:transparent "
";} QAbstractSpinBox::up-button#dragMinimal {width:0px;padding:0px;}")
// group editable labels
stylesheet.append(QStringLiteral("MyEditableLabel { background-color: transparent; color: palette(bright-text); border-radius: 2px;border: 1px solid "
"transparent;} MyEditableLabel:hover {border: 1px solid palette(highlight);} "));
This diff is collapsed.
......@@ -23,6 +23,9 @@
#include <QResizeEvent>
#include <QWidget>
class QDoubleSpinBox;
class QLabel;
class NegQColor
......@@ -32,37 +35,45 @@ public:
QColor qcolor;
static NegQColor fromHsvF(qreal h, qreal s, qreal l, qreal a = 1.0);
static NegQColor fromRgbF(qreal r, qreal g, qreal b, qreal a = 1.0);
qreal redF();
qreal greenF();
qreal blueF();
qreal valueF();
int hue();
qreal hueF();
qreal saturationF();
qreal redF() const;
qreal greenF() const;
qreal blueF() const;
qreal valueF() const;
int hue() const;
qreal hueF() const;
qreal saturationF() const;
void setRedF(qreal val);
void setGreenF(qreal val);
void setBlueF(qreal val);
void setValueF(qreal val);
class ColorWheel : public QWidget
class WheelContainer : public QWidget
explicit ColorWheel(QString id, QString name, NegQColor color, QWidget *parent = nullptr);
explicit WheelContainer(QString id, QString name, NegQColor color, int unitSize, QWidget *parent = nullptr);
QSize sizeHint() const override;
QSize minimumSizeHint() const override;
NegQColor color() const;
void setColor(const NegQColor &color);
void setColor(QList <double> values);
void setFactorDefaultZero(qreal factor, qreal defvalue, qreal zero);
void colorChange(const NegQColor &color);
const QList <double> getNiceParamValues() const;
void setRedColor(double value);
void setGreenColor(double value);
void setBlueColor(double value);
public slots:
void changeColor(const NegQColor &color);
void colorChange(const NegQColor &color);
void mousePressEvent(QMouseEvent *event) override;
void mouseMoveEvent(QMouseEvent *event) override;
void mouseReleaseEvent(QMouseEvent *event) override;
void wheelEvent(QWheelEvent *event) override;
void resizeEvent(QResizeEvent *event) override;
void paintEvent(QPaintEvent *event) override;
......@@ -94,7 +105,27 @@ private:
void drawWheelDot(QPainter &painter);
void drawSliderBar(QPainter &painter);
void drawSlider();
QString getParamValues();
const QString getParamValues() const;
class ColorWheel : public QWidget
explicit ColorWheel(QString id, QString name, NegQColor color, QWidget *parent = nullptr);
NegQColor color() const;
void setColor(QList <double> values);
void setFactorDefaultZero(qreal factor, qreal defvalue, qreal zero);
WheelContainer *m_container;
QLabel *m_wheelName;
QDoubleSpinBox *m_redEdit;
QDoubleSpinBox *m_greenEdit;
QDoubleSpinBox *m_blueEdit;
void colorChange(const NegQColor &color);
#endif // COLORWHEEL_H
......@@ -126,15 +126,7 @@ void LumaLiftGainParam::slotRefresh()
double val = m_locale.toDouble(m_model->data(local_index, AssetParameterModel::ValueRole).toString());
values.insert(name, val);
NegQColor lift = NegQColor::fromRgbF(values.value(QStringLiteral("lift_r")) / LIFT_FACTOR, values.value(QStringLiteral("lift_g")) / LIFT_FACTOR,
values.value(QStringLiteral("lift_b")) / LIFT_FACTOR);
NegQColor gamma = NegQColor::fromRgbF(values.value(QStringLiteral("gamma_r")) / GAMMA_FACTOR, values.value(QStringLiteral("gamma_g")) / GAMMA_FACTOR,
values.value(QStringLiteral("gamma_b")) / GAMMA_FACTOR);
NegQColor gain = NegQColor::fromRgbF(values.value(QStringLiteral("gain_r")) / GAIN_FACTOR, values.value(QStringLiteral("gain_g")) / GAIN_FACTOR,
values.value(QStringLiteral("gain_b")) / GAIN_FACTOR);
m_lift->setColor({values.value(QStringLiteral("lift_r")), values.value(QStringLiteral("lift_g")), values.value(QStringLiteral("lift_b"))});
m_gamma->setColor({values.value(QStringLiteral("gamma_r")), values.value(QStringLiteral("gamma_g")), values.value(QStringLiteral("gamma_b"))});
m_gain->setColor({values.value(QStringLiteral("gain_r")), values.value(QStringLiteral("gain_g")), values.value(QStringLiteral("gain_b"))});
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment