Hello,

I would like to change tooltip both front and background color of a QPushButton object. My environment is
Windows7 Professional SP1 64bit, MSVC2008, Qt 4.7.2 (32bit).
However with below code, I only see the effect of QToolTip::setFont(), but not ::setBrush() or ::setColor(). I vaguely remember that QToolTip on Windows XP and Windows 7 behaves differently. On Windows XP, QToolTip background and front colors are the same as the parent QPushButton. On Windows 7, QToolTip background and front colors are uniform for all QPushButton's and cannot be modified. In my case, the background color is light gray with gradient. And front color is white. These results a very LOW contrast. Would you please confirm this? Or would you please hint me to how to change them? Thanks a lot.

Qt Code:
  1. QBrush brushToolTipBase(Qt::white);
  2. QBrush brushToolTipText(Qt::red);
  3. QPalette palette = QToolTip::palette();
  4. palette.setBrush(QPalette::Inactive, QPalette::ToolTipBase, brushToolTipBase);
  5. palette.setBrush(QPalette::Inactive, QPalette::ToolTipText, brushToolTipText);
  6. palette.setColor(QPalette::Inactive, QPalette::ToolTipBase, Qt::white);
  7. palette.setColor(QPalette::Inactive, QPalette::ToolTipText, Qt::red);
  8. QToolTip::setPalette(palette);QFont serifFont("Times", 14, QFont::Bold);
  9. QToolTip::setFont(serifFont);
To copy to clipboard, switch view to plain text mode 

Happy Holidays!
casestudy