Fix RollingMessageWidget can not rolling.
This commit is contained in:
@@ -6,8 +6,8 @@
|
||||
|
||||
#include <QLabel>
|
||||
#include <QThread>
|
||||
#include <QDebug>
|
||||
#include <QShowEvent>
|
||||
#include <QTimer>
|
||||
|
||||
namespace {
|
||||
const int WAIT_TIMES = 60;
|
||||
@@ -146,6 +146,11 @@ QString RollingMessageWidget::getNextMessage() {
|
||||
|
||||
void RollingMessageWidget::showEvent(QShowEvent *event) {
|
||||
QWidget::showEvent(event);
|
||||
QTimer::singleShot(1000, this, &RollingMessageWidget::initDelay);
|
||||
}
|
||||
|
||||
void RollingMessageWidget::initDelay()
|
||||
{
|
||||
if (!mInitFlag)
|
||||
{
|
||||
TOTAL_ROLL_DISTANCE = this->width();
|
||||
|
||||
@@ -31,6 +31,7 @@ public:
|
||||
protected:
|
||||
void timerEvent(QTimerEvent* event) override ;
|
||||
void showEvent(QShowEvent *event) override ;
|
||||
void initDelay();
|
||||
QString getNextMessage();
|
||||
private:
|
||||
int mTimerId = -1;
|
||||
|
||||
Reference in New Issue
Block a user