Debian Codegraph @

avogadro/qtgui/elementdetail_p.h

raw
1 /******************************************************************************
2 This source file is part of the Avogadro project.
3 This source code is released under the 3-Clause BSD License, (see "LICENSE").
4 ******************************************************************************/
5
6 #ifndef AVOGADRO_QTGUI_ELEMENTDETAIL_P_H
7 #define AVOGADRO_QTGUI_ELEMENTDETAIL_P_H
8
9 #include <QtWidgets/QGraphicsItem>
10
11 namespace Avogadro {
12 namespace QtGui {
13
14 /**
15 * @class ElementDetail
16 * @internal
17 * @author Marcus D. Hanwell
18 * @brief An item box displaying more detailed information on the element.
19 *
20 * This class implements a QGraphicsItem for displaying a larger box that
21 * gives greater detail about the selected element such as its full name,
22 * proton number and average atomic mass.
23 */
24 class ElementDetail : public QGraphicsItem
25 {
26 public:
27 /**
28 * Constructor. Should be called with the element number for this item.
29 */
30 explicit ElementDetail(int elementNumber = 0);
31
32 /**
33 * @return the bounding rectangle of the element item.
34 */
35 QRectF boundingRect() const override;
36
37 /**
38 * @return the painter path which is also a rectangle in this case.
39 */
40 QPainterPath shape() const override;
41
42 /**
43 * This is where most of the action takes place. The element box is drawn
44 * along with its symbol, proton number, mass and full name.
45 */
46 void paint(QPainter* painter, const QStyleOptionGraphicsItem* option,
47 QWidget* widget) override;
48
49 /**
50 * Change the element displayed in the detail object.
51 */
52 void setElement(int element);
53
54 private:
55 /**
56 * Width and height of the item.
57 */
58 int m_width, m_height;
59
60 /**
61 * The proton number of the item - all other attributes are derived from this.
62 */
63 int m_element;
64 };
65
66 } // End namespace QtGui
67 } // End namespace Avogadro
68
69 #endif // AVOGADRO_QTGUI_ELEMENTDETAIL_P_H