Commit 47a57162 authored by Agata Cacko's avatar Agata Cacko

Fix curve change despite 'Use same curve' checked

Before this commit, if you have a preset like Fill_circle
that has "Use the same curve" checkbox checked and you were
clicking on other sensors, the curve would be back to the default
curve (the one that other sensors had) if you switch back and forth
between some sensors (like Pressure -> X-Tilt-> Pressure).

Also before this commit if you have the default uprising curve
and you switched Rotation -> Tilt elevation, the curve would change.

This commit fixes both behaviours (first by adding transferCurve(),
second by switching the line in kis_curve_widget).

This commit also includes two slot functions instead of one function
that were used as a slot for two different signals. It helps with
debugging signals and keeping stuff clear and ordered.

There is one problem left: if you switch Tilt elevation -> Distance
(using the 'hill' curve), the preset is set to modified even though
the curve doesn't change.

BUG:383909
BACKPORT:krita/4.2
parent c091fce2
......@@ -525,8 +525,8 @@ void KisCurveWidget::setCurve(KisCubicCurve inlist)
{
d->m_curve = inlist;
d->m_grab_point_index = qBound(0, d->m_grab_point_index, d->m_curve.points().count() - 1);
emit pointSelectedChanged();
d->setCurveModified();
emit pointSelectedChanged();
}
void KisCurveWidget::leaveEvent(QEvent *)
......
......@@ -55,12 +55,12 @@ KisCurveOptionWidget::KisCurveOptionWidget(KisCurveOption* curveOption, const QS
updateSensorCurveLabels(m_curveOptionWidget->sensorSelector->currentHighlighted());
updateCurve(m_curveOptionWidget->sensorSelector->currentHighlighted());
connect(m_curveOptionWidget->curveWidget, SIGNAL(modified()), this, SLOT(transferCurve()));
connect(m_curveOptionWidget->curveWidget, SIGNAL(modified()), this, SLOT(slotModified()));
connect(m_curveOptionWidget->sensorSelector, SIGNAL(parametersChanged()), SLOT(emitSettingChanged()));
connect(m_curveOptionWidget->sensorSelector, SIGNAL(parametersChanged()), SLOT(updateLabelsOfCurrentSensor()));
connect(m_curveOptionWidget->sensorSelector, SIGNAL(highlightedSensorChanged(KisDynamicSensorSP)), SLOT(updateSensorCurveLabels(KisDynamicSensorSP)));
connect(m_curveOptionWidget->sensorSelector, SIGNAL(highlightedSensorChanged(KisDynamicSensorSP)), SLOT(updateCurve(KisDynamicSensorSP)));
connect(m_curveOptionWidget->checkBoxUseSameCurve, SIGNAL(stateChanged(int)), SLOT(transferCurve()));
connect(m_curveOptionWidget->checkBoxUseSameCurve, SIGNAL(stateChanged(int)), SLOT(slotStateChanged()));
// set all the icons for the curve preset shapes
......@@ -124,6 +124,11 @@ void KisCurveOptionWidget::readOptionSetting(const KisPropertiesConfigurationSP
m_curveOptionWidget->sensorSelector->setCurrent(m_curveOption->activeSensors().first());
updateSensorCurveLabels(m_curveOptionWidget->sensorSelector->currentHighlighted());
updateCurve(m_curveOptionWidget->sensorSelector->currentHighlighted());
if (m_curveOption->isSameCurveUsed()) {
// make sure the curve is transfered to all sensors to avoid updating from a wrong curve later
transferCurve();
}
}
void KisCurveOptionWidget::lodLimitations(KisPaintopLodLimitations *l) const
......@@ -156,6 +161,17 @@ QWidget* KisCurveOptionWidget::curveWidget()
return m_widget;
}
void KisCurveOptionWidget::slotModified()
{
transferCurve();
}
void KisCurveOptionWidget::slotStateChanged()
{
transferCurve();
}
void KisCurveOptionWidget::transferCurve()
{
m_curveOptionWidget->sensorSelector->setCurrentCurve(m_curveOptionWidget->curveWidget->curve(), m_curveOptionWidget->checkBoxUseSameCurve->isChecked());
......
......@@ -53,6 +53,9 @@ protected:
private Q_SLOTS:
void slotModified();
void slotStateChanged();
void transferCurve();
void updateSensorCurveLabels(KisDynamicSensorSP sensor);
void updateCurve(KisDynamicSensorSP sensor);
......
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