Hello, everyone.
I'm new to Qt-programming and have the following problem:

Qt Code:
  1. MyClassConstructor::MyClassConstructor( QWidget* parent )
  2. : QWidget( parent )
  3. {
  4. QScrollArea* area = new QScrollArea;
  5. QWidget* w = new QWidget;
  6.  
  7. QVBoxLayout* layout = new QVBoxLayout;
  8. layout->addWidget( area );
  9.  
  10. w->resize( 500, 500 );
  11. QPalette p( m_table->palette() );
  12. p->setColor( QPalette::Window, Qt::red );
  13.  
  14. area->setWidget( w );
  15. area->viewport()->setAutoFillBackground( true );
  16. // area->viewport()->setStyleSheet( "QWidget{background:green}" );
  17. area->viewport()->setPalette( p );
  18.  
  19. this->setLayout( layout );
  20. }
To copy to clipboard, switch view to plain text mode 

If I uncomment the line with setStyleSheet, the widget is wonderful red. But using the QPalette won't give a result.
What is thing, I do not understand?
I'm new here, so I hope I respect the rules of the forum.
Thank you.