Skip to content

Commit

Permalink
set timer to high precision
Browse files Browse the repository at this point in the history
  • Loading branch information
codelol committed Jul 12, 2014
1 parent e0b3ab9 commit cef130b
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions dialog.cpp
Expand Up @@ -19,6 +19,8 @@ Dialog::Dialog(QWidget *parent) :
button = this->findChild<QPushButton *>("controlButton");

timer = new QTimer(this);
timer->setTimerType(Qt::PreciseTimer);

colorIdx = 0;

initialBackgroundColor = this->palette().color(QPalette::Window).toRgb();
Expand Down

2 comments on commit cef130b

@dcfranca
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I saw your related problem about QTimer precision, and how it lose precision while running in background, this code fixed it? And it seems that there's no equivalent in QML Timer type.

@codelol
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this code fixed it.
And about the problem: the timer basically runs slowly than it should while in background. Forgot if it only happened on Windows or Mac, or both.

Please sign in to comment.