47 for (int i : {0, 1, 2}) |
47 for (int i : {0, 1, 2}) |
48 for (int j : {0, 1, 2}) |
48 for (int j : {0, 1, 2}) |
49 { |
49 { |
50 QLayoutItem* item = this->ui.matrixLayout->itemAtPosition(i, j); |
50 QLayoutItem* item = this->ui.matrixLayout->itemAtPosition(i, j); |
51 QDoubleSpinBox* spinbox = item ? qobject_cast<QDoubleSpinBox*>(item->widget()) : nullptr; |
51 QDoubleSpinBox* spinbox = item ? qobject_cast<QDoubleSpinBox*>(item->widget()) : nullptr; |
52 spinbox->blockSignals(true); |
52 withSignalsBlocked(spinbox, [&]() |
53 spinbox->setValue(reference->transformationMatrix()(i, j)); |
53 { |
54 spinbox->blockSignals(false); |
54 spinbox->setValue(reference->transformationMatrix()(i, j)); |
|
55 }); |
55 connect( |
56 connect( |
56 spinbox, |
57 spinbox, |
57 qOverload<double>(&QDoubleSpinBox::valueChanged), |
58 qOverload<double>(&QDoubleSpinBox::valueChanged), |
58 this, |
59 this, |
59 &SubfileReferenceEditor::matrixChanged |
60 &SubfileReferenceEditor::matrixChanged |
84 |
85 |
85 // Fill in the initial scaling values |
86 // Fill in the initial scaling values |
86 for (int column : {0, 1, 2}) |
87 for (int column : {0, 1, 2}) |
87 { |
88 { |
88 QDoubleSpinBox* spinbox = this->vectorElement(column); |
89 QDoubleSpinBox* spinbox = this->vectorElement(column); |
89 spinbox->blockSignals(true); |
90 withSignalsBlocked(spinbox, [&]() |
90 spinbox->setValue(this->matrixScaling(column)); |
91 { |
91 spinbox->blockSignals(false); |
92 spinbox->setValue(this->matrixScaling(column)); |
|
93 }); |
92 } |
94 } |
93 } |
95 } |
94 |
96 |
95 SubfileReferenceEditor::~SubfileReferenceEditor() |
97 SubfileReferenceEditor::~SubfileReferenceEditor() |
96 { |
98 { |
186 for (int row : {0, 1, 2}) |
188 for (int row : {0, 1, 2}) |
187 { |
189 { |
188 double cellValue = this->matrixCell(row, column)->value(); |
190 double cellValue = this->matrixCell(row, column)->value(); |
189 cellValue *= newScaling / oldScaling; |
191 cellValue *= newScaling / oldScaling; |
190 QDoubleSpinBox* cellWidget = this->matrixCell(row, column); |
192 QDoubleSpinBox* cellWidget = this->matrixCell(row, column); |
191 cellWidget->blockSignals(true); |
193 withSignalsBlocked(cellWidget, [&]() |
192 cellWidget->setValue(cellValue); |
194 { |
193 cellWidget->blockSignals(false); |
195 cellWidget->setValue(cellValue); |
|
196 }); |
194 } |
197 } |
195 } |
198 } |
196 |
199 |
197 break; |
200 break; |
198 } |
201 } |
223 |
226 |
224 try |
227 try |
225 { |
228 { |
226 int column = this->cellPosition(cellWidget).second; |
229 int column = this->cellPosition(cellWidget).second; |
227 QDoubleSpinBox* spinbox = this->vectorElement(column); |
230 QDoubleSpinBox* spinbox = this->vectorElement(column); |
228 spinbox->blockSignals(true); |
231 withSignalsBlocked(spinbox, [&]() |
229 spinbox->setValue(this->matrixScaling(column)); |
232 { |
230 spinbox->blockSignals(false); |
233 spinbox->setValue(this->matrixScaling(column)); |
|
234 }); |
231 } |
235 } |
232 catch (const std::out_of_range&) {} |
236 catch (const std::out_of_range&) {} |
233 } |
237 } |