Commit e6c23b27 authored by Dmitry Kazakov's avatar Dmitry Kazakov
Browse files

Fix wrong values of Grid spacing when changing the spin box

1) KisAspectRatioLocker blocks the signal of the second spinbox,
   but the configuration should be updated only when both the
   spinboxes are updated. Therefore a new signal in KisAspectRatioLocker
   has been implemented, which notifies the receivers that both boxes
   are ready.

2) Allow 1 px grid :)

Fixes T2245
BUG:361721
parent 0bbe01be
......@@ -66,6 +66,7 @@ void KisAspectRatioLocker::slotSpinOneChanged()
KisSignalsBlocker b(m_d->spinTwo);
m_d->spinTwo->setValue(qRound(m_d->aspectRatio * m_d->spinOne->value()));
}
emit sliderValueChanged();
}
void KisAspectRatioLocker::slotSpinTwoChanged()
......@@ -74,6 +75,8 @@ void KisAspectRatioLocker::slotSpinTwoChanged()
KisSignalsBlocker b(m_d->spinOne);
m_d->spinOne->setValue(qRound(m_d->spinTwo->value() / m_d->aspectRatio));
}
emit sliderValueChanged();
}
void KisAspectRatioLocker::slotAspectButtonChanged()
......@@ -86,4 +89,6 @@ void KisAspectRatioLocker::slotAspectButtonChanged()
} else {
m_d->aspectRatio = 1.0;
}
emit aspectButtonChanged();
}
......@@ -41,6 +41,10 @@ private Q_SLOTS:
void slotSpinTwoChanged();
void slotAspectButtonChanged();
Q_SIGNALS:
void sliderValueChanged();
void aspectButtonChanged();
private:
struct Private;
const QScopedPointer<Private> m_d;
......
......@@ -67,14 +67,6 @@ GridConfigWidget::GridConfigWidget(QWidget *parent) :
connect(ui->chkSnapToGuides, SIGNAL(stateChanged(int)), SLOT(slotGuidesGuiChanged()));
connect(ui->chkLockGuides, SIGNAL(stateChanged(int)), SLOT(slotGuidesGuiChanged()));
connect(ui->intHSpacing, SIGNAL(valueChanged(int)), SLOT(slotGridGuiChanged()));
connect(ui->intVSpacing, SIGNAL(valueChanged(int)), SLOT(slotGridGuiChanged()));
connect(ui->spacingAspectButton, SIGNAL(keepAspectRatioChanged(bool)), SLOT(slotGridGuiChanged()));
connect(ui->intXOffset, SIGNAL(valueChanged(int)), SLOT(slotGridGuiChanged()));
connect(ui->intYOffset, SIGNAL(valueChanged(int)), SLOT(slotGridGuiChanged()));
connect(ui->offsetAspectButton, SIGNAL(keepAspectRatioChanged(bool)), SLOT(slotGridGuiChanged()));
connect(ui->intSubdivision, SIGNAL(valueChanged(int)), SLOT(slotGridGuiChanged()));
connect(ui->selectMainStyle, SIGNAL(currentIndexChanged(int)), SLOT(slotGridGuiChanged()));
......@@ -91,6 +83,12 @@ GridConfigWidget::GridConfigWidget(QWidget *parent) :
KisAspectRatioLocker *spacingLocker = new KisAspectRatioLocker(this);
spacingLocker->connectSpinBoxes(ui->intHSpacing, ui->intVSpacing, ui->spacingAspectButton);
connect(offsetLocker, SIGNAL(sliderValueChanged()), SLOT(slotGridGuiChanged()));
connect(offsetLocker, SIGNAL(aspectButtonChanged()), SLOT(slotGridGuiChanged()));
connect(spacingLocker, SIGNAL(sliderValueChanged()), SLOT(slotGridGuiChanged()));
connect(spacingLocker, SIGNAL(aspectButtonChanged()), SLOT(slotGridGuiChanged()));
}
GridConfigWidget::~GridConfigWidget()
......
......@@ -68,7 +68,7 @@
<string> px</string>
</property>
<property name="minimum">
<number>2</number>
<number>1</number>
</property>
<property name="maximum">
<number>500</number>
......@@ -91,7 +91,7 @@
<string> px</string>
</property>
<property name="minimum">
<number>2</number>
<number>1</number>
</property>
<property name="maximum">
<number>500</number>
......@@ -238,14 +238,14 @@
<property name="text">
<string/>
</property>
<property name="color">
<property name="color" stdset="0">
<color>
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</property>
<property name="defaultColor">
<property name="defaultColor" stdset="0">
<color>
<red>0</red>
<green>0</green>
......@@ -307,14 +307,14 @@
<property name="text">
<string/>
</property>
<property name="color">
<property name="color" stdset="0">
<color>
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</property>
<property name="defaultColor">
<property name="defaultColor" stdset="0">
<color>
<red>0</red>
<green>0</green>
......@@ -431,14 +431,14 @@
<property name="text">
<string/>
</property>
<property name="color">
<property name="color" stdset="0">
<color>
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</property>
<property name="defaultColor">
<property name="defaultColor" stdset="0">
<color>
<red>0</red>
<green>0</green>
......
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