Hello,

I'm using qt creator 2.4.1, Qt 4.8 on Ubuntu 10.10.
I need to make a background image resizable for a Qwidget, for the main QWidget i override resizeEvent in the generated file(widget.cpp) and it works fine, now i want to put inside my main QWidget another QWidget and give it a resizable background image as well so i found out the promoting to buid my custom widget (ZoneSup is just a QWidget where i override resizeEvent) .

my custom widget :

Qt Code:
  1. #ifndef ZONESUP_H
  2. #define ZONESUP_H
  3.  
  4. #include <QFrame>
  5. #include <QDebug>
  6. #include <QResizeEvent>
  7. #include <QPixmap>
  8. #include <QPalette>
  9.  
  10.  
  11. class ZoneSup : public QWidget
  12. {
  13. Q_OBJECT
  14.  
  15. public:
  16. ZoneSup(QWidget *parent = 0);
  17.  
  18. protected:
  19. void resizeEvent(QResizeEvent *); // virtual};
  20. };
  21. #endif // ZONESUP_H
To copy to clipboard, switch view to plain text mode 

Qt Code:
  1. #include "zonesup.h"
  2.  
  3. ZoneSup::ZoneSup(QWidget *parent) : QWidget(parent){
  4.  
  5. }
  6.  
  7. void ZoneSup::resizeEvent ( QResizeEvent * event )
  8. {
  9. qDebug() << "ZoneSup::resizeEvent " << event->size().width() << " ," << event->size().height();
  10.  
  11. QPalette palet = palette();
  12. QPixmap backGroundPicture(":/image/bg1.jpg");
  13. QPixmap pixmapBackGround(backGroundPicture.scaled(event->size()));
  14.  
  15. palet.setBrush(QPalette::Background, pixmapBackGround);
  16. setPalette(palet);
  17. }
To copy to clipboard, switch view to plain text mode 

resizevent is called but the background image is not shown.
the same code used for the main QWidget works fine.
I have no error and no warning.

Thanks in advance