PDA

View Full Version : How to keep a pushbutton be down unless if want to make it be up?



bookmarkernj
2nd July 2007, 15:59
Hi, everybody:

I want keep a pushbutton be in a down state until I want to chang it in a up state. I use a qgroupbox as several pushbutton's parrent, I can use setDown(true) to make a pushbutton in a down state, but to my disappointed, when my mouse clicked in a QScrollArea window which is in the same program, the pushbutton in down state will automatically change to be in up state. Why?
What i want is make a pushbutton always be in a down state until I make it be in up state?
What can I do? :confused:
Thanks lot.

bookmarkernj
2nd July 2007, 16:29
Oh, guys:
I figure it out. In fact, very simple, I'm a begainer, sigh.
only set those pushbutton to be checkable, and when a click on one of the pushbutton,
you first check whether isDown() (Note: can't use isChecked() ) is true, if false, then call setChecked(true) on the clicked button, and set other buttons's check state of the groupbox to be false using setChecked(false) member function of QPushButton .
Anyway , thanks you! Qt Center, you provide a good communication platform for programmer or developers using Qt. :)