I'm making simple 2D game (maze) and I am using QGraphicsView, QGraphicsScene and QGraphicsGridLayout to manage tiles into grid.
Map is represented by string (# is wall, . is empty field...).
So I'm going through this string, creating labels with pixmap and inserting them into grid layout:
QLabel *label;
QGraphicsProxyWidget *widget;
...
for (..) {
for (..) {
label = new QLabel();
label->setPixmap(QPixmap(":/new/images/img/w.png"));
widget = scene->addWidget(label);
layout->addItem(widget, i, j);
}
}
where scene is QGraphicsScene and layout is QGraphicsGridLayout. It works fine but I have problems with transparent background of pixmaps. Each pixmap consists of some shape and transparent backgroud. When I try to display label on main widget (QDialog window), everything is ok. But after inserting into the scene, its background is grey.
I tried it without grid layer (only graphicsview and scene) but result was same.
Is there any way to set background of scene's items transparent?