×

Discussion Board

Results 1 to 3 of 3
  1. #1
    Registered User
    Join Date
    Dec 2010
    Posts
    1

    how to set the Menu on Nokia Device

    Hi Guys.

    I got a problem with setting the menu on mobile devices.

    That's the code i used in my "Mainwindow.cpp" :

    Code:
        ///////////////////////////////////////////////////////
        // Options Menu
        QAction* options = new QAction(tr("Test Select"), this);
    
        QMenu *menuOptions = new QMenu(this);
        menuOptions->addAction(tr("Test 1"), this, SLOT(showIndex()));
        menuOptions->addAction(tr("Test 2"), this, SLOT(showIndex()));
        options->setMenu(menuOptions);
    
    
        ///////////////////////////////////////////////////////
        // Exit Action
        QAction* exit = new QAction(tr("Test Exit"), this);
        connect(exit, SIGNAL(triggered()), this, SLOT(showIndex()));
    
        // #if defined(Q_OS_SYMBIAN)
        // Set Soft Key locations
        // QAction::PositiveSoftKey = Left Soft Key
        // This will set the left soft key menu
    //    options->setSoftKeyRole(QAction::PositiveSoftKey);
        options->setSoftKeyRole(QAction::PositiveSoftKey);
    
        // Add Actions Direct to dialog
        // QAction::NegativeSoftKey = Right Soft Key
        // This will set the right softkey caption and action
        addAction(options);
        addAction(exit);
    When I start the simulator, it shows the right captions, but doesn't work, if i click on it.
    I used the "showIndex()"-function in the Slots just for testing the menu.

  2. #2
    Registered User
    Join Date
    Nov 2007
    Location
    Espoo, Finland
    Posts
    25

    Re: how to set the Menu on Nokia Device


  3. #3
    Regular Contributor
    Join Date
    Oct 2008
    Location
    Oslo, Norway
    Posts
    329

    Re: how to set the Menu on Nokia Device

    That's a good article, however it doesn't mention Simulator and its problems with displaying menus. If you search this forum you'll notice it's a common problem.

    See QTSIM-61 for more details.

    Trafix, your code should work when run on a device (except that 'exit' action won't show up as it has no softkey role). However, I suggest that you use QMainWindow's own QMenuBar instead, as in the article linked to by miksuh (How to create a menu). By doing this, your menu actions will appear in the simulator's control window, under 'Application' - even though it doesn't look right in the simulator itself. But at least you can test the functionality of those actions.

Similar Threads

  1. how to set allignment in the center for any nokia device
    By rohitnegi in forum Symbian User Interface
    Replies: 4
    Last Post: 2010-06-16, 10:58
  2. How to set a cursor to selected menu item previously?
    By whasj35 in forum Symbian User Interface
    Replies: 4
    Last Post: 2009-06-23, 11:47
  3. how i can set Open menu in my app
    By 1symbian1 in forum Symbian
    Replies: 5
    Last Post: 2008-10-09, 13:36
  4. can we set different font in menu.
    By pk_mani in forum Symbian User Interface
    Replies: 0
    Last Post: 2008-01-14, 06:14
  5. Set Menu Command name in Arabic?
    By chishti.hameed in forum Symbian User Interface
    Replies: 4
    Last Post: 2005-06-24, 13:04

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×