src/ui/circletooloptionswidget.cpp

changeset 250
2837b549e616
parent 233
5509bec02c81
child 264
76a025db4948
--- a/src/ui/circletooloptionswidget.cpp	Wed Jun 22 16:13:15 2022 +0300
+++ b/src/ui/circletooloptionswidget.cpp	Wed Jun 22 16:53:35 2022 +0300
@@ -40,13 +40,13 @@
 
 unsigned int CircleToolOptionsWidget::segments() const
 {
-	return this->ui.segments->value();
+	return unsigned_cast(this->ui.segments->value());
 }
 
 unsigned int CircleToolOptionsWidget::divisions() const
 {
 	bool ok;
-	const int divs = this->ui.divisions->currentText().toInt(&ok);
+	const unsigned int divs = this->ui.divisions->currentText().toUInt(&ok);
 	if (ok) {
 		return divs;
 	}
@@ -62,11 +62,11 @@
 
 void CircleToolOptionsWidget::handleInputChange()
 {
-	const int olddivs = this->ui.segments->maximum();
-	const int newdivs = this->divisions();
+	const unsigned int olddivs = unsigned_cast(this->ui.segments->maximum());
+	const unsigned int newdivs = this->divisions();
 	if (olddivs != newdivs) {
-		this->ui.segments->setMaximum(newdivs);
-		this->ui.segments->setValue(this->segments() * newdivs / olddivs);
+		this->ui.segments->setMaximum(signed_cast(newdivs));
+		this->ui.segments->setValue(signed_cast(this->segments() * newdivs / olddivs));
 	}
 	const qreal ratio = static_cast<qreal>(this->segments()) / newdivs;
 	this->ui.ratio->setText(QString::number(ratio, 'g', 4));

mercurial