Posted By

shadevampire on 05/30/11


Tagged

window mac growl notification like Qt


Versions (?)

Qt notification window - growl like, mac specific


 / Published in: C++
 

URL: http://stackoverflow.com/questions/5823700/notification-window-in-mac-with-or-without-qt

  1. #ifdef Q_OS_MAC
  2. #include <Carbon/Carbon.h>
  3. #endif
  4.  
  5. NotifyWindow::NotifyWindow() : QWidget(0 /* This zero is the first point */) {
  6.  
  7. setWindowFlags(
  8. #ifdef Q_OS_MAC
  9. Qt::SubWindow | // This type flag is the second point
  10. #else
  11. Qt::Tool |
  12. #endif
  13. Qt::FramelessWindowHint |
  14. Qt::WindowSystemMenuHint |
  15. Qt::WindowStaysOnTopHint
  16. );
  17. setAttribute(Qt::WA_TranslucentBackground);
  18.  
  19. // And this conditional block is the third point
  20. #ifdef Q_OS_MAC
  21. winId(); // This call creates the OS window ID itself.
  22. // qt_mac_window_for() doesn't
  23.  
  24. int setAttr[] = {
  25. kHIWindowBitDoesNotHide, // Shows window even when app is hidden
  26.  
  27. kHIWindowBitDoesNotCycle, // Not sure if required, but not bad
  28.  
  29. kHIWindowBitNoShadow, // Keep this if you have your own design
  30. // with cross-platform drawn shadows
  31. 0 };
  32. int clearAttr[] = { 0 };
  33. HIWindowChangeAttributes(qt_mac_window_for(this), setAttr, clearAttr);
  34. #endif
  35. }

Report this snippet  

You need to login to post a comment.