1 /* Copyright (c) 2015 Gerald Knizia 2 * 3 * This file is part of the IboView program (see: http://www.iboview.org) 4 * 5 * IboView is free software: you can redistribute it and/or modify 6 * it under the terms of the GNU General Public License as published by 7 * the Free Software Foundation, version 3. 8 * 9 * IboView is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * GNU General Public License for details. 13 * 14 * You should have received a copy of the GNU General Public License 15 * along with bfint (LICENSE). If not, see http://www.gnu.org/licenses/ 16 * 17 * Please see IboView documentation in README.txt for: 18 * -- A list of included external software and their licenses. The included 19 * external software's copyright is not touched by this agreement. 20 * -- Notes on re-distribution and contributions to/further development of 21 * the IboView software 22 */ 23 24 #ifndef IV_FIND_ORBITALS_FORM 25 #define IV_FIND_ORBITALS_FORM 26 27 #include <QDialog> 28 #include <QAbstractTableModel> 29 #include "IvDocument.h" 30 31 namespace Ui{ 32 class FindOrbitalsForm; 33 } 34 35 36 struct FFoundOrbital { 37 double fSelChg; // charge on selected atoms. 38 int iDataRow; // dataset number. 39 FOrbital *pOrbital; FFoundOrbitalFFoundOrbital40 FFoundOrbital(double fSelChg_, int iDataRow_, FOrbital *pOrbital_): fSelChg(fSelChg_), iDataRow(iDataRow_), pOrbital(pOrbital_) {} 41 }; 42 typedef std::vector<FFoundOrbital> 43 FFoundOrbitalList; 44 45 // represent a selection of orbitals found via "Find Orbitals" 46 // on selected atoms. 47 class FFoundOrbitalModel : public QAbstractTableModel 48 { 49 Q_OBJECT 50 public: 51 FFoundOrbitalModel(FFoundOrbitalList const &L, FDocument *pDocument, QObject *parent=0); 52 53 int rowCount(const QModelIndex &parent = QModelIndex()) const; 54 int columnCount(const QModelIndex &parent = QModelIndex()) const; 55 QVariant headerData(int section, Qt::Orientation orientation, int role) const; 56 QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; 57 58 public slots: 59 void documentDataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight); 60 public: 61 FDocument 62 *m_pDocument; 63 FFoundOrbitalList 64 m_FoundOrbitals; 65 }; 66 67 68 69 class FFindOrbitalsForm : public QDialog 70 { 71 Q_OBJECT 72 public: 73 Ui::FindOrbitalsForm *ui; 74 FFoundOrbitalModel *m_pModel; 75 76 FFindOrbitalsForm(FFoundOrbitalModel *pModel_, QString Title_, QWidget *parent = 0); 77 ~FFindOrbitalsForm(); 78 public slots: 79 void toggleRow(const QModelIndex &index); 80 void toggleSelectedRows(); 81 }; 82 83 84 85 #endif // IV_FIND_ORBITALS_FORM 86