0

I have a simple Qt MainWindow:

// ui/mainwindow.hpp
class MainWindow: public QMainWindow
{
    Q_OBJECT
public:
    explicit MainWindow(QWidget* parent = 0);
public slots:
private:
};

// ui/mainwindow.cpp
MainWindow::MainWindow(QWidget* parent): QMainWindow(parent)
{
    QMenu* menuFile = menuBar()->addMenu(tr("File"));
    menuFile->addAction(tr("Some"));
}

// Application entry
int main(int argc, char* argv[])
{
    QApplication a(argc, argv);
    MainWindow w;
    w.show();
    return a.exec();
}

I'm noticing that with Ubuntu and Unity, the menu bar is not showing on the top of the screen but instead inside the application's window.

How do I make the menu bar show up on the top of the screen?

Henricus V.
  • 898
  • 1
  • 8
  • 29

1 Answers1

2

Which version of Qt are you using?

  • For Qt 4.8, the package appmenu-qt needs to be installed.
  • For Qt 5.2+, the package appmenu-qt5 needs to be installed and QT_QPA_PLATFORMTHEME=appmenu-qt5` being set in the environment

This is not really something that you influence on the app developer's side.

ypnos
  • 50,202
  • 14
  • 95
  • 141
  • 1
    I'm using Qt 5.6. Setting QT_QPA_PLATFORMTHEME=appmenu-qt5 does not seem to work, though. (Using export QT_QPA_PLATFORMTHEME=appmenu-qt5) – Henricus V. May 01 '16 at 17:37