Results 1 to 3 of 3

Thread: Change how checkable,exclusive grouped QActions are drawn on menu

  1. #1
    Join Date
    Oct 2009
    Posts
    26
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Change how checkable,exclusive grouped QActions are drawn on menu

    I have a set of qactions defined as checkable and belonging to a group:

    Qt Code:
    1. KAction* a;
    2. QActionGroup* group1=new QActionGroup(this);
    3. group1->setExclusive(true);
    4. a = new KAction(KIcon("edit-select"),i18n("Select mode"),this);
    5. a->setCheckable(true);group1->addAction(a);
    6. a->setChecked(true); //default action
    7. actionCollection()->addAction("mouse_pointer", a);
    8. connect(a,SIGNAL(triggered(bool)),this,SLOT(setModeNone()));
    To copy to clipboard, switch view to plain text mode 

    I need them checkable so they can remain "pushed" in my mode toolbar, to show the user the current mode of operation.
    I need them exclusive, because only one mode of operation is active.
    This works fine , except that I don't like the use of these QActions to my menus.
    I added them to a menu and they shown up with radio buttons in front of them:
    plasma-desktoprDi436.png
    But I want to show only the text/icon/keys and not any radiobuttons,checkboxes.
    Is there a way to force hide the buttons ONLY in the menu?

    Thank you in advance

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,420
    Thanks
    37
    Thanked 1,545 Times in 1,495 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Change how checkable,exclusive grouped QActions are drawn on menu

    Visualizations such as this are part of the widget style.
    Usually users prefer to have the consistency, i.e. all applications should use the same style.

    You can of course override the style with a different one, even with one of your own.
    There is also the option of using stylesheets, though they are obviously more limited than the full style implementations.

    Cheers,
    _

  3. #3
    Join Date
    Oct 2009
    Posts
    26
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Change how checkable,exclusive grouped QActions are drawn on menu

    Quote Originally Posted by anda_skoa View Post
    Visualizations such as this are part of the widget style.
    Usually users prefer to have the consistency, i.e. all applications should use the same style.

    You can of course override the style with a different one, even with one of your own.
    There is also the option of using stylesheets, though they are obviously more limited than the full style implementations.

    Cheers,
    _
    Thinking again the styling "glitch" I asked about in my first post. I came to the conclusion that I agree with you. If the "exclusive & checkable" means radio buttons in the menu, then maybe I should leave them like this.

Similar Threads

  1. Replies: 4
    Last Post: 11th October 2013, 10:23
  2. Replies: 0
    Last Post: 23rd December 2010, 07:40
  3. Checkable and exclusive Actions (Toolbar buttons)
    By winder in forum Qt Programming
    Replies: 1
    Last Post: 11th February 2010, 02:59
  4. Can you change which widgets are drawn on top?
    By Spectralist in forum Newbie
    Replies: 4
    Last Post: 6th December 2009, 18:31
  5. Strange behavior of checkable menu items..
    By jiapei100 in forum Qt Tools
    Replies: 1
    Last Post: 28th October 2009, 19:58

Tags for this Thread

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.