title: QGraphicsItem scaling produces too large bounding rect
body: <p>Problem: When using a <code>QGraphicsItem</code> with the flag <code>QGraphicsItem::ItemIgnoresTransformations</code>, the View does not scale properly and shows unnecessary scroll bars.</p>
  
  <p>To reproduce, place a <code>QGraphicsView</code> on a Form and use this code:</p>
  
  <pre><code>#include &lt;QGraphicsScene&gt;
  #include &lt;QGraphicsTextItem&gt;
  
  MainWindow::MainWindow(QWidget *parent) :
      QMainWindow(parent),
      ui(new Ui::MainWindow)
  {
      ui-&gt;setupUi(this);
  
      QGraphicsScene* scene = new QGraphicsScene();
  
      // Set the scene to the view. Has to be done before
      // transformation in order for the problem to occur.
      ui-&gt;graphicsView-&gt;setScene(scene);
  
      // Add some text, make it transformation-invariant.
      QGraphicsTextItem* txt = scene-&gt;addText("Hello World!");
      txt-&gt;setFlag(QGraphicsItem::ItemIgnoresTransformations);
  
      // Scale the scene, re-calculate the bounding rect.
      ui-&gt;graphicsView-&gt;scale(10, 5);
      QRectF rect = scene-&gt;itemsBoundingRect();
      scene-&gt;setSceneRect(rect);
  }
  </code></pre>
  
  <p>This also works with other Items like <code>QGraphicsEllipseItem</code> or <code>QGraphicsRectItem</code>.</p>
  
  <p>Without setting the flag (simply comment out the line <code>txt-&gt;setFlag...</code>), the output is as expected:</p>
  
  <p><a href="https://i.stack.imgur.com/gtXfi.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/gtXfi.png" alt="This is what the text looks like when being normally scaled."></a></p>
  
  <p>However, when the flag is set, I would expect the scroll bar to disappear, because the text clearly fits into the view. But instead it looks like this:</p>
  
  <p><a href="https://i.stack.imgur.com/9fuIM.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/9fuIM.png" alt="This is what the text looks like when ignoring transformation."></a></p>
  
  <p>I know that the Scene does only automatically grow, but not shrink to its content, so I am explicitly setting the Scene Rect at the end. But even this does not help.</p>
  
  <p>It seems to me like this is a bug in Qt, but maybe I also simply misunderstood something. Any idea what the problem (and solution) is?</p>
  
  <p>Using Qt 5.5, Ubuntu 14.04.</p>
  
  <p>PS: Yes, the scene is never freed. This is of course no production code ;-)</p>