1

In almost every application on OS X, if you click on the name of application, one of the actions is "About". I understand how I can do this in QMenuBar, but seems like it is not a part of it.

The second question is how this will be shown on Windows?

I don't use QML - how to do this in code? Like this way:

QMenu *fileMenu = menuBar->addMenu("File");

QAction *newFile = new QAction("New", fileMenu);
QAction *openProjectAction = new QAction("Open project", fileMenu);

So how I add "About" action to group of actions of application? Screenshot addedGoogle Chrome about

htzfun
  • 1,231
  • 10
  • 41
  • Do you know how to add a new action in general to a menubar? – Hayt Sep 15 '16 at 10:31
  • @Hayt Yes, but there is no such thing as QMenu("My name project"). If it was like Help->About, I'd already done it. QMenu *fileMenu = menuBar->addMenu("File"); QAction *newFile = new QAction("New", fileMenu); QAction *openProjectAction = new QAction("Open project", fileMenu); As proof :) – htzfun Sep 15 '16 at 10:35
  • You should maybe clarify this in your question, that you want to know how to get the name of your project? – Hayt Sep 15 '16 at 10:38
  • You can get/set the application name in the application itself: http://doc.qt.io/qt-5/qcoreapplication.html#applicationName-prop – Hayt Sep 15 '16 at 10:41
  • @Hayt How this might help? In QMenuBar no such thing as getMenu – htzfun Sep 15 '16 at 10:54
  • 1
    @htzfun Actually, try `Help -> About`. OS X should automatically move this action to the needed section as in your screenshot. – kefir500 Sep 15 '16 at 10:57
  • @kefir500 Thanks a lot - I haven't tried this one because it doesn't seem logical to me - but it worked. Could you make it as answer? – htzfun Sep 15 '16 at 11:07

1 Answers1

2

You can simply add your action as Help --> About.

  • On macOS the action will be automatically moved to the needed section, as on your screenshot.
  • On Windows this action will remain as is (in the Help section).

You may also want to take a look at the macOS QAction roles.

kefir500
  • 4,184
  • 6
  • 42
  • 48