Safe way to get access to one of painter devices

In my version of labelsettingswidget I’ve created “preview” box, which displays how label of 1st atom of molecule will be displayed using current style. But I need access to molecule from function other than renderOpaque, which accepts PainterDevice as parameter. I’ve strored pointer to first used PainterDevice, but it causes segfault if one more file is opened

Regards,
Konstantin

On Nov 24, 2009, at 10:41 AM, Konstantin Tokarev wrote:

In my version of labelsettingswidget I’ve created “preview” box, which displays how label of 1st atom of molecule will be displayed using current style.

Why do we need the 1st atom? Can’t we use an arbitrary atom like a carbon?

Cheers,
-Geoff

Why do we need the 1st atom? Can’t we use an arbitrary atom like a carbon?

I thought about it. I simply create a static global Atom in labelengine.cpp and set some arbitrary values for formalCharge, partialCharge, residue, etc
But in atom.h is written “All atoms must be owned by a Molecule”

Regards,
Konstantin

I thought about it. I simply create a static global Atom in labelengine.cpp and set some arbitrary values for formalCharge, partialCharge, residue, etc
But in atom.h is written “All atoms must be owned by a Molecule”

I don’t think that’s a big deal for what you want. I think it’ll work.

Cheers,
-Geoff

Geoffrey Hutchison wrote:

I thought about it. I simply create a static global Atom in labelengine.cpp and set some arbitrary values for formalCharge, partialCharge, residue, etc
But in atom.h is written “All atoms must be owned by a Molecule”

I don’t think that’s a big deal for what you want. I think it’ll work.

For what you want it will work fine unless you try getting the atom’s
position. Then it would fail, probably with a segfault.

Marcus