The PyQt4 QTableWidget has both cellPressed and cellClicked signals. From the name, and the little experimentation I did with them, they appear to do exactly the s开发者_如何转开发ame thing. Is there a difference between the two?
These signals on cells are not sharply documented (that I can find) but I'd interpret them by analogy with the pressed
, clicked
, and released
signals on buttons:
pressed means the mouse's left button's been pressed down inside the widget,
released means the mouse's left button's been released (let up) inside the widget,
clicked means the mouse's left button's been pressed, then released (let up), both inside the widget
So if you press the button down inside the widget, hold it down, move the mouse elsewhere, and only then release the mouse's button, then you should only see the pressed
signal, but neither of the other two; while any clicked
signal always implies both pressed
and released
have also been signaled.
I believe that normal UI behavior should be to respond to clicked
only, unless you want to do something special if the button's pressed and not released for a certain time (i.e., held down for a prolonged time).
精彩评论