| 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_PERIODICTABLESCENE_P_H |
| 7 | #define AVOGADRO_QTGUI_PERIODICTABLESCENE_P_H |
| 8 | |
| 9 | #include <QtWidgets/QGraphicsScene> |
| 10 | |
| 11 | namespace Avogadro { |
| 12 | namespace QtGui { |
| 13 | |
| 14 | class ElementDetail; |
| 15 | |
| 16 | /** |
| 17 | * @class PeriodicTableScene |
| 18 | * @internal |
| 19 | * @author Marcus D. Hanwell |
| 20 | * @brief This class encapsulates the scene, all items are contained in it. |
| 21 | * |
| 22 | * This class implements a QGraphicsScene that holds all of the element items. |
| 23 | * Any items owned by this class are automatically deleted by it. |
| 24 | */ |
| 25 | class PeriodicTableScene : public QGraphicsScene |
| 26 | { |
| 27 | Q_OBJECT |
| 28 | |
| 29 | public: |
| 30 | /** Constructor. */ |
| 31 | explicit PeriodicTableScene(QObject* parent = nullptr); |
| 32 | |
| 33 | signals: |
| 34 | /** |
| 35 | * This signal is emitted when an element item is clicked. |
| 36 | */ |
| 37 | void elementChanged(int element); |
| 38 | |
| 39 | public slots: |
| 40 | /** |
| 41 | * This slot is called when an element is changed (e.g., by keyboard or code). |
| 42 | */ |
| 43 | void changeElement(int element); |
| 44 | |
| 45 | protected: |
| 46 | /** |
| 47 | * Handles the mouse press events to change the active element. |
| 48 | */ |
| 49 | void mousePressEvent(QGraphicsSceneMouseEvent* event) override; |
| 50 | |
| 51 | private: |
| 52 | ElementDetail* m_detail; |
| 53 | }; |
| 54 | |
| 55 | } // End namespace QtGui |
| 56 | } // End namespace Avogadro |
| 57 | |
| 58 | #endif // AVOGADRO_QTGUI_PERIODICTABLESCENE_P_H |