Symbian strange extra "Actions" in Options button



  • Hello!

    Could someone explain to me this strange problem. I have a dialog with Symbian Options button. First time I open the dialog the Options button show the menu correctly, but when I close the dialog and reopen it there is an extra menu item "Actions"?
    The code:

    ------ Main.cpp ------
    @
    #include <QDebug>
    #include <QPushButton>
    #include "main.h"
    #include "test_dialog.h"

    MainWindow::MainWindow(QWidget *parent)
    {
    QPushButton *btTest = new QPushButton(tr("Start Test"), this);
    connect(btTest, SIGNAL(clicked()), this, SLOT(startTest()));
    btTest->move(0,0);
    btTest->resize(200,200);
    }

    void MainWindow::startTest(void)
    {
    TestDialog *testDialog = new TestDialog(this);
    testDialog->showMaximized();
    testDialog->exec();
    delete testDialog;
    }

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

    ------ test_dialog.cpp ------
    #include "test_dialog.h"

    TestDialog::TestDialog(QWidget *parent) : QDialog(parent)
    {
    QAction *backSoftKeyAction = new QAction(QString("Back"), this);
    backSoftKeyAction->setSoftKeyRole(QAction::NegativeSoftKey);
    QObject::connect(backSoftKeyAction, SIGNAL(triggered()), this, SLOT(close()));
    addAction(backSoftKeyAction);

    QAction *test = new QAction(tr("TestActions"), this);
    connect(test,  SIGNAL(triggered()), this, SLOT(testSlot()));
    QMenu *qMenu = new QMenu(this);
    qMenu->addAction(test);
    
    QAction *optionsAction = new QAction("Options", this);
    optionsAction->setSoftKeyRole(QAction::PositiveSoftKey);
    optionsAction->setMenu(qMenu);
    addAction(optionsAction);
    

    }

    ------ Main.h ------
    #include <QApplication>
    #include <QMainWindow>
    #include <QDialog>
    #include <QMenu>
    #include <QAction>

    class MainWindow : public QMainWindow
    {
    Q_OBJECT
    public:
    MainWindow(QWidget *parent = 0);
    ~MainWindow() {};
    public slots:
    void startTest(void);
    };

    ------ test_dialog.h ------
    #include <QDialog>
    #include <QMenu>
    #include <QAction>

    class TestDialog : public QDialog
    {
    Q_OBJECT
    public:
    TestDialog(QWidget *parent = 0);
    ~TestDialog(){};
    public slots:
    void testSlot(void){};
    };

    ------ test.pro ------

    QT += core gui
    TARGET = test1
    TEMPLATE = app

    SOURCES += main.cpp
    test_dialog.cpp

    HEADERS +=
    main.h
    test_dialog.h

    CONFIG += mobility
    MOBILITY =

    symbian {
    TARGET.UID3 = 0xef9fc577
    # TARGET.CAPABILITY +=
    TARGET.EPOCSTACKSIZE = 0x14000
    TARGET.EPOCHEAPSIZE = 0x020000 0x800000
    }

    @





  • Thanks! That solved the problem. Slightly irritating to have to do that for every widget in the
    real app. Is there some global #define that could turn it off?

    Grumpy



  • You can do it like this:

    @
    QWidgetList allWidgets = QApplication::allWidgets();
    foreach(QWidget* widget, allWidgets)
    widget->setContextMenuPolicy(Qt::NoContextMenu);
    @



  • Thanks, that's how I'll do it.



  • [quote author="grumpy" date="1299694126"]Thanks, that's how I'll do it.[/quote]

    you are welcome buddy :)


Log in to reply
 

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