diff --git a/src/dde-dock-plugins/recordtime/timewidget.cpp b/src/dde-dock-plugins/recordtime/timewidget.cpp index 11f04748e..342d4f54f 100755 --- a/src/dde-dock-plugins/recordtime/timewidget.cpp +++ b/src/dde-dock-plugins/recordtime/timewidget.cpp @@ -37,7 +37,8 @@ TimeWidget::TimeWidget(DWidget *parent): m_position(-1), m_hover(false), m_pressed(false), - m_systemVersion(0) + m_systemVersion(0), + m_timerCount(0) { m_systemVersion = DSysInfo::minorVersion().toInt() ; qInfo() << "Current system version: " << m_systemVersion; @@ -132,6 +133,7 @@ QSize TimeWidget::sizeHint() const void TimeWidget::onTimeout() { + m_timerCount++; if (m_bRefresh) { if (m_currentIcon == m_lightIcon) m_currentIcon = m_shadeIcon; @@ -140,8 +142,7 @@ void TimeWidget::onTimeout() } m_bRefresh = !m_bRefresh; QTime showTime(0, 0, 0); - int time = m_baseTime.secsTo(QTime::currentTime()); - showTime = showTime.addSecs(time); + showTime = showTime.addMSecs(m_timerCount * 400); m_showTimeStr = showTime.toString("hh:mm:ss"); update(); } @@ -411,6 +412,7 @@ void TimeWidget::start() connect(m_timer, SIGNAL(timeout()), this, SLOT(onTimeout())); m_baseTime = QTime::currentTime(); m_timer->start(400); + m_timerCount = 0; } void TimeWidget::stop() diff --git a/src/dde-dock-plugins/recordtime/timewidget.h b/src/dde-dock-plugins/recordtime/timewidget.h index f15ee5742..317e9e6f4 100755 --- a/src/dde-dock-plugins/recordtime/timewidget.h +++ b/src/dde-dock-plugins/recordtime/timewidget.h @@ -106,7 +106,7 @@ private slots: bool m_hover; bool m_pressed; int m_systemVersion; - + int m_timerCount; /** * @brief m_lightIcon1070 1070下录屏计时图标icon */