kuko
19th August 2012, 08:02
Hi everyone,
I created a QMainWindow app using Qt Creator 2.4.1 and Qt SDK 1.2.1. The app only have a QScrollArea. In the QMainWindow constructor I did:
QPalette palette;
QString appdir = QApplication::applicationDirPath();
QImage imgfondo;
imgfondo.load( appdir + "/imagenes/fondo_aplicacion.jpg" );
palette.setBrush( this->backgroundRole(), QBrush(imgfondo) );
this->setPalette( palette );
this->resize( imgfondo.width(), imgfondo.height() );
The image "fondo_aplicacion.jpg" is 1000 x 800 pixel image.
The scrollarea is inside MainWindow with no special values. I just dragged the QScrollArea object and dropped inside the form (using Qt Designer).
When I run the app the background image is ok on MainWindow but in the scrollarea the background image is not ok, It was like the background image is repainted again inside it. When I run the app I get this:
8132
Actually, I try to find how the draw works over widgets, because if I use a QFrame instead of QScrollArea there's no problem.
Thanks to anyone who try to help.
I created a QMainWindow app using Qt Creator 2.4.1 and Qt SDK 1.2.1. The app only have a QScrollArea. In the QMainWindow constructor I did:
QPalette palette;
QString appdir = QApplication::applicationDirPath();
QImage imgfondo;
imgfondo.load( appdir + "/imagenes/fondo_aplicacion.jpg" );
palette.setBrush( this->backgroundRole(), QBrush(imgfondo) );
this->setPalette( palette );
this->resize( imgfondo.width(), imgfondo.height() );
The image "fondo_aplicacion.jpg" is 1000 x 800 pixel image.
The scrollarea is inside MainWindow with no special values. I just dragged the QScrollArea object and dropped inside the form (using Qt Designer).
When I run the app the background image is ok on MainWindow but in the scrollarea the background image is not ok, It was like the background image is repainted again inside it. When I run the app I get this:
8132
Actually, I try to find how the draw works over widgets, because if I use a QFrame instead of QScrollArea there's no problem.
Thanks to anyone who try to help.