I need QScrollArea to contains some images

Qt Code:
  1. TestScrollArea::TestScrollArea(QWidget *parent, Qt::WFlags flags)
  2. : QMainWindow(parent, flags)
  3. {
  4. ui.setupUi(this);
  5.  
  6. QWidget* widget = new QWidget;
  7. QVBoxLayout* layout = new QVBoxLayout( widget);
  8.  
  9. QImage image("D:\\data\\photo\\me\\bg2009.jpg");
  10. Q_ASSERT( image.isNull() == false);
  11.  
  12. QLabel* label1 = new QLabel;
  13. label1->setPixmap( QPixmap::fromImage( image));
  14. layout->addWidget( label1);
  15.  
  16. ui.scrollArea->setBackgroundRole(QPalette::Dark);
  17. ui.scrollArea->setWidget( widget);
  18. }
To copy to clipboard, switch view to plain text mode 

This code was placed to the main window constructor and it worked ok (image displayed). Then I created QScrollArea child class and moved the code to its contructor:

Qt Code:
  1. TestImageViewer::TestImageViewer(QWidget *parent)
  2. : QScrollArea(parent)
  3. {
  4. QWidget* widget = new QWidget;
  5. QVBoxLayout* layout = new QVBoxLayout( widget);
  6.  
  7. QImage image("D:\\data\\photo\\me\\bg2009.jpg");
  8. Q_ASSERT( image.isNull() == false);
  9.  
  10. QLabel* label1 = new QLabel;
  11. label1->setPixmap( QPixmap::fromImage( image));
  12. layout->addWidget( label1);
  13.  
  14. setBackgroundRole(QPalette::Dark);
  15. setWidget( widget);
  16. }
To copy to clipboard, switch view to plain text mode 

Now I see nothing except a grey rectangle. What I'm doing wrong?