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:
Overlay
::Overlay( QWidget *parent_p
){
setAutoFillBackground( true );
color.setRgba( FILL_COLOR );
setPalette( pal );
if ( parent_p )
{
resize( parent_p->size() );
}
}
Overlay::Overlay( QWidget *parent_p )
: QWidget( parent_p )
{
setAutoFillBackground( true );
QPalette pal( palette() );
QColor color;
color.setRgba( FILL_COLOR );
pal.setBrush( QPalette::Window, QBrush( color ) );
setPalette( pal );
if ( parent_p )
{
resize( parent_p->size() );
}
}
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?
Bookmarks