PDA

View Full Version : How to prohibit click to button



somename
27th May 2010, 20:13
I have QGroupButtons of 5 buttons, and I want that all of them will be disabled without color changing..
setDisable() is suitable, but this changing color..

Zlatomir
27th May 2010, 20:19
You can disconnect the clicked signal.

somename
27th May 2010, 21:54
No, any othter idea.
what I must to do that button.setEnable(true) and button.setEnabled(false) have same view?

Lykurg
27th May 2010, 21:59
No, any othter idea.Why not?
what I must to do that setEnable(true) and setEnabled(false) have same view?Well it is the idea that it is displayed differently. So this is the wrong way to go!
Stick with the signals as Zlatomir said. You also can use QObject::blockSignals() which could be more easier to use.

squidge
27th May 2010, 21:59
You can take over the drawing of the button, but what you are trying to do is directly against the user interface guidelines.

Is there a reason you don't want to inform the user the button isn't clickable?

somename
27th May 2010, 22:11
It is too hard to explain, because my English is bad.
Ok, i will try.

I have 5 buttons, after clicked on one of them sound start playing, and while sound are playing, user can select any of 5 buttons, and i don't want this (yeah, I can do BlockSignal, but I always can select any other button).
If after cliked i do "setDisabled(true) " for all 5 buttons, there is some unlikely view when all buttons are Disabled

squidge
27th May 2010, 22:17
I don't see the difference between:
1) All the buttons are disabled
2) The buttons look enabled, but are not clickable

In fact, I'd say (2) would be more confusing.

Maybe a better way would be: Whilst sound is playing, you show another modal window saying "Playing sound" or whatever. Due to the fact the window is modal, it blocks all mouse clicks to your other window with the 5 buttons in. Therefore the 5 buttons look enabled, but no one can click on them, and they get visual feedback why they can't click on them. When sound is finished, you destroy the window, therefore you can click on buttons again.

somename
27th May 2010, 22:29
the difference between this:
when all the buttons are disabled, I can't select any button, but when all buttons are enabled, but not clickable, I can do this thing:
4692i.e. I can checked some other button, but I don't want this

somename
27th May 2010, 22:32
I have forgotten to say you, that my button is checkable