I’m implementing support for multiple conformers in the Properties widgets, so that the (e.g) Bond properties table will show the bond lengths for all conformers, rather then just one.
I’ve got most of this done (with some much appreciated help from Marcus), but am stuck on a couple of things and wondered if anyone had any suggestions.
Firstly, I’d like to be able to copy data out of the table into the clipboard, so that it can be pasted into a spreadsheet.
I’ve got this to work by implementing a keyPressEvent function in the PropertiesView class that calls a copyToClipboard function to copy the model data into the clipboad.
The code to do that is:
void PropertiesView::keyPressEvent(QKeyEvent *event)
if ( event->matches(QKeySequence::Copy)
This works fine on Linux, but on OSX, the QKeySequence::Copy event isn’t matched, and instead I get the one that is implemented for the main avogdro window being called. I think this might be something to do with a shortcut being set up for copy, but various things I’ve tried to over-ride this behaviour for the PropertiesView window don’t seem to work.
Can anyone give me any pointers on how I can get around this?
The second thing concerns the group indexes for atoms.
When the bond table is displayed, it uses the group indices (the Atom data m_groupIndex) to indicate the start and end atom for the bond. Currently, if I just load in a molecule and display the table, the group indices haven’t been calculated and so I get rubbish displayed.
This isnt a particular problem as I can just call calculateGroupIndices on the molecule before I process any data, but I guess that isn’t ideal.
I tried adding a call to calculateGroupIndices to the molecule addAtom call, but that doesn’t work beause the atomic number of the atom hasn’t been set, so the group indices are calculated incorrectly (the last atom added has an index of 0, regardless of how many other ones there are).
Is there a sensible place to calculate the group indices so that you can be sure that it’s been done whenever you access a molecule?
Scanned by iCritical.