[Qt-interest] setMouseTracking

"Alexander Carôt" alexander_carot at gmx.net
Fri Jan 7 01:31:15 CET 2011


> I tried it:
> 
> the only event I get is (I guess) a resizeEvent when I change the 
> resolution.
> 
> Sorry, next idea .. .-)

... I also did some "trial-and-error" in the meantime but did not succeed either. Another idea is this:

What I want to achieve already works when pressing and holding the mouse button within the widget. In that case (when keeping the button held) I still receive mousePos coordinated even when leaving the widget. The only thing I want to avoid is the pressed mouse button --> So - isn't there the possibiliy to "fake" a pressed mouse button although it actually isn't (yes, it would be a "dirty" solution, I know :-) ) ?  

Any feedback appreciated, will keep thinking,
cheers

Alex





 
> Am 06.01.2011 18:45, schrieb Jan:
> > Just an idea:
> >
> > Maybe it is possible to install an eventfilter on the QDesktopWidget
> >
> > QDesktopWidget * QApplication::desktop ()
> >
> > Through an eventfilter you may get mouse events. No idea if you can
> > enable mousetracking for the desktop widget (but it is a widget subclass
> > - so why not).
> >
> > Jan
> >
> > Am 06.01.2011 16:39, schrieb "Alexander Carôt":
> >>> Does your main window derive from QMainWindow or just QWidget?  If
> not,
> >>> what happens if you create a QMainWindow and set your current "main
> >>> window" widget as the QMainWindow's centralWidget()?  I believe this
> >>> should work (and is the common way of implementing a top level
> >>> application window.)
> >>
> >> In fact my window derives from QWidget. Changing it to QMainWindow
> makes it receive mouseMoveEvents without clicking as desired - thank you !
> >>
> >> However, it does not work if the mouse resides outside the window. So I
> changed my class back to QWidget and followed your suggestion of creating
> an extra QMainWindow and set my widget as the central widget via
> setCentralWidget(); In that context I also overwrote the mouse event handler of the
> QMainWindow with mouse pos messages. Unfortunately this didn't solve the
> problem either: Only the central widget's handler fired only when placing the
> mouse on it and not outside the widget's boundaries.
> >>
> >> Did I correctly follow you suggestion or am I possibly mistaken ?
> >>
> >> Thanks and best
> >>
> >> Alex
> >>
> > _______________________________________________
> > Qt-interest mailing list
> > Qt-interest at qt.nokia.com
> > http://lists.qt.nokia.com/mailman/listinfo/qt-interest
> >
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at qt.nokia.com
> http://lists.qt.nokia.com/mailman/listinfo/qt-interest

-- 
http://www.carot.de
http://www.triologue.de
Email : Alexander at Carot.de
Tel.: +49 (0)177 5719797



NEU: FreePhone - kostenlos mobil telefonieren und surfen!			
Jetzt informieren: http://www.gmx.net/de/go/freephone



More information about the Qt-interest-old mailing list