×

Discussion Board

Results 1 to 6 of 6
  1. #1
    Regular Contributor
    Join Date
    Aug 2009
    Posts
    331

    How to Disable/remove "Exit" menu option?

    Hi,

    Is it possible to disable/remove the Right side Default "Exit" menu option from the main window?

    Actually I want to rename this Right side "Exit" Menu Option to "Remove" or "Delete". In Left side I want "Options" menu with different option items like Add,Remove etc... and right side "Delete" menu.

    This "Exit" option comes by default, and if I use:

    MainWindow w;
    w.showFullScreen();
    then this option goes away.

    Is there any other workaround for this, if I want to use my own Menu options?

    Thanks....

  2. #2
    Super Contributor
    Join Date
    Oct 2007
    Location
    Deva, Romania
    Posts
    3,471

    Re: How to Disable/remove "Exit" menu option?

    Hi,

    Yes, it's possible to rename it. Just create a new QAction with the text you want, set its softkey role to QAction::NegativeSoftkey and add it to the main window.

    Code:
    //In the main window constructor, for example
    QAction* exitAction = new QAction(this);
    exitAction->setText("Remove");
    exitAction->setSoftKeyRole(QAction::NegativeSoftKey);
    this->addAction(exitAction);

  3. #3
    Regular Contributor
    Join Date
    Aug 2009
    Posts
    331

    Re: How to Disable/remove "Exit" menu option?

    Thanks buddy...

    It's working...

  4. #4
    Regular Contributor
    Join Date
    Aug 2009
    Posts
    331

    Re: How to Disable/remove "Exit" menu option?

    Hi, is it possible to hide the "Actions" menu item in the Left side"Options" Menu?

    I changed the window property "contextMenuPolicy" from "DefaultContextMenu" to "NoContextMenu" and also ""PreventContextMenu, but the "Actions" item is still displayed in the "Options" Menu. How to hide this "Actions" option.

    Thanks...

  5. #5
    Super Contributor
    Join Date
    Oct 2007
    Location
    જુનાગઢ - India
    Posts
    3,034

    Re: How to Disable/remove "Exit" menu option?

    Call contextMenuPolicy(Qt::NoContextMenu) for all your child widget also.

  6. #6
    Regular Contributor
    Join Date
    Aug 2009
    Posts
    331

    Re: How to Disable/remove "Exit" menu option?

    Quote Originally Posted by savaj View Post
    Call contextMenuPolicy(Qt::NoContextMenu) for all your child widget also.
    Hi Savaj,

    I have already used this, still the "Actions" item is there. Actually I have "Options" Menu and only one item "About". But when I run on real device, it is showing 2 things:
    "About" and "Actions".

    I have used the following code:

    QAction* actionAbout = new QAction(tr("About"), this);
    menuBar()->addAction(actionAbout);
    connect(actionAbout, SIGNAL(triggered()), this, SLOT(aboutoptionClicked()));
    Also changed the property to "contextMenuPolicy(Qt::NoContextMenu)".

    Any suggestions?

    Thanks...

Similar Threads

  1. How to use "Back" option instead of "Exit"
    By anup007star in forum Symbian
    Replies: 3
    Last Post: 2009-06-30, 13:23
  2. Replies: 3
    Last Post: 2009-06-18, 21:42
  3. Replies: 21
    Last Post: 2006-10-11, 09:17
  4. Option of "Exit" with Form on S60
    By johnmobile in forum Mobile Java General
    Replies: 1
    Last Post: 2005-03-03, 10:35
  5. remove "Exit" Command?
    By toddhodes in forum Mobile Java General
    Replies: 0
    Last Post: 2003-04-17, 02:27

Posting Permissions

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