I have a QGraphicsScene in a QGraphicsView that displays a scaled pixmap. For some reason, when the pixmap is larger than 32,767 pixels (max value of type int), it fails to show up at all or sometimes partially shows up.

The QGraphicsView documentation for QT5 says:

Note that although the scene supports a virtually unlimited size, the range of the scroll bars will never exceed the range of an integer (INT_MIN, INT_MAX).


However, I should be able to display a pixmap larger than 32,767 pixels because I printed INT_MIN and INT_MAX and they are INT_MIN = -2147483648, INT_MAX = 2147483647 on my system (I'm running an Intel processor on Ubuntu 14.04). What could cause the pixmap to not show up when it gets larger than 32,767 pixels in one dimension? As long as it's below 32,767 pixels, the image displays properly. Is this a bug in Qt? Code below.

Qt Code:
  1. // Transformation matrix
  2. QMatrix matrix;
  3. if(!time_vertical) {
  4. matrix.scale(1, -1);
  5. matrix.rotate(90);
  6. }
  7. matrix.scale(frequency_zoom, time_zoom);
  8. // Create pixmap
  9. pixmap.convertFromImage(*image);
  10. pixmap = pixmap.transformed(matrix);
  11. // Add pixmap to scene
  12. scene->clear();
  13. QGraphicsPixmapItem* item = scene->addPixmap(pixmap);
  14. item->setPos(0, 0); // Set pixmap origin (0, 0) in scene coordinates
  15. scene->setSceneRect(pixmap.rect());
To copy to clipboard, switch view to plain text mode