How can set pop-up menu position in QML -


i want fix position of pop-up menu in qml. when click on setting button,i want pop-up menu display @ fixed position. did day can't. how can in qml. also, want change size of menu item(width , height).

hope help!

that depends on qtquick.controls version.

in 2.0 can define size , position(and more - must do)

import qtquick 2.7 import qtquick.controls 2.0 //import qtquick.controls 1.4 import qtquick.window 2.0  window {     id: window     width: 500     height: 500     visible: true      mousearea {         anchors.fill: parent         onclicked: {             menu.x = (window.width - menu.width) / 2             menu.y = (window.height - menu.height) / 2             //menu.__popup(qt.rect(200,200,100,100),0,0);             menu.open();         }     }      menu {         id: menu         menuitem { text: "item1" }         menuitem { text: "item2"; }         menuitem { text: "item3"; height: 100 }     } } 

in 1.4 (see commented lines) can try menu.__popup() function private , behavior unpredictable.


Comments

Popular posts from this blog

jOOQ update returning clause with Oracle -

java - Warning equals/hashCode on @Data annotation lombok with inheritance -

java - BasicPathUsageException: Cannot join to attribute of basic type -