1
0
Fork 0

GUI: Format code of BackgroundFlickerThread

This commit is contained in:
morsisko 2020-07-09 15:16:35 +02:00 committed by Duncan Ogilvie
parent 3e81b2449f
commit 156b604c46
2 changed files with 52 additions and 52 deletions

View File

@ -1,29 +1,29 @@
#include "BackgroundFlickerThread.h"
#include <Windows.h>
BackgroundFlickerThread::BackgroundFlickerThread(QWidget* widget, QColor& background, QObject* parent) : QThread(parent), background(background)
{
mWidget = widget;
setProperties();
}
void BackgroundFlickerThread::setProperties(int count, int delay)
{
this->count = count;
this->delay = delay;
}
void BackgroundFlickerThread::run()
{
QColor oldColor = background;
for(int i = 0; i < count; i++)
{
background = QColor(Qt::red);
mWidget->update();
Sleep(delay);
background = oldColor;
mWidget->update();
Sleep(delay);
}
}
#include "BackgroundFlickerThread.h"
#include <Windows.h>
BackgroundFlickerThread::BackgroundFlickerThread(QWidget* widget, QColor & background, QObject* parent) : QThread(parent), background(background)
{
mWidget = widget;
setProperties();
}
void BackgroundFlickerThread::setProperties(int count, int delay)
{
this->count = count;
this->delay = delay;
}
void BackgroundFlickerThread::run()
{
QColor oldColor = background;
for(int i = 0; i < count; i++)
{
background = QColor(Qt::red);
mWidget->update();
Sleep(delay);
background = oldColor;
mWidget->update();
Sleep(delay);
}
}

View File

@ -1,23 +1,23 @@
#ifndef BACKGROUNDFLICKERTHREAD_H
#define BACKGROUNDFLICKERTHREAD_H
#include <QThread>
#include <QWidget>
#include <QColor>
class BackgroundFlickerThread : public QThread
{
Q_OBJECT
public:
explicit BackgroundFlickerThread(QWidget* widget, QColor& background, QObject* parent = 0);
void setProperties(int count = 3, int delay = 300);
private:
void run();
QWidget* mWidget;
QColor& background;
int count;
int delay;
};
#endif // BACKGROUNDFLICKERTHREAD_H
#ifndef BACKGROUNDFLICKERTHREAD_H
#define BACKGROUNDFLICKERTHREAD_H
#include <QThread>
#include <QWidget>
#include <QColor>
class BackgroundFlickerThread : public QThread
{
Q_OBJECT
public:
explicit BackgroundFlickerThread(QWidget* widget, QColor & background, QObject* parent = 0);
void setProperties(int count = 3, int delay = 300);
private:
void run();
QWidget* mWidget;
QColor & background;
int count;
int delay;
};
#endif // BACKGROUNDFLICKERTHREAD_H