feat: Update WaveWidget wave time

This commit is contained in:
sunwen
2025-03-24 14:50:45 +08:00
parent 44b073c97b
commit 0edb49da86
2 changed files with 10 additions and 7 deletions

View File

@@ -227,13 +227,17 @@ void WaveWidget::stopCharge()
void WaveWidget::updaterWater()
{
mYOffset += 0.3;//波浪偏移
mValue += mWaveDirection * 0.025;
if (mValue >= 51 || mValue <0)
if(mWaveDirection == UpWaveDirection && mValue >48)
{
mYOffset = 0;
//d->value=0;
disconnect(mTimer, &QTimer::timeout, this, &WaveWidget::updaterWater);
emit closeSwitch();
update();
return;
}
if(mWaveDirection == DownWaveDirection && mValue <2)
{
update();
return;
}
mValue += mWaveDirection * 0.05;
update();
}

View File

@@ -45,7 +45,6 @@ public slots:
void stopCharge();
Q_SIGNALS:
void valueChanged(int aValue);
void closeSwitch();
private:
QTimer* mTimer;