Hello all,

some help please with this puzzle:

I'm trying to put an image on a pushbutton. I wrote this program in Qt3 on Linux, later I rewrote it to Qt4. So no Qt3 support or anything, only Qt4 left.
Now I'm trying to compile it on Windows. But I cannot get the image to show on the pushbutton on Windows. Works on Linux.

This is what I'm trying to do: Can somebody see the problem with this?

Qt Code:
  1. from knop.h:
  2. QPixmap pWit;
  3. QPalette palWit;
  4. QString progPath;
  5.  
  6. from knop.c:
  7.  
  8. knop::knop(QWidget* parent)
  9. : QWidget(parent)
  10. {
  11. setMaximumSize( QSize( 50, 50 ) );
  12.  
  13. but = new QPushButton("but", this);
  14. but->setGeometry( QRect( 0, 0, 50, 50 ) );
  15. but->setCheckable(true);
  16. but->setFont(QFont("Bitstream Vera Sans",22,QFont::Bold));
  17. but->setFlat(true);
  18.  
  19. e = new QLineEdit("e", this);
  20. e->setGeometry( QRect( 5, 5, 40, 10 ) );
  21. QFont e_font( e->font() );
  22. e_font.setPointSize( 10 );
  23. e->setFont( e_font );
  24. e->setFrame( FALSE );
  25.  
  26. resize( QSize(50, 50).expandedTo(minimumSizeHint()) );
  27. connect( but, SIGNAL(clicked()), SLOT(butClick()) );
  28. init();
  29.  
  30. }
  31.  
  32. void knop::init()
  33. {
  34. #ifdef _WIN32
  35. progPath = "/home/bartv/progs/sudoku/"; //linux
  36. #else
  37. progPath = "D:/qt/progs/sudoku/"; //windows
  38. #endif
  39.  
  40. pWit.load("knopWit.png");
  41.  
  42. palWit.setBrush(QPalette::Active,QPalette::Window,QBrush(pWit));
  43. palWit.setBrush(QPalette::Active,QPalette::Base,QColor(255,255,255));
  44. palWit.setBrush(QPalette::Active,QPalette::Text,QColor(0,0,0));
  45. palWit.setBrush(QPalette::Active,QPalette::ButtonText,QColor(0,0,0));
  46. palWit.setBrush(QPalette::Inactive,QPalette::Window,QBrush(pWit));
  47. palWit.setBrush(QPalette::Inactive,QPalette::Base,QColor(255,255,255));
  48. palWit.setBrush(QPalette::Inactive,QPalette::Text,QColor(0,0,0));
  49. palWit.setBrush(QPalette::Inactive,QPalette::ButtonText,QColor(0,0,0));
  50.  
  51. but->setPallete(palWit);
  52. e->setPalette(palWit);
To copy to clipboard, switch view to plain text mode