/ Published in: C++

URL: http://stackoverflow.com/questions/5823700/notification-window-in-mac-with-or-without-qt
Expand |
Embed | Plain Text
#ifdef Q_OS_MAC #include <Carbon/Carbon.h> #endif NotifyWindow::NotifyWindow() : QWidget(0 /* This zero is the first point */) { setWindowFlags( #ifdef Q_OS_MAC Qt::SubWindow | // This type flag is the second point #else Qt::Tool | #endif Qt::FramelessWindowHint | Qt::WindowSystemMenuHint | Qt::WindowStaysOnTopHint ); setAttribute(Qt::WA_TranslucentBackground); // And this conditional block is the third point #ifdef Q_OS_MAC winId(); // This call creates the OS window ID itself. // qt_mac_window_for() doesn't int setAttr[] = { kHIWindowBitDoesNotHide, // Shows window even when app is hidden kHIWindowBitDoesNotCycle, // Not sure if required, but not bad kHIWindowBitNoShadow, // Keep this if you have your own design // with cross-platform drawn shadows 0 }; int clearAttr[] = { 0 }; HIWindowChangeAttributes(qt_mac_window_for(this), setAttr, clearAttr); #endif }
You need to login to post a comment.