Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Connect QMenuBar to various windows
Forum Updated to NodeBB v4.3 + New Features

Connect QMenuBar to various windows

Scheduled Pinned Locked Moved General and Desktop
4 Posts 2 Posters 928 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    lucadanieli
    wrote on last edited by
    #1

    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

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      did you set a QMenuBar on your new widget ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • L Offline
        L Offline
        lucadanieli
        wrote on last edited by
        #3

        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.show

        more 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?

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          You are only moving the mainMenu from one widget to another, not copying it (your can't copy QObject derived class by the way)

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved