title: QScrollArea widget content promoted to QWidget
body: <p>First of all, thanks for you time reading my question.</p>
  
  <p>I created my own Qt Widget (parent of QWidget) and has a QImage "inside" to manipulate images. The problem I have is the following: when I promote the content of a QScrollArea (QDesigner) to my widget, the scroll features doesn't works; I haven't any scroll bar or I can't see any result when I use the method 'ensureVisible(..)'.</p>
  
  <p>Please can you tell me if I need to overload or override any method in my own widget.</p>
  
  <p>Regards and thanks in advance,
  Oscar.</p>
  
  <hr>
  
  <p>Code: The intention is use directly myWidget (promoting it in QDesigner) and I don't use directly a QImage 'cos I want to save some extra data in the widget.</p>
  
  <pre><code>struct myData
  {
      QImage myImage;
  };
  
  myWidget::myWidget(QWidget* parent, Qt::WFlags fl) : QWidget(parent, fl)
  {
      myData = new myData();
  }
  
  myWidget::~myWidget()
  {
      delete myData;
  }
  
  void myWidget::init(QImage image)
  {
      try
      {
          myData-&gt;myImage = image;
          resize(myData-&gt;myImage-&gt;width, myData-&gt;myImage-&gt;height);
      }
      catch(...)
      {
          QString msg("myWidget::init return error\n");
          qWarning(msg.toLatin1().data());
          return;
      }
  }
  
  QSize myWidget::minimumSize() const {
      return myData-&gt;myImage.size();
  }
  
  QSize myWidget::sizeHint() const {
      return myData-&gt;myImage.size();
  }
  
  void myWidget::paintEvent(QPaintEvent*)
  {
      QPainter painter(this);
      painter.drawImage(myData-&gt;myImage.rect(), myData-&gt;myImage);
  }
  
  void myWidget::mousePressEvent(QMouseEvent *event)
  {
      if (event-&gt;buttons() &amp; Qt::LeftButton) {
          emit mousePress(event-&gt;x(), event-&gt;y());
      }
  }
  
  void myWidget::mouseMoveEvent(QMouseEvent *event)
  {
      if (event-&gt;buttons() &amp; Qt::RightButton) {
          emit mouseMove(event-&gt;x(), event-&gt;y());
      }
  }
  </code></pre>