And moved setting the background to the constructor of SeaScene.
pScene_ = new SeaScene ();
pView_ = new QGraphicsView ();
- QPixmap waves (":/pix/meri.png");
- pScene_->setBackgroundBrush(QBrush(waves));
+
pView_->setScene(pScene_);
setCentralWidget(pView_);
#include <QGraphicsPixmapItem>
#include <QDebug>
#include <QMessageBox>
+#include <QTime>
const QString ghostImageFilename_ = ":/pix/aave.png";
const QString rockImageFilename_ =":/pix/kari.png";
SeaScene::SeaScene(QObject *parent) :
QGraphicsScene(parent)
{
+ //set background
+ QPixmap waves (":/pix/meri.png");
+ waves.scaled(20,20);
+ setBackgroundBrush(QBrush(waves));
+
+ //set random seed
+
+ qsrand(QTime::currentTime().msec()+2); //+2 to avoid setting it to 1
}