[Qt-interest] Detecting mouseRelease w/o subclassing

Paul England pengland at cmt-asia.com
Fri Jul 9 05:23:50 CEST 2010


This is driving me up the wall.  I can't for the life of me figure out
why there are multiple signals which denote th estart of a mouse event,
but not a single one for the end?   Great.

Long story short:
QHeaderView::sectionResized( int, int, int ) is signalled way too much. 
If I want to resize a section (and actually other sections based on that
one) the signal is called multiple times for each true resize.  I have a
nice subclassed QHeaderView, and when I reimplement mouseReleaseEvent()
and emit my own signal, it works, except there's some magic going on in
the base class's mouseReleaseEvent() (which ensures everything is the
right size).  So, in mine, I get this left over crap on the right side,
which is very unsightly.

So, other than a QTimer (which would be pretty ghetto) and
reimplementation which I've found to be far too cumbersome for something
so simple, is there anything else I can check to tell if the mouse
button is still depressed when my slot is called?



More information about the Qt-interest-old mailing list