PDA

View Full Version : image.load



Arend
20th May 2013, 16:26
Hi,

I have copied the breakout game from the website http://www.zetcode.com/gui/qt4/breakoutgame.
But I don't see the images, what am I doing wrong?

Regards,
Arend



#include "brick.h"
#include <iostream>
#include <QDebug>

Brick::Brick(int x, int y)
{
image.load("brick.png");
destroyed = FALSE;
rect = image.rect();
qDebug()<<rect;
rect.translate(x, y);
}


etc.

wysota
20th May 2013, 17:38
It's likely because you are using relative file path to the image. If the current working directory when the application is launched is different than the directory where the image is located, the path will not be correct and the image will fail to load.

Arend
20th May 2013, 19:52
Thnx, that's what I need.