Avogadro  1.1.0
Public Member Functions
Avogadro::ElementItem Class Reference

An element item, intended to display a single element. More...

#include <elementitem_p.h>

Inheritance diagram for Avogadro::ElementItem:
Inheritance graph
[legend]

List of all members.

Public Member Functions

 ElementItem (int elementNumber=0)
 ~ElementItem ()
QRectF boundingRect () const
QPainterPath shape () const
void paint (QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)

Detailed Description

An element item, intended to display a single element.

Author:
Marcus D. Hanwell This class implements a QGraphicsItem for displaying single elements in a perdiodic table. It currently allows the setting of the proton number and gets all other information from OpenBabel.

Constructor & Destructor Documentation

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.


Member Function Documentation

Returns:
the bounding rectangle of the element item.

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().

Returns:
the painter path which is also a rectangle in this case.

Reimplemented from QGraphicsItem.

References QPainterPath::addRect().


The documentation for this class was generated from the following files: