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. QMenuBar not responsive
Qt 6.11 is out! See what's new in the release blog

QMenuBar not responsive

Scheduled Pinned Locked Moved Solved General and Desktop
c++qt 5.9.5qmenuqmenubar
6 Posts 2 Posters 1.5k 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.
  • D Offline
    D Offline
    Daniel_Contro
    wrote on last edited by Daniel_Contro
    #1

    Hi to everyone,
    I'm developing an application with a custom menubar. I initialize it following the qt documentation but every time that I run my application at the beginning it isn't responsive, I can't interact with the different QMenus. It becomes usable only after I Cmd+Tab to the application. Any idea on what could be causing this? This is my current code regarding the menu:

    // in views constructor initialization list:
    View(...):
      ...
      _menuBar(new QMenuBar(this)),
      _file(new QMenu(tr("&File"), _menuBar)),
      ... {}
    
    void View::createActions() {
      _newProject = new QAction(tr("&New project"), _file);
      _newProject->setShortcut(QKeySequence::New);
      _newProject->setStatusTip(tr("Create new project"));
      connect(_newProject, SIGNAL(triggered()), this, SLOT(onNewProject()));
    
      _openProject = new QAction(tr("&Open project"), _file);
      _openProject->setShortcut(QKeySequence::Open);
      _openProject->setStatusTip(tr("Open existing project"));
      connect(_openProject, SIGNAL(triggered()), this, SLOT(onOpenProject()));
    ...
    }
    
    void View::createMenus() {
    	createActions();
    
    	_file->addAction(_newProject);
    	_file->addAction(_openProject);
    
    	_menuBar->addMenu(_file);
    ...
    }
    
    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi

      Which version of Qt ?
      On which OS ?

      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
      • D Offline
        D Offline
        Daniel_Contro
        wrote on last edited by
        #3

        Hi, I'm currently working with Qt 5.9.5 on MacOS 10.15.6

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

          You should try with Qt 5.15.0.

          Are you using a QMainWindow ? If so, why not use the menu bar that comes with it ?

          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
          • D Offline
            D Offline
            Daniel_Contro
            wrote on last edited by
            #5

            I'd like to, but it's an university project and I can only use QT 5.9.5. Previously I was using menuBar() but it had the same issue.

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

              It might be an issue with macOS 10.15.

              One thing you can do as a workaround is to disable the native macOS menu bar. You will have it on the QMainWindow but it should be usable.

              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
              1

              • Login

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