83 ); |
83 ); |
84 } |
84 } |
85 |
85 |
86 // Connect various widgets so that changing them changes the primitive object. |
86 // Connect various widgets so that changing them changes the primitive object. |
87 connect( |
87 connect( |
88 ui.segments, |
88 ui.section, |
89 qOverload<int>(&QSpinBox::valueChanged), |
89 &CircularSectionEditor::sectionChanged, |
90 [&](int newSegments) |
90 [&](const CircularSection& newSection) |
91 { |
91 { |
92 if (this->primitive) |
92 if (this->primitive) |
93 this->primitive->setSegments(newSegments); |
93 this->primitive->setSection(newSection); |
94 } |
|
95 ); |
|
96 connect( |
|
97 ui.divisions, |
|
98 &QComboBox::currentTextChanged, |
|
99 [&](const QString& newDivisions) |
|
100 { |
|
101 if (this->primitive) |
|
102 this->primitive->setDivisions(newDivisions.toInt()); |
|
103 } |
94 } |
104 ); |
95 ); |
105 connect( |
96 connect( |
106 ui.color, |
97 ui.color, |
107 &ColorButton::colorChanged, |
98 &ColorButton::colorChanged, |
174 button->setChecked(primitive->primitiveType() == mapping.primitiveType); |
165 button->setChecked(primitive->primitiveType() == mapping.primitiveType); |
175 }); |
166 }); |
176 } |
167 } |
177 |
168 |
178 // Set the values of the form. |
169 // Set the values of the form. |
179 withSignalsBlocked(ui.segments, [&](){ ui.segments->setValue(primitive->segments()); }); |
170 withSignalsBlocked(ui.section, [&](){ ui.section->setSection(primitive->section()); }); |
180 withSignalsBlocked(ui.divisions, [&]() |
|
181 { |
|
182 ui.divisions->setCurrentText(QString::number(primitive->divisions())); |
|
183 }); |
|
184 withSignalsBlocked(ui.color, [&](){ ui.color->setColor(primitive->color()); }); |
171 withSignalsBlocked(ui.color, [&](){ ui.color->setColor(primitive->color()); }); |
185 withSignalsBlocked(ui.matrix, [&](){ ui.matrix->setMatrix(primitive->transformationMatrix()); }); |
172 withSignalsBlocked(ui.matrix, [&](){ ui.matrix->setMatrix(primitive->transformationMatrix()); }); |
186 withSignalsBlocked(ui.inverted, [&](){ ui.inverted->setChecked(primitive->isInverted()); }); |
173 withSignalsBlocked(ui.inverted, [&](){ ui.inverted->setChecked(primitive->isInverted()); }); |
187 } |
174 } |
188 } |
175 } |