how to change the position of menu of QMainWindow
Hi Guys
I need your help
I am developing an application which need adjust default menu's position
my mainwindow inherits from QMainWindow
I try the below, but it doesn't work:
QMenu * myMenu = menuBar();
myMenu->move(x,y);
Who can help me?
Thanks in advance!
Re: how to change the position of menu of QMainWindow
menuBar() returns QMenuBar , not QMenu.
Also wat do u mean by moving menu ?? didnt understand that :(
Re: how to change the position of menu of QMainWindow
My Question is:
You know default , menu bar will be displayed at the top-left of main window, for example now I want it to be showed at down to 120 pix, just like below:
____________________
| default menu here
|
| now I want to show here
Re: how to change the position of menu of QMainWindow
You'd have to remove it from the main window's layout and handle the geometry yourself all the time. What is your usecase?
Re: how to change the position of menu of QMainWindow
my usecase as below:
------------------------------------------------------------------------------------
menu here My Logo zoom control
-------------------------------------------------------------------------------------
| |
| |
| |
| Center Widget |
| |
-------------------------------------------------------------------------------------
now problem is My Logo is larger than menu's height, so I want to adjust menu text
align with the bottom of my logo picture.
Do I say clearly?
Re: how to change the position of menu of QMainWindow
Did you try using style sheets for that? You should be able to declare alignment of menu bar items this way.
Re: how to change the position of menu of QMainWindow
Quote:
Originally Posted by
yxmaomao
my usecase as below:
------------------------------------------------------------------------------------
menu here My Logo zoom control
-------------------------------------------------------------------------------------
| |
| |
| |
| Center Widget |
| |
-------------------------------------------------------------------------------------
now problem is My Logo is larger than menu's height, so I want to adjust menu text
align with the bottom of my logo picture.
Do I say clearly?
Would it not be easier just to put your logo underneath the menu?
Re: how to change the position of menu of QMainWindow
Why dont you use QToolBar ??? u can have a more combinations of using QWidget with toolbar....
Re: how to change the position of menu of QMainWindow
As a follow-up of my previous post, seems that using the following stylesheet works very nice:
Code:
QMenuBar::item { padding-top: 120px; }
Re: how to change the position of menu of QMainWindow
Hi wysota
Could you tell me how to use stylesheet in detailed
Thanks
Re: how to change the position of menu of QMainWindow
Hi wysota
Thanks wysota again
I have done it, it works very well
Re: how to change the position of menu of QMainWindow
hello,i have the same question as you ,can you tell me how to do it? thank you !!