I'm working on simple 2D visualization module for MD simulation code. What I'm trying to do is drawing positions of simulated molecules using:
myPainter.drawEllipse(myQPoint,myRx,myRy)
And that part works pretty good on my visualization widget. The thing that happened to be a problem is writing text which should represent each molecule's ID (integer).
myPainter.drawText(myPosPoint,QString::number(mySoftMolecule2D->getID()));
It draws text but it is too large. This is probably because I need to use cooridantes scaling for myPainter
to draw molecules easily.
myPainter.scale(myWidgetWidth_ / simSizeX_ , myWidgetHeight_ / simSizeY_);
// myWidgetWidth_ is much bigger simSizeX_
// myWidgetHeight_ is much bigger simSizeY_
I tried putting such lines before I perform scaling cooridnates in myPainter
:
QFont myFont;
myFont.setPointSizeF(1.0); // values less than 1.0 doesn't work
myFont.setFamily("Courier");
myPainter.setFont(myFont);
but the molecules' label are still much too big.
Thanks in advance for any help.