[SOLVED]QGuiApplication and 'About Menu' on OSX
-
Hi everyone,
I red somewhere in Qt's doc that Qt should handle by itself the 'About myApp' on OS X.
However I do not see it when I run my application.I am using Qt 5.4.0, my app is a QGuiApplication in which I have a QQuickView with the following flags:
@Qt::Window |
Qt::WindowTitleHint |
Qt::WindowSystemMenuHint |
Qt::WindowMinMaxButtonsHint |
Qt::WindowCloseButtonHint |
Qt::WindowFullscreenButtonHint@Am I missing something that makes the App to not have this menu ?
I also have a plist file with copyright, version and bundle version.
Thanks :)
-
You can have generic information about Qt displayed in the menu but you still need to put it there yourself.
To add this in your menu add QAction with the triggered() signal connected to the slot QApplication::aboutQt()
Note: On second read of the post this is probably off topic. I did check a program I wrote To see if I had an 'About Application'. I didn't do anything to make this happen but somehow it did and connected to the right 'page' of my program.
Note 2: After some additional checking I noticed it took the last QAction item added to the last QMenu item and turned this into my Qbout 'My App' option on OS X. Interesting...
-
Thanks for your answer, but how do I add it to the QGuiApplication ? Because I do not use QWidgets :S
-
I didn't do anything to add this (didn't even realize it did it until a moment ago).
In my case it was the last QAction item added to the last QMenu.
@
view_menu = new QMenu("View");
view_menu->addAction(d_components_action);
view_menu->addAction(d_variables_action);
view_menu->addAction(d_groups_action);
view_menu->addAction(d_report_action);
view_menu->addAction(d_log_action);
view_menu->addAction(d_about_action);
menu_bar->addMenu(view_menu);
@The 'd_about_action' doesn't appear in the menu under 'view' but under the application - about section.
I didn't do anything more than this and didn't give it any hints that this action should be treated special.
Even if you don't use QWidgets you can still create QAction and QMenu I assume?
-
Yup I have a QAction created, however I cannot create a QMenuBar or QMenu since they are QWidgets and requires a QApplication instead of a QGuiApplication...
-
So I cannot use the Application::aboutQt since it opens a QWidget .. I probably will have to do my own about section but I need first to get this About field in the MenuBar..
-
I can't say anything about this other then to verify what you read in the Qt doc files is correct.
Maybe adding the menu and options using the native API?
-
Moreover aboutQt() shows info for Qt but not a minimalist window with info of the application ( Logo name version and copyright according from the plist file )
-
No pb, I will continue my investigation and if someone comes around with a solution for non QWidget app I would be glad to have a solution.
Native approach would work but I'd rather stay within Qt
-
Hi,
I havent't tested it but wouldn't the MenuBar from the QtQuick.Controls module allow to setup that ?
Hope it helps
-
I tried to use the MenuBar but it needs an ApplicationWindow as the root but in my case it is an Item that is the root of my QQuickView
-
To close the subject ( left open for a while ... ) I finally found the solution by using a QApplication instead of using a QGuiApplication and by creating a new QMenuBar with a QMenu named "aboutMyApp" that is automatically placed in the right place under OS X.