[Qt-interest] Detecting mouseRelease w/o subclassing
Paul England
pengland at cmt-asia.com
Sun Jul 11 07:31:45 CEST 2010
Thanks Andre.
>>So, I conclude you did not call the superclass's implementation from
your subclass? That usually fixes such issues.
I actually did.
void myHeader::sectionResized( int a, int b, int c )
{
QHeaderView::sectionResized( a, b, c );
emit( my_signal() );
}
But alas, I had the same issue. It's very likely I did something else
wrong though.
It was a long day. :)
I actually got around the problem w/o calling the superclass'
implementation.
I just had to do some calculating of my own to resize the widget. But
later
down the road eventFilter (which I was unfamailiar with) will probably
good to know.
Cheers!
Paul
On 07/09/2010 05:19 PM, Andre Somers wrote:
> On 9-7-2010 5:23, Paul England wrote:
>
>> 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, I conclude you did not call the superclass's implementation from
> your subclass? That usually fixes such issues.
> If you don't want to subclass, but still listen in on the events, use an
> event filter. See QObject::eventFilter and setEventFilter for more
> information.
>
>> 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?
>>
>>
> QApplication::mouseButtons return that, as Scott remarked.
>
> André
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100711/c24c0af8/attachment.html
More information about the Qt-interest-old
mailing list