Results 1 to 4 of 4

Thread: how i can add checkboxes to contextMenus?

  1. #1
    Join Date
    Apr 2006
    Posts
    122
    Thanks
    18
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default how i can add checkboxes to contextMenus?

    How i can make checkbox a part of menu item sothat menu will be like we have when we right click over designers toolbar.

    quickNitin

  2. #2
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: how i can add checkboxes to contextMenus?

    You have to make the appropriate action checkable. See QAction::setCheckable().
    J-P Nurmi

  3. #3
    Join Date
    Apr 2006
    Posts
    122
    Thanks
    18
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default Re: how i can add checkboxes to contextMenus?

    thanks jacek,
    i have some more doubt.
    What i want to do is to make submenu checkable.
    This submenu contains menu item responsible for displaying various shapes.
    When this submenu is not checked all item displayed by submenu's menu item are not shown.
    Also subMenu should not expand. how i can avoid submenu from expanding.

  4. #4
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: how i can add checkboxes to contextMenus?

    Quote Originally Posted by quickNitin View Post
    thanks jacek,
    i have some more doubt.
    What i want to do is to make submenu checkable.
    This submenu contains menu item responsible for displaying various shapes.
    When this submenu is not checked all item displayed by submenu's menu item are not shown.
    Also subMenu should not expand. how i can avoid submenu from expanding.
    Heh, jacek indeed deserves to be thanked for doing such a great job on the forums..
    Anyway.. a single action can be checkable, a submenu can't. And it wouldn't make any sense either. Consider an interface which requires user to click on the submenu item to expand it (this is the case for example with the motif style). What should be done upon click over the submenu? Change check state or show the menu? You can disable the submenu if you want to prevent it from to be shown.
    J-P Nurmi

  5. The following user says thank you to jpn for this useful post:

    quickNitin (16th November 2006)

Similar Threads

  1. Replies: 3
    Last Post: 2nd April 2006, 07:48

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.