MenuBar Size Does not change

I have a MenuBar that is added into a HorizontalLayout. I have 4 items in the Menu. I want my MenuBar to be equally distributed into the horizontal layout, but I am not able to change the size (width and height) and it stays only upto the size that is needed for the 4 menu items.

I have tried setWidth and setHeight and also tried setting in stylesheet and nothing has worked so far.

Please help


When I use setWidth(“100%”) it fills the space for me. Are you using the %?