@@ -23,7 +23,7 @@ Window {
2323 property var recoveryFilesModel: null
2424 property var navigationActionsModel: null
2525 property var toolActionsModel: null
26- property var macosMenusModel : null
26+ property var menusModel : null
2727
2828 readonly property bool isMacOS: Qt .platform .os === " osx" || Qt .platform .os === " macos"
2929
@@ -58,6 +58,7 @@ Window {
5858 windowAgent .setSystemButton (WindowAgent .Minimize , minimizeSystemButton)
5959 windowAgent .setSystemButton (WindowAgent .Maximize , maximizeSystemButton)
6060 windowAgent .setSystemButton (WindowAgent .Close , closeSystemButton)
61+ windowAgent .setHitTestVisible (menuBar)
6162 windowAgent .setHitTestVisible (Overlay .overlay )
6263 }
6364 }
@@ -322,35 +323,56 @@ Window {
322323 property bool framelessSetup: false
323324 }
324325
325- MenuBar {
326- id: menuBar
327- visible: window .isMacOS
328- Instantiator {
329- model: window .macosMenusModel
330- onObjectAdded : (index , object ) => {
331- if (object instanceof Menu) {
332- menuBar .insertMenu (index, object)
333- } else {
334- throw new TypeError (" Unsupported menu type" )
335- }
336- }
337- onObjectRemoved : (index , object ) => {
338- if (object instanceof Menu) {
339- menuBar .removeMenu (object)
340- } else {
341- throw new TypeError (" Unsupported menu type" )
342- }
343- }
344- }
345- }
346-
347326 Item {
348327 id: titleBarArea
349328 width: window .width
350329 height: ! window .isMacOS ? 36 : 28
351330 visible: windowAgent .framelessSetup && (! window .isMacOS || window .visibility !== Window .FullScreen )
352331 z: 1
353332 Accessible .role : Accessible .TitleBar
333+ Rectangle {
334+ id: menuBarBackground
335+ width: parent .width
336+ height: menuBar .height
337+ visible: menuBar .height !== 0
338+ anchors .top : parent .top
339+ anchors .topMargin : menuBar .anchors .topMargin
340+ color: Theme .backgroundQuaternaryColor
341+ }
342+ MenuBar {
343+ id: menuBar
344+ anchors .left : parent .left
345+ anchors .top : parent .top
346+ anchors .topMargin : activeFocus || menus .some (menu => menu .visible ) || children .some (item => item .activeFocus ) ? 0 : - height
347+ ThemedItem .backgroundLevel : SVS .BL_Quaternary
348+ Behavior on anchors .topMargin {
349+ id: topMarginBehavior
350+ enabled: false
351+ NumberAnimation {
352+ duration: Theme .visualEffectAnimationDuration
353+ easing .type : Easing .OutCubic
354+ }
355+ }
356+ Component .onCompleted : Qt .callLater (() => topMarginBehavior .enabled = true )
357+ Instantiator {
358+ model: window .menusModel
359+ onObjectAdded : (index , object ) => {
360+ if (object instanceof Menu) {
361+ console .log (object)
362+ menuBar .insertMenu (index, object)
363+ } else {
364+ throw new TypeError (" Unsupported menu type" )
365+ }
366+ }
367+ onObjectRemoved : (index , object ) => {
368+ if (object instanceof Menu) {
369+ menuBar .removeMenu (object)
370+ } else {
371+ throw new TypeError (" Unsupported menu type" )
372+ }
373+ }
374+ }
375+ }
354376 RowLayout {
355377 anchors .right : parent .right
356378 visible: ! window .isMacOS
0 commit comments