Avogadro
1.1.0
|
An element item, intended to display a single element. More...
#include <elementitem_p.h>
Public Member Functions | |
ElementItem (int elementNumber=0) | |
~ElementItem () | |
QRectF | boundingRect () const |
QPainterPath | shape () const |
void | paint (QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) |
An element item, intended to display a single element.
Avogadro::ElementItem::ElementItem | ( | int | elementNumber = 0 | ) |
Constructor. Should be called with the element number for this item. The constructor uses setData to set the element number using the key 0. This is then used by PeriodicTable to figure out which element was clicked on.
References OpenBabel::etab, OpenBabel::OBElementTable::GetRGB(), OpenBabel::OBElementTable::GetSymbol(), QString::isEmpty(), QGraphicsItem::setData(), QGraphicsItem::setFlags(), and QColor::setRgbF().
Destructor.
QRectF Avogadro::ElementItem::boundingRect | ( | ) | const |
Reimplemented from QGraphicsItem.
void Avogadro::ElementItem::paint | ( | QPainter * | painter, |
const QStyleOptionGraphicsItem * | option, | ||
QWidget * | widget | ||
) |
This is where most of the action takes place. The element box is drawn along with its symbol.
Reimplemented from QGraphicsItem.
References QColor::darker(), QPainter::drawRect(), QPainter::drawText(), QGraphicsItem::isSelected(), QColor::lighter(), QPainter::setBrush(), QPen::setColor(), QPainter::setPen(), QPen::setWidth(), and QColor::value().
QPainterPath Avogadro::ElementItem::shape | ( | ) | const [virtual] |
Reimplemented from QGraphicsItem.
References QPainterPath::addRect().