Try translating the image item, or setting an offset, of exactly (0.5, 0.5). This is the only way to ensure that Graphics View's untransformed logical units map perfectly to the center of each pixel in device coordinates. That should remove your smoothing effect, which is caused by OpenGL's subtexel support to cause smoothing as the pixmap is drawn at (-0.5, -0.5). QWidget (not OpenGL) does not support subtexels, so the pixmap will "snap to grid" instead of being smoothed / which is why you don't see this without enabling OpenGL. Note that OpenGL does not guarantee pixel perfection so this is highly hardware and driver dependent.
So, you can 1) translate the item:
pixmapItem->translate(0.5, 0.5);
pixmapItem->translate(0.5, 0.5);
To copy to clipboard, switch view to plain text mode
Or 2) set an offset:
pixmapItem
->setOffset
(QPointF(0.5,
0.5));
pixmapItem->setOffset(QPointF(0.5, 0.5));
To copy to clipboard, switch view to plain text mode
Or 3) translate the view:
view->translate(0.5, 0.5);
view->translate(0.5, 0.5);
To copy to clipboard, switch view to plain text mode
Bookmarks