Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. Symbian strange extra "Actions" in Options button

Symbian strange extra "Actions" in Options button

Scheduled Pinned Locked Moved Mobile and Embedded
6 Posts 2 Posters 2.8k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    grumpy
    wrote on last edited by
    #1

    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
    }

    @

    1 Reply Last reply
    0
    • M Offline
      M Offline
      milot.shala
      wrote on last edited by
      #2

      Look at this: "http://developer.qt.nokia.com/wiki/Remove_actions_options_menu_in_Symbian":http://developer.qt.nokia.com/wiki/Remove_actions_options_menu_in_Symbian

      1 Reply Last reply
      0
      • G Offline
        G Offline
        grumpy
        wrote on last edited by
        #3

        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

        1 Reply Last reply
        0
        • M Offline
          M Offline
          milot.shala
          wrote on last edited by
          #4

          You can do it like this:

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

          1 Reply Last reply
          0
          • G Offline
            G Offline
            grumpy
            wrote on last edited by
            #5

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

            1 Reply Last reply
            0
            • M Offline
              M Offline
              milot.shala
              wrote on last edited by
              #6

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

              you are welcome buddy :)

              1 Reply Last reply
              0

              • Login

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • Users
              • Groups
              • Search
              • Get Qt Extensions
              • Unsolved