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. Creating a menu
QtWS25 Last Chance

Creating a menu

Scheduled Pinned Locked Moved Mobile and Embedded
9 Posts 3 Posters 7.1k Views
  • 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.
  • L Offline
    L Offline
    lamprosg
    wrote on last edited by
    #1

    I'm trying to create a menu, so I tried this.

    @
    ui->setupUi(this);

    //Creating actions
    insert = new QAction(tr("Insert"),this);
    connect(insert, SIGNAL(triggered()), this, SLOT(on_InsertButton_clicked()));
    detect = new QAction(tr("Check"),this);
    connect(detect, SIGNAL(triggered()), this, SLOT(on_DetectButton_clicked()));
    about = new QAction(tr("About"),this);
    connect(about, SIGNAL(triggered()), this, SLOT(on_AboutPushButton_clicked()));
    
    //Creating menu
    eyemenu = new QMenu("Options", this);
    eyemenu->addAction(insert);
    eyemenu->addAction(detect);
    eyemenu->addSeparator();
    eyemenu->addAction(about);
    

    @

    But, nothing show up on the left side of the menu on Symbian. Just the right 'Exit' button.
    Is there any mistake on this? Thanks.

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

      If you are using a QMainWindow you should use a menuBar() variable in order to add the menu there like:

      @
      ui->menubar->addMenu(eyemenu);
      @

      1 Reply Last reply
      0
      • J Offline
        J Offline
        jdbastardy
        wrote on last edited by
        #3

        if you wish to add a popup menu yuo can do something like this
        @
        void ListWidget::customContentsMenu( const QPoint &pos )
        {
        QPoint globalPos = this->mapToGlobal(pos);
        menu->exec( globalPos );
        }
        @

        http://mattias-cibien.co.cc

        • Prepare for Qt consequences.
        1 Reply Last reply
        0
        • L Offline
          L Offline
          lamprosg
          wrote on last edited by
          #4

          Thanks,

          I created a menubar with Qt creator's UI. It seems to be working ok, but I also get an "actions" option when I run it on the phone (which does nothing). No idea what that is :o

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

            I don't know if it's a bug or a feature but the steps for removing the actions option are:

            Go to the Qt Designer (you can do this in the code as well)

            Select every Widget in your form

            In the properties pane find contextMenuPolicy and change it to NoContextMenu for every widget inside your form (could be a QWidget, QDialog or a QMainWindow).

            See the screenshot below

            !http://i.imgur.com/07z8J.png(pic)!

            1 Reply Last reply
            0
            • L Offline
              L Offline
              lamprosg
              wrote on last edited by
              #6

              Thanks, actions option is gone. :)

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

                I probably have to write a wiki article on how to remove the strange actions menu.

                1 Reply Last reply
                0
                • J Offline
                  J Offline
                  jdbastardy
                  wrote on last edited by
                  #8

                  [quote author="Milot Shala" date="1295900993"]I don't know if it's a bug or a feature but the steps for removing the actions option are:

                  Go to the Qt Designer (you can do this in the code as well)

                  Select every Widget in your form

                  In the properties pane find contextMenuPolicy and change it to NoContextMenu for every widget inside your form (could be a QWidget, QDialog or a QMainWindow).

                  See the screenshot below

                  !http://i.imgur.com/07z8J.png(pic)![/quote]

                  That's great :)

                  http://mattias-cibien.co.cc

                  • Prepare for Qt consequences.
                  1 Reply Last reply
                  0
                  • M Offline
                    M Offline
                    milot.shala
                    wrote on last edited by
                    #9

                    We have also a wiki page for this. I will improve it in the near future: "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

                    • Login

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