PDA

View Full Version : Image don't appear in the window.



vitaR
14th March 2014, 06:55
Hi, I Have a question and looking for suggestions if you can.

I'm trying to load a maze, but I can't even show a single Image in the window.
What I'm doing wrong?


#include <QApplication>
#include <QGraphicsView>
#include <QGraphicsScene>
#include <QGraphicsPixmapItem>
#include <QMainWindow>


int main(int argc, char *argv[])
{
QApplication a(argc, argv);

QGraphicsScene scene(-350, -350, 700, 700);
QPixmap imagen("E:\Data\Pictures\PixelArt\60px-Brick.png");
QGraphicsPixmapItem *newImagen = new QGraphicsPixmapItem(imagen);
scene.addItem(newImagen);
newImagen->setPos(5.0,5.0);

QGraphicsView *view= new QGraphicsView(&scene);
view->show();
return a.exec();
}

And if you got any suggestions on how to do load a maze, I already got one answer from an user, but if you got other suggestions, I'll appreciate it.

ChrisW67
14th March 2014, 07:11
Line 13 is wrong. Escape the backslashes or use forward slashes.