QTfrontend/ui/widget/bgwidget.cpp
changeset 6574 ec059b55aa72
parent 6243 9777d802be1a
child 6579 fc52f7c22c9b
--- a/QTfrontend/ui/widget/bgwidget.cpp	Sun Jan 15 23:14:10 2012 +0100
+++ b/QTfrontend/ui/widget/bgwidget.cpp	Sun Jan 15 23:35:02 2012 +0100
@@ -82,7 +82,7 @@
     fX = qrand() % (wParent->width() + 1);
 }
 
-BGWidget::BGWidget(QWidget * parent) : QWidget(parent)
+BGWidget::BGWidget(QWidget * parent) : QWidget(parent), enabled(false)
 {
     setAttribute(Qt::WA_NoSystemBackground, true);
     sprite.load(":/res/Star.png");
@@ -123,6 +123,8 @@
 void BGWidget::paintEvent(QPaintEvent *event)
 {
     Q_UNUSED(event);
+    if (!enabled)
+        return;
 
     QPainter p;
 
@@ -139,6 +141,9 @@
 
 void BGWidget::animate()
 {
+    if (!enabled)
+        return;
+
     for (int i = 0; i < SPRITE_MAX; i++)
     {
         QPoint oldPos = spritePositions[i]->pos();
@@ -159,6 +164,7 @@
 void BGWidget::stopAnimation()
 {
     timerAnimation->stop();
+    repaint();
 }
 
 void BGWidget::init()