How would it be possible to make a button not aceept clicks?
I have clicked it once and set an icon to it..and now I don't want to disable it(because icon goes grey >.<),but I want to keep it enabled,with no clicks..
Thank you.
How would it be possible to make a button not aceept clicks?
I have clicked it once and set an icon to it..and now I don't want to disable it(because icon goes grey >.<),but I want to keep it enabled,with no clicks..
Thank you.
You can disconnect or block signals.
"BumbleBee" (25th March 2011)
Yeah,I disconnected it!
Thank you.
Just a note - that sort of behavior has the potential to be very frustrating to users. Clicking a button that looks and behaves as if it is active and having it do nothing indicates that something isn't right, that the program has failed in some way.
I'd suggest changing the button's appearance in some way to indicate that it has fulfilled its one-shot role.
That's a call you'll have to make for yourself. There are always exceptions. As a general rule, though, it's often a bad idea to tinker with normal GUI behaviors.
Hey guys,how can I check for winner?
I cannot check,because buttons have no value(or sth..)..so I'd do: if(btn[0] == x && btn[1] == x && btn[2] == x )
Thank you.
There are several approaches. First, you can derive a trivial extension of QPushButton that can be assigned a value depending on state, row and column or whatever.
Better would be to completely sever any connection between application logic and application UI, and have the buttons manipulate some underlying data structure that ultimately drives game logic. This makes it easy to replace the UI with a different one while leaving the rest of the program unchanged. For more information, look up the "Model/View/Controller".
you can use setProperty to set a "x" and "0" and access it by callling propertyI cannot check,because buttons have no value(or sth..)
it will be like ,
when you set property
btn[0]->setProperty("marked",false);
when you access, if(btn[0]->property("marked").toBool())
hope it helps
bala
Last edited by BalaQT; 26th March 2011 at 16:15. Reason: ex code added
My code is:
Qt Code:
if(btn[0]->property("x").toBool() && btn[1]->property("x").toBool() && btn[2]->property("x").toBool()) //msgBox here.;To copy to clipboard, switch view to plain text mode
And it gives a bug,when I press any btn,the msg appears(i mean without completing a line of Xs..it skips everything on first click....)
Bookmarks