Mouse-over Atom Event

Hi Guys,

I’m trying to implement dihedral angle manipulation in our bond-centric
tool. One of the ideas I’ve come up with would be to show different
information based on what atom the user is mousing over. For example, if
there are atoms a-b-c-d and the user selects the b-c bond as its
construction bond, the usual angles and lengths are displayed. If the user
now mouses over either a or d, the usual angles fade out and the dihedral
angles are displayed. The user could then click and drag a or d to change
the dihedral angle.

Thats the idea at the moment, its not quite complete but I wanted to try a
few things out in the code to test its viability. The problem is I’m not
sure how or if its even possible to handle mouse-over on the atoms without
checking the entire molecule to see if any atoms are under the cursor every
single mouse-move event. Does anyone know a better way to do this? Is
there mouse-over events for QObjects? Ross found QHoverEvent but that
appears to be on a widget basis, not on an object basis.

Thanks in advance,
James

Thats the idea at the moment, its not quite complete but I wanted
to try a few things out in the code to test its viability. The
problem is I’m not sure how or if its even possible to handle mouse-
over on the atoms without checking the entire molecule to see if
any atoms are under the cursor every single mouse-move event.

That sounds like a great idea. Unfortunately, there isn’t a great way
to do this – there’s no way for Qt to know where any given atom is,
so there’s no “event” for hovering over an atom.

OTOH, the tool can create a quick mapping of where the atoms are in
XY screen coordinates based on the current view. That seems like the
best approach – when you switch to the tool or rotate the molecule
(or otherwise), generate a screen mapping of the atoms and bonds.

I would suggest some ways to do this, but chances are good that
Benoit has something already in Eigen (or elsewhere in Avogadro)
which does this sort of transform already. Am I right Benoit?

Cheers,
-Geoff