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

View File

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