Connect QMenuBar to various windows
-
Hello all,
I didn't figure out how to enable the main Menu from all the windows shown.
I mean:I have my mainWindow. If I create and show a new QObject as a new Window, in Linux I cannot select the menu when the new Window is Active.
Is it just my problem or has someone experienced it? I would like to be able to select the menu from all the windows opened.Luca
-
Hi,
did you set a QMenuBar on your new widget ?
-
Hi..
I tried to make a newBar and to add it to the Layout of the new Widget:
QMenuBar *newMenu = mainMenu (previously created)
QWidget *newWindow = new QWidget()
QLayout newLayout = ....
newLayout.add(newMenu)
newWindow.setLayout
newWindow.showmore or less this is the synthesis.
The problem is that this is doubling the Menu the first time it executes.
Also, the action shortcuts are inherited by the new window.
On the opposite, the shortcuts don't work any more in the mainWindow.I think that the major problem is still the doubling of the menu at the first execution.
Can you tell me if I did right? -
You are only moving the mainMenu from one widget to another, not copying it (your can't copy QObject derived class by the way)