Results 1 to 5 of 5

Thread: remove default action QMenuBar() s60

  1. #1
    Join Date
    Apr 2010
    Posts
    8
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default remove default action QMenuBar() s60

    Hi there,

    I have an app for symbian s60 that is running great. I am trying to finish off the last few bugs and am having trouble removing an action whose text is "Action" from my QMenuBar. It seams there is a default action inserted at the beginning of the new QMenuBar.

    I followed the tutorials (both regular and dynamic menu creation) from nokia forums, and my current code looks like:

    mainwindow.h

    Qt Code:
    1. public slots:
    2. void aboutAction();
    3. void helpAction();
    4.  
    5. private:
    6. QAction* menuAboutAction;
    7. QAction* menuHelpAction;
    To copy to clipboard, switch view to plain text mode 
    mainwindow.cpp (createMenu() is called in constructor)
    Qt Code:
    1. void MainWindow::createMenu()
    2. {
    3. menuAboutAction = new QAction("About", this);
    4. menubar()->addAction(menuAboutAction);
    5. connect(menuAboutAction,SIGNAL(triggered()), this, SLOT(aboutAction()));
    6.  
    7. menuHelpAction = new QAction(tr("Help"),this);
    8. menubar()->addAction(menuHelpAction);
    9. connect(menuHelpAction,SIGNAL(triggered()), this, SLOT(helpAction()));
    10. }
    To copy to clipboard, switch view to plain text mode 
    when menu is opened options available are : "show open apps"; "About"; "Help"; "Actions";. I would like to remove "Actions".
    I am testing this on a nokia 6970 (surge) running symbian s60 v3.2. same issue occurs in s60 v5 emulator. I have tried calling optionsMenu->clear(); before adding actions, and calling optionsMenu->removeAction(action) (tried a few guesses to remove default with no luck). menuBar in mainwindow.ui has been created (tried with and without with same results).

    The demo app from nokia (optionsmenu) runs great on my device, and it looks to me like they are created the same.
    Thanks for any help.

  2. #2
    Join Date
    Apr 2010
    Posts
    8
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: remove default action QMenuBar() s60

    I have figured out that something in QtGui is creating that action. I was commenting out bits of code trying to figure out what object was creating the action, and as soon as any graphic widget (I tested button, listWidget, doubleSpinBox) is placed in a .ui via designer then the unwanted action appears.

    I am going to try to create graphic widgets in code instead of via designer to see if that is an OK workaround. I am also trying to get my hands on a s60 v5 device to test, as the issue shows up on s60 v 3.2.

  3. #3
    Join Date
    Apr 2010
    Posts
    8
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: remove default action QMenuBar() s60

    Has anyone else deployed an app for symbian in Qt that made use of menuBar()? I have everything running perfect, almost ready to get signed and submit to Ovi store. I just need for my menu to display only the correct actions. When I get a list of actions held by the menuBar, the action (labeled 'Action') I wish to remove is not in the list.

    When run in the emulator the menu is correct. But when run on my actual device, the issue shows up. All my application logic is fine, if I compile without widgets in my .ui, the menu is correct, but as soon as I add any widget to my gui, the action 'Action' shows up in my menuBar().

  4. #4
    Join Date
    Sep 2009
    Location
    Finland
    Posts
    63
    Thanks
    1
    Thanked 22 Times in 19 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows Symbian S60

    Default Re: remove default action QMenuBar() s60

    Most probably you have context menu enabled for the widget. If context menu is enabled then in Symbian port of Qt, context action "Actions" is added to menu in real device.

    Try changing the property of context menu and see whether it makes any difference.

  5. The following 2 users say thank you to tsp for this useful post:

    iliyan (21st December 2010), Lawand (23rd November 2010)

  6. #5
    Join Date
    Apr 2010
    Posts
    8
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: remove default action QMenuBar() s60

    You are exactly right tsp. I needed to call setContextMenu(QAction::NoContextMenu) on every widget created in the ui before I called that widget to be shown (I was doing this via setCentralWidget() but show() and exec() behave similar).

    There is a demo in Qt examples called softkeys in the fluidlauncher that is a great tutorial on how to do everything correctly in 4.6.3 (a lot changed since 4.5.x)

  7. The following user says thank you to pleasuretek for this useful post:

    Lawand (23rd November 2010)

Similar Threads

  1. Remove default buttons
    By Yayati.Ekbote in forum Qt Programming
    Replies: 10
    Last Post: 16th April 2010, 18:27
  2. QTreeView default drag action
    By onamatic in forum Qt Programming
    Replies: 2
    Last Post: 1st March 2010, 07:37
  3. Hide Qmenubar
    By user_mail07 in forum Qt Programming
    Replies: 5
    Last Post: 10th December 2008, 22:16
  4. How to remove default 'ENTER' from QDialogButtonBox
    By janus in forum Qt Programming
    Replies: 6
    Last Post: 12th September 2008, 21:56
  5. No action checked in an exclusive action group
    By SkripT in forum Qt Programming
    Replies: 12
    Last Post: 13th February 2006, 06:19

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.