Menu not working in Ubuntu/Unity



  • Hi, I have problem with my qt application. In most desktops, everything work fine except for Ubuntu with Unity. Problem is, that all my menus are empty while in console I can see errors when running application:

    void DBusMenuExporterPrivate::fillLayoutItem(DBusMenuLayoutItem*, QMenu*, int, int, const QStringList&): No id for action 
    void DBusMenuExporterPrivate::fillLayoutItem(DBusMenuLayoutItem*, QMenu*, int, int, const QStringList&): No id for action 
    void DBusMenuExporterPrivate::fillLayoutItem(DBusMenuLayoutItem*, QMenu*, int, int, const QStringList&): No id for action 
    void DBusMenuExporterPrivate::fillLayoutItem(DBusMenuLayoutItem*, QMenu*, int, int, const QStringList&): No id for action 
    void DBusMenuExporterPrivate::fillLayoutItem(DBusMenuLayoutItem*, QMenu*, int, int, const QStringList&): No id for action 
    void DBusMenuExporterPrivate::fillLayoutItem(DBusMenuLayoutItem*, QMenu*, int, int, const QStringList&): No id for action 
    void DBusMenuExporterPrivate::fillLayoutItem(DBusMenuLayoutItem*, QMenu*, int, int, const QStringList&): No id for action 
    void DBusMenuExporterPrivate::fillLayoutItem(DBusMenuLayoutItem*, QMenu*, int, int, const QStringList&): No id for action 
    void DBusMenuExporterPrivate::fillLayoutItem(DBusMenuLayoutItem*, QMenu*, int, int, const QStringList&): No id for action 
    void DBusMenuExporterPrivate::fillLayoutItem(DBusMenuLayoutItem*, QMenu*, int, int, const QStringList&): No id for action 
    void DBusMenuExporterPrivate::fillLayoutItem(DBusMenuLayoutItem*, QMenu*, int, int, const QStringList&): No id for action 
    void DBusMenuExporterPrivate::fillLayoutItem(DBusMenuLayoutItem*, QMenu*, int, int, const QStringList&): No id for action 
    void DBusMenuExporterPrivate::fillLayoutItem(DBusMenuLayoutItem*, QMenu*, int, int, const QStringList&): No id for action 
    void DBusMenuExporterPrivate::fillLayoutItem(DBusMenuLayoutItem*, QMenu*, int, int, const QStringList&): No id for action 
    void DBusMenuExporterPrivate::fillLayoutItem(DBusMenuLayoutItem*, QMenu*, int, int, const QStringList&): No id for action 
    void DBusMenuExporterPrivate::fillLayoutItem(DBusMenuLayoutItem*, QMenu*, int, int, const QStringList&): No id for action 
    void DBusMenuExporterPrivate::fillLayoutItem(DBusMenuLayoutItem*, QMenu*, int, int, const QStringList&): No id for action 
    void DBusMenuExporterPrivate::fillLayoutItem(DBusMenuLayoutItem*, QMenu*, int, int, const QStringList&): No id for action 
    void DBusMenuExporterPrivate::fillLayoutItem(DBusMenuLayoutItem*, QMenu*, int, int, const QStringList&): No id for action 
    void DBusMenuExporterPrivate::fillLayoutItem(DBusMenuLayoutItem*, QMenu*, int, int, const QStringList&): No id for action 
    void DBusMenuExporterPrivate::fillLayoutItem(DBusMenuLayoutItem*, QMenu*, int, int, const QStringList&): No id for action 
    void DBusMenuExporterPrivate::fillLayoutItem(DBusMenuLayoutItem*, QMenu*, int, int, const QStringList&): No id for action 
    void DBusMenuExporterPrivate::fillLayoutItem(DBusMenuLayoutItem*, QMenu*, int, int, const QStringList&): No id for action 
    void DBusMenuExporterPrivate::fillLayoutItem(DBusMenuLayoutItem*, QMenu*, int, int, const QStringList&): No id for action 
    void DBusMenuExporterPrivate::fillLayoutItem(DBusMenuLayoutItem*, QMenu*, int, int, const QStringList&): No id for action 
    void DBusMenuExporterPrivate::fillLayoutItem(DBusMenuLayoutItem*, QMenu*, int, int, const QStringList&): No id for action 
    void DBusMenuExporterPrivate::fillLayoutItem(DBusMenuLayoutItem*, QMenu*, int, int, const QStringList&): No id for action 
    void DBusMenuExporterPrivate::fillLayoutItem(DBusMenuLayoutItem*, QMenu*, int, int, const QStringList&): No id for action 
    void DBusMenuExporterPrivate::fillLayoutItem(DBusMenuLayoutItem*, QMenu*, int, int, const QStringList&): No id for action 
    void DBusMenuExporterPrivate::fillLayoutItem(DBusMenuLayoutItem*, QMenu*, int, int, const QStringList&): No id for action 
    void DBusMenuExporterPrivate::fillLayoutItem(DBusMenuLayoutItem*, QMenu*, int, int, const QStringList&): No id for action 
    void DBusMenuExporterPrivate::fillLayoutItem(DBusMenuLayoutItem*, QMenu*, int, int, const QStringList&): No id for action 
    void DBusMenuExporterPrivate::fillLayoutItem(DBusMenuLayoutItem*, QMenu*, int, int, const QStringList&): No id for action 
    void DBusMenuExporterPrivate::fillLayoutItem(DBusMenuLayoutItem*, QMenu*, int, int, const QStringList&): No id for action 
    void DBusMenuExporterPrivate::fillLayoutItem(DBusMenuLayoutItem*, QMenu*, int, int, const QStringList&): No id for action 
    void DBusMenuExporterPrivate::fillLayoutItem(DBusMenuLayoutItem*, QMenu*, int, int, const QStringList&): No id for action 
    void DBusMenuExporterPrivate::fillLayoutItem(DBusMenuLayoutItem*, QMenu*, int, int, const QStringList&): No id for action 
    void DBusMenuExporterPrivate::fillLayoutItem(DBusMenuLayoutItem*, QMenu*, int, int, const QStringList&): No id for action 
    void DBusMenuExporterPrivate::fillLayoutItem(DBusMenuLayoutItem*, QMenu*, int, int, const QStringList&): No id for action 
    void DBusMenuExporterPrivate::fillLayoutItem(DBusMenuLayoutItem*, QMenu*, int, int, const QStringList&): No id for action 
    void DBusMenuExporterPrivate::fillLayoutItem(DBusMenuLayoutItem*, QMenu*, int, int, const QStringList&): No id for action 
    void DBusMenuExporterPrivate::fillLayoutItem(DBusMenuLayoutItem*, QMenu*, int, int, const QStringList&): No id for action 
    void DBusMenuExporterPrivate::fillLayoutItem(DBusMenuLayoutItem*, QMenu*, int, int, const QStringList&): No id for action 
    void DBusMenuExporterPrivate::fillLayoutItem(DBusMenuLayoutItem*, QMenu*, int, int, const QStringList&): No id for action 
    void DBusMenuExporterPrivate::fillLayoutItem(DBusMenuLayoutItem*, QMenu*, int, int, const QStringList&): No id for action 
    void DBusMenuExporterPrivate::fillLayoutItem(DBusMenuLayoutItem*, QMenu*, int, int, const QStringList&): No id for action 
    void DBusMenuExporterPrivate::fillLayoutItem(DBusMenuLayoutItem*, QMenu*, int, int, const QStringList&): No id for action 
    void DBusMenuExporterPrivate::fillLayoutItem(DBusMenuLayoutItem*, QMenu*, int, int, const QStringList&): No id for action 
    void DBusMenuExporterPrivate::fillLayoutItem(DBusMenuLayoutItem*, QMenu*, int, int, const QStringList&): No id for action 
    void DBusMenuExporterPrivate::fillLayoutItem(DBusMenuLayoutItem*, QMenu*, int, int, const QStringList&): No id for action 
    void DBusMenuExporterPrivate::fillLayoutItem(DBusMenuLayoutItem*, QMenu*, int, int, const QStringList&): No id for action 
    void DBusMenuExporterPrivate::fillLayoutItem(DBusMenuLayoutItem*, QMenu*, int, int, const QStringList&): No id for action 
    void DBusMenuExporterPrivate::fillLayoutItem(DBusMenuLayoutItem*, QMenu*, int, int, const QStringList&): No id for action 
    void DBusMenuExporterPrivate::fillLayoutItem(DBusMenuLayoutItem*, QMenu*, int, int, const QStringList&): No id for action 
    void DBusMenuExporterPrivate::fillLayoutItem(DBusMenuLayoutItem*, QMenu*, int, int, const QStringList&): No id for action 
    void DBusMenuExporterPrivate::fillLayoutItem(DBusMenuLayoutItem*, QMenu*, int, int, const QStringList&): No id for action 
    void DBusMenuExporterPrivate::fillLayoutItem(DBusMenuLayoutItem*, QMenu*, int, int, const QStringList&): No id for action 
    void DBusMenuExporterPrivate::fillLayoutItem(DBusMenuLayoutItem*, QMenu*, int, int, const QStringList&): No id for action 
    void DBusMenuExporterPrivate::fillLayoutItem(DBusMenuLayoutItem*, QMenu*, int, int, const QStringList&): No id for action 
    void DBusMenuExporterPrivate::fillLayoutItem(DBusMenuLayoutItem*, QMenu*, int, int, const QStringList&): No id for action 
    

    The result is that I can see menus File, View, Key, Certificate, Help in menu bar, but no items under these menus. Menu items are added by:

    //menu File
        versionAction = new QAction(QString::fromUtf8(tr("English version").toLatin1()),this);
        changePinAction = new QAction(QString::fromUtf8(tr("Change PIN...").toLatin1()),this);
        changePukAction = new QAction(QString::fromUtf8(tr("Change PUK...").toLatin1()),this);
        unblockPinAction = new QAction(QString::fromUtf8(tr("Unblock PIN...").toLatin1()),this);
        showDiagAction = new QAction(QString::fromUtf8(tr("Show diag").toLatin1()),this);
        saveDiagAction = new QAction(QString::fromUtf8(tr("Save diag...").toLatin1()),this);
        printAction = new QAction(QString::fromUtf8(tr("Print...").toLatin1()),this);
        printSetupAction = new QAction(QString::fromUtf8(tr("Print setup...").toLatin1()),this);
        expertModeAction = new QAction(QString::fromUtf8(tr("Expert mode").toLatin1()),this);
        exitAction = new QAction(tr("Exit"), this);
    
        connect(versionAction, SIGNAL(triggered()), this, SLOT(version()));
        connect(changePinAction, SIGNAL(triggered()), this, SLOT(changePin()));
        connect(changePukAction, SIGNAL(triggered()), this, SLOT(changePuk()));
        connect(unblockPinAction, SIGNAL(triggered()), this, SLOT(unblockPin()));
        connect(showDiagAction, SIGNAL(triggered()), this, SLOT(showDiag()));
        connect(saveDiagAction, SIGNAL(triggered()), this, SLOT(saveDiag()));
        connect(printAction, SIGNAL(triggered()), this, SLOT(print()));
        printAction->setShortcut(QKeySequence::fromString("Ctrl+P"));
        connect(printSetupAction, SIGNAL(triggered()), this, SLOT(printSetup()));
        connect(expertModeAction, SIGNAL(triggered()), this, SLOT(expertMode()));
        connect(exitAction, SIGNAL(triggered()), qApp, SLOT(quit()));
    
        fileMenu = menuBar()->addMenu(tr("File"));
        fileMenu->addAction(versionAction);
        fileMenu->addSeparator();
        fileMenu->addAction(changePinAction);
        fileMenu->addAction(changePukAction);
        fileMenu->addAction(unblockPinAction);
        fileMenu->addSeparator();
        fileMenu->addAction(showDiagAction);
        fileMenu->addAction(saveDiagAction);
        fileMenu->addSeparator();
        fileMenu->addAction(printAction);
        fileMenu->addAction(printSetupAction);
        fileMenu->addSeparator();
        fileMenu->addAction(expertModeAction);
        fileMenu->addAction(exitAction);
    
        mainWindow.menuBar()->addMenu(fileMenu);
    


  • Hi and welcome to devnet,

    2 things:

    1. Why this QString::fromUtf8(tr("XXX").toLatin1()) instead of tr("XXX") in QAction constructor ??
    2. Why this mainWindow.menuBar()->addMenu(fileMenu); at the end ??

Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.