mirror of
https://github.com/modelec/ihm.git
synced 2026-03-18 21:30:52 +01:00
this
This commit is contained in:
@@ -13,80 +13,80 @@ public:
|
||||
this->layout = new QHBoxLayout(this);
|
||||
this->layout->setAlignment(Qt::AlignCenter);
|
||||
|
||||
this->Text = new QLabel(name, this);
|
||||
Text->setStyleSheet("font-size: 24px; font-weight: bold; color: black;");
|
||||
this->textLabel = new QLabel(name, this);
|
||||
textLabel->setStyleSheet("font-size: 24px; font-weight: bold; color: black;");
|
||||
|
||||
Value = new QLabel(QString::number(this->value), this);
|
||||
Value->setStyleSheet("font-size: 24px; font-weight: bold; color: black;");
|
||||
this->valueLabel = new QLabel(QString::number(this->value), this);
|
||||
this->valueLabel->setStyleSheet("font-size: 24px; font-weight: bold; color: black;");
|
||||
|
||||
Increment = new QPushButton("+", this);
|
||||
Increment->setStyleSheet("background-color: #5FC8E6; border-radius: 20px; height: 46px; width: 46px; color: black;");
|
||||
Increment->setBaseSize(46, 46);
|
||||
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);
|
||||
|
||||
Decrement = new QPushButton("-", this);
|
||||
Decrement->setStyleSheet("background-color: #5FC8E6; border-radius: 20px; height: 46px; width: 46px; color: black;");
|
||||
Decrement->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);
|
||||
|
||||
Increment10 = new QPushButton("+10", this);
|
||||
Increment10->setStyleSheet("background-color: #5FC8F6; border-radius: 20px; height: 46px; width: 46px; color: black;");
|
||||
Increment10->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->setBaseSize(46, 46);
|
||||
|
||||
Decrement10 = new QPushButton("-10", this);
|
||||
Decrement10->setStyleSheet("background-color: #5FC8F6; border-radius: 20px; height: 46px; width: 46px; color: black;");
|
||||
Decrement10->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->setBaseSize(46, 46);
|
||||
|
||||
connect(this->Decrement, &QPushButton::pressed, this, [=]()
|
||||
connect(this->decrement, &QPushButton::pressed, this, [=]()
|
||||
{
|
||||
if (this->value > this->borne.min)
|
||||
{
|
||||
this->value--;
|
||||
this->Value->setText(QString::number(this->value));
|
||||
this->valueLabel->setText(QString::number(this->value));
|
||||
}
|
||||
});
|
||||
|
||||
connect(this->Increment, &QPushButton::pressed, this, [=]()
|
||||
connect(this->increment, &QPushButton::pressed, this, [=]()
|
||||
{
|
||||
if (this->value < this->borne.max)
|
||||
{
|
||||
this->value++;
|
||||
this->Value->setText(QString::number(this->value));
|
||||
this->valueLabel->setText(QString::number(this->value));
|
||||
}
|
||||
});
|
||||
|
||||
connect(this->Increment10, &QPushButton::pressed, this, [=]()
|
||||
connect(this->increment10, &QPushButton::pressed, this, [=]()
|
||||
{
|
||||
if (this->value + 10 <= this->borne.max)
|
||||
{
|
||||
this->value += 10;
|
||||
this->Value->setText(QString::number(this->value));
|
||||
this->valueLabel->setText(QString::number(this->value));
|
||||
}
|
||||
else
|
||||
{
|
||||
this->value = this->borne.max;
|
||||
this->Value->setText(QString::number(this->value));
|
||||
this->valueLabel->setText(QString::number(this->value));
|
||||
}
|
||||
});
|
||||
|
||||
connect(this->Decrement10, &QPushButton::pressed, this, [=]()
|
||||
connect(this->decrement10, &QPushButton::pressed, this, [=]()
|
||||
{
|
||||
if (this->value - 10 >= this->borne.min)
|
||||
{
|
||||
this->value -= 10;
|
||||
this->Value->setText(QString::number(this->value));
|
||||
this->valueLabel->setText(QString::number(this->value));
|
||||
}
|
||||
else
|
||||
{
|
||||
this->value = this->borne.min;
|
||||
this->Value->setText(QString::number(this->value));
|
||||
this->valueLabel->setText(QString::number(this->value));
|
||||
}
|
||||
});
|
||||
|
||||
layout->addWidget(Text);
|
||||
layout->addWidget(Decrement10);
|
||||
layout->addWidget(Decrement);
|
||||
layout->addWidget(Value);
|
||||
layout->addWidget(Increment);
|
||||
layout->addWidget(Increment10);
|
||||
layout->addWidget(textLabel);
|
||||
layout->addWidget(decrement10);
|
||||
layout->addWidget(decrement);
|
||||
layout->addWidget(valueLabel);
|
||||
layout->addWidget(increment);
|
||||
layout->addWidget(increment10);
|
||||
}
|
||||
|
||||
void setBorne(const int min, const int max)
|
||||
@@ -101,13 +101,14 @@ public:
|
||||
|
||||
private:
|
||||
QHBoxLayout *layout;
|
||||
QLabel *Text;
|
||||
QPushButton *Decrement;
|
||||
QLabel *Value;
|
||||
QPushButton *Increment;
|
||||
QLabel *textLabel;
|
||||
QLabel *valueLabel;
|
||||
QPushButton *decrement10;
|
||||
QPushButton *decrement;
|
||||
QPushButton *increment;
|
||||
QPushButton *increment10;
|
||||
|
||||
int value = 0;
|
||||
QPushButton *Increment10;
|
||||
QPushButton *Decrement10;
|
||||
|
||||
struct Borne
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user