60 return this->ui.type->currentData().value<CircularPrimitive::Type>(); |
60 return this->ui.type->currentData().value<CircularPrimitive::Type>(); |
61 } |
61 } |
62 |
62 |
63 void CircleToolOptionsWidget::handleInputChange() |
63 void CircleToolOptionsWidget::handleInputChange() |
64 { |
64 { |
65 const int olddivs = this->ui.segments->maximum(); |
65 const unsigned int olddivs = unsigned_cast(this->ui.segments->maximum()); |
66 const int newdivs = this->divisions(); |
66 const unsigned int newdivs = this->divisions(); |
67 if (olddivs != newdivs) { |
67 if (olddivs != newdivs) { |
68 this->ui.segments->setMaximum(newdivs); |
68 this->ui.segments->setMaximum(signed_cast(newdivs)); |
69 this->ui.segments->setValue(this->segments() * newdivs / olddivs); |
69 this->ui.segments->setValue(signed_cast(this->segments() * newdivs / olddivs)); |
70 } |
70 } |
71 const qreal ratio = static_cast<qreal>(this->segments()) / newdivs; |
71 const qreal ratio = static_cast<qreal>(this->segments()) / newdivs; |
72 this->ui.ratio->setText(QString::number(ratio, 'g', 4)); |
72 this->ui.ratio->setText(QString::number(ratio, 'g', 4)); |
73 Q_EMIT this->optionsChanged(CircleToolOptions{ |
73 Q_EMIT this->optionsChanged(CircleToolOptions{ |
74 .fraction = CircularFraction{this->segments(), this->divisions()}, |
74 .fraction = CircularFraction{this->segments(), this->divisions()}, |