title: QImage out of memory
body: <p>I have sub-classed QGLWidget and I show an image in it.</p>
  
  <p>For small images (let's say 1200*1000) it works fine.</p>
  
  <p>For bigger ones (10000 * 6000) it crashes.</p>
  
  <pre><code>MyGLWidget::MyGLWidget(QImage* image, QWidget *parent) : QGLWidget(parent)
  {
      // ...
      _data = *image;
      _gldata = QGLWidget::convertToGLFormat(_data); // Crash at this point.
      // ...
  }
  </code></pre>
  
  <p>Error:</p>
  
  <pre><code>QImage: out of memory, returning null image
  ASSERT: "dst.depth() == 32" in file qgl.cpp, line 2094
  </code></pre>
  
  <p>I have 8GB of memory, the application takes max. 1GB.</p>
  
  <p>What can I do?</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>Ok, assuming that I run out of RAM, how do I catch this error?</p>
  
  <pre><code>try
  {
      _gldata = QGLWidget::convertToGLFormat(_data);
  }
  catch(...)
  {
      qDebug() &lt;&lt; "e.what()";
  }
  </code></pre>
  
  <p>It look's like it's not an exception.</p>