PDA

View Full Version : No action checked in an exclusive action group



SkripT
6th February 2006, 18:56
Hi, I have a group of two exclusive actions with a QActionGroup. Both actions are checkables. The problem is that if I press under an action that is checked, the action continues checked but what I really want is to uncheck it. The only way to uncheck an action is by pressing the other action of the group. Is it a simple way of doing what I want without add a new slot? Thanks

Chicken Blood Machine
6th February 2006, 19:23
Call setExclusive(false) on the action group.

SkripT
7th February 2006, 00:22
Finally what I have done is connect, for both actions, the signal toogled of an action with the slot setdisabled of the other action

Chicken Blood Machine
7th February 2006, 00:27
Finally what I have done is connect, for both actions, the signal toogled of an action with the slot setdisabled of the other action

Seems a bit 'brute force'. Didn't my solution work?

SkripT
11th February 2006, 11:01
Sorry that I reply too late but I thought that the solution would be ok, but don't :mad: and I didn't read again the htread


Seems a bit 'brute force'
That's exactly the problem :D


Call setExclusive(false) on the action group.

I need the two actions being exclusive: if I activate an action I want to inactivate the other action. The problem is that if I push under an activated (checked) action, the action remains activated but what I really want is to disactivate it. I would like to know if it's possible to make it easily connecting only the signals and slots provided with QAction. I think that the solution should be something like: Dont' put the actions in an action group and when a signal toggled(true) is recevied of some of both actions I have to call setChecked(false) of the other action.
Another problem that I noticed is that if I put both actions in an exclusive action group and I push under a checked action, the button of the action is painted like if I was pushing it to activate it again but no signal (toggled or triggered) is emited :confused: I suppose that 's beacuse the state of the action hasn't changed, but should be a way to know if the action has been pushed again...


Thanks.

Chicken Blood Machine
11th February 2006, 21:37
Sorry that I reply too late but I thought that the solution would be ok, but don't :mad: and I didn't read again the htread


That's exactly the problem :D



I need the two actions being exclusive: if I activate an action I want to inactivate the other action. The problem is that if I push under an activated (checked) action, the action remains activated but what I really want is to disactivate it. I would like to know if it's possible to make it easily connecting only the signals and slots provided with QAction. I think that the solution should be something like: Dont' put the actions in an action group and when a signal toggled(true) is recevied of some of both actions I have to call setChecked(false) of the other action.
Another problem that I noticed is that if I put both actions in an exclusive action group and I push under a checked action, the button of the action is painted like if I was pushing it to activate it again but no signal (toggled or triggered) is emited :confused: I suppose that 's beacuse the state of the action hasn't changed, but should be a way to know if the action has been pushed again...


Thanks.


I think there is a confusion about what 'exclusive' means. If two (or more) buttons are exclusive then one of them should always be checked. Therefore pushing one that is already checked should not deselect it and should not fire any signal because the state has not and should not change.

The behaviour that you descibe above is bizarre and non-standard and yes, you will have to code it yourself somehow.

SkripT
11th February 2006, 23:24
The behaviour that you descibe above is bizarre and non-standard ...

If I want this behaviour is because I have seen it in many appliactions. If you are using Windows XP take a look at the Microsoft Photo Editor program. The behaviour of the buttons to select an area of the image and to define the transparent color follow this behaviour. As you see it's not as bizarre and non-standard as you comment... ;)

wysota
11th February 2006, 23:37
The fact that it is used in one application (even if it is a popular one), doesn't automatically make it "standard".

Chicken Blood Machine
12th February 2006, 00:17
If I want this behaviour is because I have seen it in many appliactions. If you are using Windows XP take a look at the Microsoft Photo Editor program. The behaviour of the buttons to select an area of the image and to define the transparent color follow this behaviour. As you see it's not as bizarre and non-standard as you comment... ;)

I don't think I have Microsoft Photo Editor on Windows XP - regardless - proof by selected example is no proof at all. The writers of MS photo editor probably had to speciifcally code that behaviour too :-)

SkripT
12th February 2006, 01:56
You are right, but I dont' think that the behaviour that I comment is a strange behaviour. Basically is the same that having a group of exclusive actions with the only difference that I want that the activated/checked action could be unchecked without having to check another action. That's all. Finally I have solved it with a new slot.

wysota
12th February 2006, 11:26
The thing you want can be easily achieved by adding another item titled "None of the above".

SkripT
12th February 2006, 11:34
The thing you want can be easily achieved by adding another item titled "None of the above".
Yes that's the other solution that I was managing too. I have to decide which of both I will put on the final app. Thanks.

Chicken Blood Machine
13th February 2006, 07:19
You are right, but I dont' think that the behaviour that I comment is a strange behaviour. Basically is the same that having a group of exclusive actions with the only difference that I want that the activated/checked action could be unchecked without having to check another action. That's all. Finally I have solved it with a new slot.
Well then they're definitely not 'exclusive'. I'm glad you found a solution for your problem though.