change from centimeters to millimeters

This commit is contained in:
ackimixs
2024-04-03 20:21:37 +02:00
parent 716428b593
commit de70d9ca3d
3 changed files with 32 additions and 32 deletions

View File

@@ -18,9 +18,9 @@ TestMode::TestMode(QWidget *parent) : QWidget(parent) {
this->textrad->setAlignment(Qt::AlignCenter);
this->mainLayout->addWidget(textrad);
this->X = new TestModeBtn("X", 0, 150, this);
this->X = new TestModeBtn("X", 0, 1500, this);
this->mainLayout->addWidget(X);
this->Y = new TestModeBtn("Y", 0, 300, this);
this->Y = new TestModeBtn("Y", 0, 3000, this);
this->mainLayout->addWidget(Y);
this->Theta = new TestModeBtn("θ", -180, 180, this);
this->mainLayout->addWidget(Theta);

View File

@@ -10,45 +10,45 @@ TestModeBtn::TestModeBtn(const QString &name, const int min, const int max, QWid
this->valueLabel = new QLabel(QString::number(this->value), this);
this->valueLabel->setStyleSheet("font-size: 24px; font-weight: bold; color: black;");
this->increment = new QPushButton("+", this);
this->increment->setStyleSheet("background-color: #5FC8E6; border-radius: 20px; height: 46px; width: 46px; color: black;");
this->increment->setBaseSize(46, 46);
this->decrement = new QPushButton("-", this);
this->decrement->setStyleSheet("background-color: #5FC8E6; border-radius: 20px; height: 46px; width: 46px; color: black;");
this->decrement->setBaseSize(46, 46);
this->increment10 = new QPushButton("+10", this);
this->increment10->setStyleSheet("background-color: #5FC8F6; border-radius: 20px; height: 46px; width: 46px; color: black;");
this->increment10->setStyleSheet("background-color: #5FC8E6; border-radius: 20px; height: 46px; width: 46px; color: black;");
this->increment10->setBaseSize(46, 46);
this->decrement10 = new QPushButton("-10", this);
this->decrement10->setStyleSheet("background-color: #5FC8F6; border-radius: 20px; height: 46px; width: 46px; color: black;");
this->decrement10->setStyleSheet("background-color: #5FC8E6; border-radius: 20px; height: 46px; width: 46px; color: black;");
this->decrement10->setBaseSize(46, 46);
connect(this->decrement, &QPushButton::pressed, this, [=]()
{
if (this->value > this->borne.min)
{
this->value--;
this->valueLabel->setText(QString::number(this->value));
}
});
this->increment100 = new QPushButton("+100", this);
this->increment100->setStyleSheet("background-color: #5FC8F6; border-radius: 20px; height: 46px; width: 46px; color: black;");
this->increment100->setBaseSize(46, 46);
connect(this->increment, &QPushButton::pressed, this, [=]()
this->decrement100 = new QPushButton("-100", this);
this->decrement100->setStyleSheet("background-color: #5FC8F6; border-radius: 20px; height: 46px; width: 46px; color: black;");
this->decrement100->setBaseSize(46, 46);
connect(this->decrement10, &QPushButton::pressed, this, [=]()
{
if (this->value < this->borne.max)
if (this->value - 10 > this->borne.min)
{
this->value++;
this->value-=10;
this->valueLabel->setText(QString::number(this->value));
}
});
connect(this->increment10, &QPushButton::pressed, this, [=]()
{
if (this->value + 10 <= this->borne.max)
if (this->value + 10 < this->borne.max)
{
this->value += 10;
this->value+=10;
this->valueLabel->setText(QString::number(this->value));
}
});
connect(this->increment100, &QPushButton::pressed, this, [=]()
{
if (this->value + 100 <= this->borne.max)
{
this->value += 100;
this->valueLabel->setText(QString::number(this->value));
}
else
@@ -58,11 +58,11 @@ TestModeBtn::TestModeBtn(const QString &name, const int min, const int max, QWid
}
});
connect(this->decrement10, &QPushButton::pressed, this, [=]()
connect(this->decrement100, &QPushButton::pressed, this, [=]()
{
if (this->value - 10 >= this->borne.min)
if (this->value - 100 >= this->borne.min)
{
this->value -= 10;
this->value -= 100;
this->valueLabel->setText(QString::number(this->value));
}
else
@@ -73,11 +73,11 @@ TestModeBtn::TestModeBtn(const QString &name, const int min, const int max, QWid
});
layout->addWidget(textLabel);
layout->addWidget(decrement100);
layout->addWidget(decrement10);
layout->addWidget(decrement);
layout->addWidget(valueLabel);
layout->addWidget(increment);
layout->addWidget(increment10);
layout->addWidget(increment100);
}
void TestModeBtn::setBorne(const int min, const int max)

View File

@@ -18,10 +18,10 @@ private:
QHBoxLayout *layout;
QLabel *textLabel;
QLabel *valueLabel;
QPushButton *decrement100;
QPushButton *decrement10;
QPushButton *decrement;
QPushButton *increment;
QPushButton *increment10;
QPushButton *increment100;
int value = 0;