From 5305ec66920cb886a0f0546fb22db75339fe2055 Mon Sep 17 00:00:00 2001
From: Kubat <mael.martin31@gmail.com>
Date: Tue, 20 Jul 2021 21:37:00 +0200
Subject: [PATCH] OS: Handle the MacOS case for QMenuBar in Window

---
 src/UI/Window.cc       | 4 ++++
 src/VivyApplication.hh | 5 +++++
 2 files changed, 9 insertions(+)

diff --git a/src/UI/Window.cc b/src/UI/Window.cc
index 588ff30f..c4e8f182 100644
--- a/src/UI/Window.cc
+++ b/src/UI/Window.cc
@@ -82,5 +82,9 @@ Window::layout() const noexcept
 QMenuBar *
 Window::menuBar() const noexcept
 {
+#ifndef VIVY_MACOS
     return titleBar->menuBar();
+#else
+    return QMainWindow::menuBar();
+#endif
 }
diff --git a/src/VivyApplication.hh b/src/VivyApplication.hh
index 7f4bfac9..86c74041 100644
--- a/src/VivyApplication.hh
+++ b/src/VivyApplication.hh
@@ -12,6 +12,11 @@
 #include <QPixmap>
 #include <QFont>
 
+// Detect MacOS
+#if defined(Q_OS_DARWIN) || defined(Q_OS_MACOS)
+#define VIVY_MACOS
+#endif
+
 #include "Lib/Document/VivyDocumentStore.hh"
 
 namespace Vivy
-- 
GitLab