From 571eeb11b463ef649ae54d7d09c72d4c230e62ec Mon Sep 17 00:00:00 2001 From: GiWoong Kim Date: Mon, 3 Nov 2014 19:03:52 +0900 Subject: menu: Added "Always on top" in MacOS Change-Id: Ifacf14b81b6bc27f5fe35140d83a6a3cff181fed Signed-off-by: GiWoong Kim --- tizen/src/ui/menu/contextmenu.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/tizen/src/ui/menu/contextmenu.cpp b/tizen/src/ui/menu/contextmenu.cpp index 2ec3c081c9..608debc369 100644 --- a/tizen/src/ui/menu/contextmenu.cpp +++ b/tizen/src/ui/menu/contextmenu.cpp @@ -75,11 +75,9 @@ void ContextMenu::createItems() { addSeparator(); /* Always On Top menu */ -#ifndef CONFIG_DARWIN actionTopMost = addAction("&Always on Top"); actionTopMost->setCheckable(true); connect(actionTopMost, SIGNAL(triggered(bool)), this, SLOT(slotTopMost(bool))); -#endif /* = Rotate menu = */ if (win->uiInfo->mainFormList.count() > 1) { @@ -271,7 +269,7 @@ void ContextMenu::slotTopMost(bool on) HWND hWnd = (HWND)parent->winId(); HWND hWndInsertAfter = ((on == true) ? HWND_TOPMOST : HWND_NOTOPMOST); SetWindowPos(hWnd, hWndInsertAfter, parent->pos().x(), parent->pos().y(), 0, 0, SWP_NOSIZE); -#elif defined (CONFIG_LINUX) +#elif defined(CONFIG_LINUX) Display* display = XOpenDisplay(NULL); if (display == NULL) { qDebug("Error: XOpenDisplay() Failed. Always on top failed."); @@ -295,8 +293,14 @@ void ContextMenu::slotTopMost(bool on) XFlush(display); XCloseDisplay(display); -#elif defined (CONFIG_DARWIN) - // TODO: +#elif defined(CONFIG_DARWIN) + if (on == true) { + parent->setWindowFlags(parent->windowFlags() | Qt::WindowStaysOnTopHint); + } else { + parent->setWindowFlags(parent->windowFlags() & ~(Qt::WindowStaysOnTopHint)); + } + + parent->show(); #endif actionTopMost->setChecked(on); -- cgit v1.2.3