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

QMenuBar not responsive

Scheduled Pinned Locked Moved Solved General and Desktop
c++qt 5.9.5qmenuqmenubar
6 Posts 2 Posters 840 Views
  • 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 1 Sept 2020, 18:10 last edited by Daniel_Contro 9 Jan 2020, 18:10
    #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
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 1 Sept 2020, 18:13 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 1 Sept 2020, 18:17 last edited by
        #3

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

        1 Reply Last reply
        0
        • S Offline
          S Offline
          SGaist
          Lifetime Qt Champion
          wrote on 1 Sept 2020, 18:23 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 1 Sept 2020, 18:38 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
            • S Offline
              S Offline
              SGaist
              Lifetime Qt Champion
              wrote on 1 Sept 2020, 18:55 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

              5/6

              1 Sept 2020, 18:38

              • Login

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