[PyKDE] setMouseTracking

Frederick Polgardy Jr polgardy at bodacion.com
Wed Apr 9 21:31:01 BST 2003


This is one of the strange cases in Qt where you don't use signals and 
slots.  You subclass your QWidget/QCanvas and provide a mouseMoveEvent() 
handler.  (Actually there are a bunch more: check out the QWidget header 
file.)  In fact, I'm guessing you can rename your contentsMouseMove() 
method to mouseMoveEvent(), and it will magically start working. :)

Fred

On Wednesday 09 April 2003 02:22 pm, Maxim Olivier-Adlhoch wrote:
> Hello all,
>
>
> I am new to Qt and python too... be gentle, please ;-)
>
> I am pretty knowleged about REBOL and many other languages, so python is
> pretty easy to assimilate.
>
> I have been fiddling around with pyqt , using the QCanvas in order to
> feel its power (I must say I like it a lot so far :-)
>
>
> but as it always happens in programming, I have stumbled on a enigma... I
> cannot get pyQt to give me straight mouse moves.  I want to be able to
> highlight stuffed based on cursor position, and well, you can't really do
> that with any of the mouse buttons pressed ... so:
>
> I tried calling  myQCanvasView.setMouseTrackingFlag(1)
>
> and I'm not getting any more messages than before...
>
> I even tried snooping the events in an eventFilter() class attached to
> the myQCanvasView and there are never any more mouse moves which pass by,
> just the normal and default mouse messages.
>
> I tried calling myApp.setGlobalMouseTracking(1) and that does not help...
>
>
> can anyone tell me what I must do more, for mouse events to reach my
> contentsMouseMove() method?
>
> ps I am using the canvas.py example script , so you can explain it with
> regards to that nice piece of code...
>
>
>
> many thanks ;-)
>
>
> -max
> -----------
> meteor Studios, T.D.
> -----------
> "Never Argue with an idiot. They will bring you down to their level and
> beat you with experience"
>
> _______________________________________________
> PyKDE mailing list    PyKDE at mats.gmd.de
> http://mats.gmd.de/mailman/listinfo/pykde

-- 
F R E D E R I C K   P O L G A R D Y   J R.
Bodacion Technologies
18-3 E Dundee Road - Suite 300 - Barrington, IL 60010
Phone: 847/842.9008 - Fax: 847/842-1731
Web: http://www.bodacion.com




More information about the PyQt mailing list