My application is running on an embedded platform. There is a home screen that has a stacked widget that lets you switch between different modes. I display a dialog in the center of the screen for things like setup and alarms. Currently I try to darken the background by drawing a translucent widget over the home sceen and then the dialog over that. Here is the code for my overlay widget:

Qt Code:
  1. Overlay::Overlay( QWidget *parent_p )
  2. : QWidget( parent_p )
  3. {
  4. setAutoFillBackground( true );
  5.  
  6. QPalette pal( palette() );
  7. QColor color;
  8. color.setRgba( FILL_COLOR );
  9. pal.setBrush( QPalette::Window, QBrush( color ) );
  10.  
  11. setPalette( pal );
  12.  
  13. if ( parent_p )
  14. {
  15. resize( parent_p->size() );
  16. }
  17. }
To copy to clipboard, switch view to plain text mode 

This is really slow to draw and clear. Does anyone have a better solution for darkening the widgets behind a dialog?