I created a custom qGraphicsRectItem which I added to my qGraphicsScene. I would like to add text to this custom rectangle using its local coordinates (i.e. adding to 0,0 places the item at the origin of my rectangle no matter where it its in my scene)
When I try to do so, it uses my scene's coordinate system and the text appears out of the rectangle. Any ideas?

  PackageRect::PackageRect(QString PackageName, qreal x, qreal y, qreal w, qreal h, QGraphicsItem *parent)
    :QGraphicsRectItem(x, y, w,  h, parent)
{

    QGraphicsTextItem *text = new QGraphicsTextItem(PackageName, this);
    text-&gt;setPos(0,0);
}



Question: Why is covalent bonding stronger than electrostatic attraction?
Answer: Short answer:

To quote Mehrdad: You're basically comparing an intermolecular force with an intramolecular force.

Ionic bonds are two charged atoms sitting next to each other with minimal overlap of their orbitals.

Covalents bonds are two atoms becoming one molecule with significant changes in orbital structure. 

It is not always clear cut: there are atoms with part-ionic and part-covalent character or two atoms sitting next to each other with moderate overlap of their orbitals. 

Here is a good explanation (for solids): Are metallic/ionic bonds weaker than covalent bonds? I was taught the opposite. Now I&#39;m confused

Long answer:

Electrostatic bonds by definition are incapable of any significant bond formation. Bond formation involves the formation of a lower energy "bonding orbital(s)" out of two (or more) higher energy ordinary orbitals on adjacent atoms within the molecule. The formation of bonding orbitals gives covalent bonding orbitals much lower energy (not smaller, see diagram) than non-bonding orbitals which exist in the unbound state. This energy difference is larger than is possible for merely electrostatic attractions. Why is this the case? Because the electrons in bonding orbital are better able to counteract the positive charges of the adjacent nuclei. This makes sense because the negative charge on one molecule in an electrostatic arrangement is only able to neutralize the positive charge from its own nuclei. Bonding orbitals that are only present in covalent bonds share those electrons between two nuclei and thereby better neutralize the charges of both nuclei, which results in a lower energy for the bonded system than is possible in an ionic system. 


Image Source