PDA

View Full Version : Change how checkable,exclusive grouped QActions are drawn on menu



hayzel
3rd January 2015, 21:11
I have a set of qactions defined as checkable and belonging to a group:



KAction* a;
QActionGroup* group1=new QActionGroup(this);
group1->setExclusive(true);
a = new KAction(KIcon("edit-select"),i18n("Select mode"),this);
a->setCheckable(true);group1->addAction(a);
a->setChecked(true); //default action
actionCollection()->addAction("mouse_pointer", a);
connect(a,SIGNAL(triggered(bool)),this,SLOT(setMod eNone()));


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:
10860
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

anda_skoa
4th January 2015, 08:44
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,
_

hayzel
4th January 2015, 20:19
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.