I would like to add that when you add a ScrollArea object, Qt Designer add a ScrollAreaContainer objecto too. Maybe this is why scrollarea (or scrollareacontainer) background is repainted. I would like to find a way to make scrollarea background "transparent" to avoid this effect on MainWindow background.
By the way, I have to use a scrollarea because I have to display a image. Actually I load a image in a QLabel object which is created inside ScrollArea.. but the image in the QLabel doesn't cover totally the effect of the scrollarea background image.
I hope this new information will be useful to help me.
Thanks.
Added after 42 minutes:
Hi every one,
I found a solution, but I think it's not a elegant solution. I created a new image call "fondo_transparente.png" which is an 30 x 30 image (the size doesn't matter) with transparent property. So I set this image as scrollarea background and that's it.. works fine. I think this is not a pretty solution but it works for now. This is app running after my changes..
Screenshot from 2012-08-19 12:16:20.jpg
QImage imgfondo
( appdir
+ "/imagenes/fondo_aplicacion.jpg" );
palette.
setBrush( this
->backgroundRole
(),
QBrush(imgfondo
) );
this->setPalette( palette );
this->resize( imgfondo.width(), imgfondo.height() );
QImage imgfondoscroll
( appdir
+ "/imagenes/fondo_transparente.png" );
palette.setBrush( this->ui->scaSemanario->backgroundRole(), imgfondoscroll );
this->ui->scaSemanario->setPalette( palette );
QPalette palette;
QString appdir = QApplication::applicationDirPath();
QImage imgfondo( appdir + "/imagenes/fondo_aplicacion.jpg" );
palette.setBrush( this->backgroundRole(), QBrush(imgfondo) );
this->setPalette( palette );
this->resize( imgfondo.width(), imgfondo.height() );
QImage imgfondoscroll( appdir + "/imagenes/fondo_transparente.png" );
palette.setBrush( this->ui->scaSemanario->backgroundRole(), imgfondoscroll );
this->ui->scaSemanario->setPalette( palette );
To copy to clipboard, switch view to plain text mode
I'll try to figure out what this happen and what I have to do to solve it.
Thanks to everyone. I hope my partial solution will be useful for others.
Bookmarks