Warning, file /education/kalzium/src/psetable/periodictableview.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001 /* 0002 SPDX-FileCopyrightText: 2005-2006 Pino Toscano <toscano.pino@tiscali.it> 0003 SPDX-FileCopyrightText: 2003-2006 Carsten Niehaus <cniehaus@kde.org> 0004 SPDX-FileCopyrightText: 2007-2009 Marcus D. Hanwell <marcus@cryos.org> 0005 SPDX-FileCopyrightText: 2010-2011 Etienne Rebetez <etienne.rebetez@oberwallis.ch> 0006 0007 SPDX-License-Identifier: GPL-2.0-or-later 0008 */ 0009 0010 #ifndef PERIODICTABLEVIEW_H 0011 #define PERIODICTABLEVIEW_H 0012 0013 #include <QGraphicsView> 0014 0015 #include "kalziumdataobject.h" 0016 #include "kalziumnumerationtype.h" 0017 0018 #include "elementitem.h" 0019 #include "numerationitem.h" 0020 #include "periodictablescene.h" 0021 #include "periodictablestates.h" 0022 0023 /** 0024 * @class PeriodicTableView 0025 * In this class the periodic table of elements is created. 0026 * It provides slots to change the tables and accessing the element properties 0027 * @short Base class and creation for the pse System 0028 * @author Carsten Niehaus 0029 * @author Marcus D. Hanwell 0030 * @author Etienne Rebetez 0031 * 0032 */ 0033 0034 class PeriodicTableView : public QGraphicsView 0035 { 0036 Q_OBJECT 0037 public: 0038 explicit PeriodicTableView(QWidget *parent = nullptr); 0039 ~PeriodicTableView() override; 0040 0041 /** 0042 * Returns the qgraphicsscene 0043 */ 0044 PeriodicTableScene *pseScene() const; 0045 0046 /** 0047 * Returns the current id of the pse-table. 0048 * The id is the same as the menu and the pse list from the pseTables class. 0049 */ 0050 int table() const; 0051 0052 /** 0053 * Generates and saves the pse as svg in the given filename. 0054 * @param filename filename of the destination. 0055 */ 0056 void generateSvg(const QString &filename); 0057 0058 Q_SIGNALS: 0059 /** 0060 * Is emitted when the pse table is changed. 0061 */ 0062 void tableChanged(int tableTyp); 0063 /** 0064 * Is emitted when the numeration of the pse table is changed. 0065 */ 0066 void numerationChange(int num); 0067 0068 public Q_SLOTS: 0069 /** 0070 * Change the pse table to the given id. 0071 * @param newtable id of the pse table. 0072 */ 0073 void slotChangeTable(int newtable); 0074 /** 0075 * fits the pse in the qGraphicsView. 0076 */ 0077 void fitPseInView(); 0078 /** 0079 * One Element can be selected with this function. 0080 * The selection is only a graphical feedback for the user. 0081 * @param element number of the element. 0082 */ 0083 void slotSelectOneElement(int element); 0084 /** 0085 * Selects an Element. 0086 * @param element number of the element. 0087 */ 0088 void slotSelectAdditionalElement(int element); 0089 /** 0090 * Unselects all elements 0091 */ 0092 void slotUnSelectElements(); 0093 0094 private: 0095 QList<ElementItem *> createElementItems() const; 0096 QList<NumerationItem *> createNumerationItems() const; 0097 0098 void setBiggerSceneRect(); 0099 0100 int m_currentTableInex; 0101 static int const RESIZE_SCENE_TIMEOUT = 2200; 0102 0103 PeriodicTableScene *m_tableScene; 0104 0105 PeriodicTableStates *m_tableStates; 0106 0107 protected: 0108 /** 0109 * Generic event handler, currently defaults to calling parent class 0110 * (included for future compatibility) 0111 */ 0112 bool event(QEvent *e) override; 0113 0114 /** 0115 * is called every time the view is resized. 0116 */ 0117 void resizeEvent(QResizeEvent *event) override; 0118 }; 0119 0120 #endif // PERIODICTABLEVIEW_H