This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Getting my app to use the global menu

Tags: None
(comma "," separated)
minorsecond
Registered Member
Posts
1
Karma
0

Getting my app to use the global menu

Thu Sep 22, 2022 10:28 pm
I've just ported my app over to Linux but it's not fully working on my machine because I use the KDE global menu plugin and the menu isn't showing up. It does show up without the plugin enabled, however. I'm not sure where I went wrong with setting up the menu but it was originally designed for Apple so the layout is a bit different. Does the global menu expect a certain menu bar format?

Here's how I currently have it set up:
Code: Select all
 
    QMenu * app_menu = menuBar()->addMenu("App Menu");
    auto * preferences_action = new QAction("Preferences", this);
    auto * about_action = new QAction("About", this);
    auto * export_action = new QAction("Export", this);
    auto * graphs_action = new QAction("Graphs", this);

    preferences_action->setMenuRole(QAction::PreferencesRole);
    about_action->setMenuRole(QAction::AboutRole);
    export_action->setMenuRole(QAction::ApplicationSpecificRole);
    graphs_action->setMenuRole(QAction::ApplicationSpecificRole);

    app_menu->addAction(preferences_action);
    app_menu->addAction(about_action);
    app_menu->addAction(export_action);
    app_menu->addAction(graphs_action);


If anyone knows how to get this working, I'd greatly appreciate it.


Bookmarks



Who is online

Registered users: bartoloni, Bing [Bot], Google [Bot], Yahoo [Bot]