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. Hide OSX menu bar from Qt Application?

Hide OSX menu bar from Qt Application?

Scheduled Pinned Locked Moved General and Desktop
xcodeobjective-cqt5osx
2 Posts 2 Posters 3.1k Views 2 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.
  • F Offline
    F Offline
    fhdns
    wrote on last edited by fhdns
    #1

    I want to hide OSX Menu bar and OSX Dock panel. I tried to use this code:

    int main(int argc, char *argv[]) {
      QApplication app(argc, argv);
      QDialog* dlg = new QDialog();
      QPushButton* btn = new QPushButton(this);
    	connect(btn, &QPushButton::clicked, [this](){
      	[NSApp setPresentationOptions: [NSApp presentationOptions] | NSApplicationPresentationHideMenuBar | NSApplicationPresentationHideDock];
    	})
    	dlg->show();
      return app.exec();
    }
    

    This code hides Dock panel, but doesn't hide Menu bar. by experimentation it was found that the menu does not disappear because Application launched as agent with Info.plist option:

    		<key>LSUIElement</key>
    		<string>1</string>
    

    If I delete LSUIElement, OSX Dock and Menu bar will be hided, but I don't want that Application has been shown in Dock.

    I don't want to use full screen mode dlg->setFullscreen() bexause it creates new OSX screen.

    How to doesn't show Application in Dock and hide OSX Menu Bar and Dock panel when Application is active?

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

      Hi,

      Out of curiosity, can you describe what your application does that it needs all of these elements hidden ?

      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