Commit 46687047 authored by Sven Langkamp's avatar Sven Langkamp

fix setting of opacity, opacity needs to be written into the preset settings...

fix setting of opacity, opacity needs to be written into the preset settings otherwise it reset when the widgets load data from the setting
BUG:301050
parent 305b1db5
......@@ -316,6 +316,7 @@ void KisCanvasResourceProvider::slotResourceChanged(int key, const QVariant & re
break;
case(CurrentCompositeOp) :
emit sigCompositeOpChanged(currentCompositeOp());
break;
case (Opacity):
{
emit sigOpacityChanged(res.toDouble());
......
......@@ -81,6 +81,7 @@ KisPaintopBox::KisPaintopBox(KisView2 * view, QWidget *parent, const char * name
, m_previousNode(0)
, m_currTabletToolID(KoToolManager::instance()->currentInputDevice())
, m_presetsEnabled(true)
, m_blockUpdate(false)
{
Q_ASSERT(view != 0);
......@@ -526,6 +527,8 @@ void KisPaintopBox::slotSaveActivePreset()
void KisPaintopBox::slotUpdatePreset()
{
// block updates of avoid some over updating of the option widget
m_blockUpdate = true;
m_optionWidget->writeConfiguration(const_cast<KisPaintOpSettings*>(m_activePreset->settings().data()));
setSliderValue("size", m_activePreset->settings()->paintOpSize().width());
......@@ -559,6 +562,7 @@ void KisPaintopBox::slotUpdatePreset()
updateCompositeOp(KoCompositeOpRegistry::instance().getDefaultCompositeOp().id());
setWidgetState(DISABLE_COMPOSITEOP);
}
m_blockUpdate = false;
}
void KisPaintopBox::slotSetupDefaultPreset()
......@@ -704,10 +708,21 @@ void KisPaintopBox::slotToolChanged(KoCanvasController* canvas, int toolId)
void KisPaintopBox::slotOpacityChanged(qreal opacity)
{
if (m_blockUpdate) {
return;
}
m_blockUpdate = true;
for (int i = 0; i < 2; ++i) {
KisDoubleSliderSpinBox *opacitySlider = m_sliderChooser[i]->getWidget<KisDoubleSliderSpinBox>("opacity");
opacitySlider->blockSignals(true);
opacitySlider->setValue(opacity);
opacitySlider->blockSignals(false);
}
if(m_presetsEnabled) {
if(m_activePreset->settings()->hasProperty("OpacityValue"))
m_activePreset->settings()->setProperty("OpacityValue", opacity);
m_optionWidget->setConfiguration(m_activePreset->settings().data());
}
m_blockUpdate = false;
}
......@@ -184,6 +184,7 @@ private:
PaintOpPresetMap m_paintOpPresetMap;
TabletToolID m_currTabletToolID;
bool m_presetsEnabled;
bool m_blockUpdate;
};
#endif //KIS_PAINTOP_BOX_H_
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