Thank's for your help wysota! but don't works

i need to charge 2 images:

first-> semi-transparent background
second-> image of keypad

I have to try with QPalette but screen is black.

the code used is:


Qt Code:
  1. //set background
  2. QString wallPaperPath;
  3. wallPaperPath.clear();
  4. wallPaperPath.append(QDir::currentPath());
  5. wallPaperPath.append(WALLPAPER_DIRECTORY);
  6. wallPaperPath.append(KEYPAD_NUMPAD); //this line charge the keypad image but first i use the background image------> wallPaperPath.append(BACKGROUND); in other previus function
  7. //wallPaperPath.append(WALLPAPER);
  8.  
  9. QImage image;
  10. image.load(wallPaperPath,0);
  11. QBrush brush;
  12. brush.setStyle(Qt::SolidPattern);
  13. brush.setTextureImage(image);
  14.  
  15. QPalette palette;
  16. palette.setBrush(QPalette::Active, QPalette::Window, brush);
  17. palette.setBrush(QPalette::Inactive, QPalette::Window, brush);
  18. palette.setBrush(QPalette::Disabled, QPalette::Window, brush);
  19. palette.setBrush(QPalette::Normal, QPalette::Window, brush);
  20. palette.setBrush(QPalette::Current, QPalette::Window, brush);
  21.  
  22. palette.setBrush(QPalette::Active, QPalette::Background, brush);
  23. palette.setBrush(QPalette::Inactive, QPalette::Background, brush);
  24. palette.setBrush(QPalette::Disabled, QPalette::Background, brush);
  25. palette.setBrush(QPalette::Normal, QPalette::Background, brush);
  26. palette.setBrush(QPalette::Current, QPalette::Background, brush);
  27.  
  28. palette.setBrush(QPalette::Active, QPalette::Foreground, brush);
  29. palette.setBrush(QPalette::Inactive, QPalette::Foreground, brush);
  30. palette.setBrush(QPalette::Disabled, QPalette::Foreground, brush);
  31. palette.setBrush(QPalette::Normal, QPalette::Foreground, brush);
  32. palette.setBrush(QPalette::Current, QPalette::Foreground, brush);
  33.  
  34. palette.setBrush(QPalette::Active, QPalette::Base, brush);
  35. palette.setBrush(QPalette::Inactive, QPalette::Base, brush);
  36. palette.setBrush(QPalette::Disabled, QPalette::Base, brush);
  37. palette.setBrush(QPalette::Normal, QPalette::Base, brush);
  38. palette.setBrush(QPalette::Current, QPalette::Base, brush);
  39.  
  40. palette.setBrush(QPalette::Active, QPalette::AlternateBase, brush);
  41. palette.setBrush(QPalette::Inactive, QPalette::AlternateBase, brush);
  42. palette.setBrush(QPalette::Disabled, QPalette::AlternateBase, brush);
  43. palette.setBrush(QPalette::Normal, QPalette::AlternateBase, brush);
  44. palette.setBrush(QPalette::Current, QPalette::AlternateBase, brush);
  45.  
  46. palette.setBrush(QPalette::Active, QPalette::Highlight, brush);
  47. palette.setBrush(QPalette::Inactive, QPalette::Highlight, brush);
  48. palette.setBrush(QPalette::Disabled, QPalette::Highlight, brush);
  49. palette.setBrush(QPalette::Normal, QPalette::Highlight, brush);
  50. palette.setBrush(QPalette::Current, QPalette::Highlight, brush);
  51.  
  52. palette.setBrush(QPalette::Active, QPalette::Light, brush);
  53. palette.setBrush(QPalette::Inactive, QPalette::Light, brush);
  54. palette.setBrush(QPalette::Disabled, QPalette::Light, brush);
  55. palette.setBrush(QPalette::Normal, QPalette::Light, brush);
  56. palette.setBrush(QPalette::Current, QPalette::Light, brush);
  57.  
  58. this->setPalette(palette);
To copy to clipboard, switch view to plain text mode