Important: Please read the Qt Code of Conduct -

Unexpected behaviour for QPixmap on QGraphicsScene

  • Having developed a previous program in QT for a course of mine, I now thought about doing a project for myself. This will be a small game, just to keep busy. I've set up my GUI and everything is fine, but now I'm trying to show a small *.png and it comes out all... pixelly. To illustrate, I've added a small screenshot. In this screenshot, two things are being drawn.

    The background is a QGraphicsView with a QGraphicsScene.
    On the latter, I use the addLine and addPixmap funtions. For the line I've made a custom pen with width 8 and color black. The Pixmap uses a small *.png I've found on the net. Both come out pixelly (lacking a better word).

    Where should I look in solving this issue...? Any help is highly appreciated.!!

  • I've never seen anything like this, but here's a few things I'd check:

    -) Are any transformations set on those items?
    -) Is a transformation set on the GraphicsView?
    -) Which rendering engine are you using? Raster? OpenGL?
    -) Is anti aliasing enabled or disabled?
    -) What happens if, instead of using QGraphicsLineItem and QGraphicsPixmapItem (I'm just guessing that you use those), use a custom QGraphicsItem and do your own painting?

  • After trying a lot of different things, I decided to rebuild the project (I had only just started). After rebuilding it, no problems anymore... I must have screwed something somewhere during the initial design of the form, I suspect. Any ways, thanks Asperamanca for your reply.

Log in to reply