c++ - selecting or deselecting a row in qt4 -


how set or reset counter when row of table selected or deselected using mouseevent in qt4?

assuming using qtableview or qtablewidget table, can receive qt-signal whenever set of selected cells has changed doing this:

connect(thetable.selectionmodel(), signal(selectionchanged(const qitemselection &, const qitemselection &)), this, slot(selectionwaschanged(const qitemselection &, const qitemselection &))); 

note that work whether selection changed via mouse, keyboard, or other means. if need callback when selection made via qmouseevent, implement overriding qtableview::mousepressevent() and/or qtableview::mousereleaseevent() in subclass , setting flag true before calling superclass (and setting false again afterwards) , checking flag within selectionwaschanged() slot.


Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -