1 2 /**************************************************************************** 3 ** 4 ** Copyright (C) 2011 Christian B. Huebschle & George M. Sheldrick 5 ** All rights reserved. 6 ** Contact: chuebsch@moliso.de 7 ** 8 ** This file is part of the ShelXle 9 ** 10 ** This file may be used under the terms of the GNU Lesser 11 ** General Public License version 2.1 as published by the Free Software 12 ** Foundation and appearing in the file COPYING included in the 13 ** packaging of this file. Please review the following information to 14 ** ensure the GNU Lesser General Public License version 2.1 requirements 15 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 16 ** 17 ** 18 ****************************************************************************/ 19 #ifndef QPEAKVIEW_H 20 #define QPEAKVIEW_H 21 22 #include <QWidget> 23 24 QT_BEGIN_NAMESPACE 25 class QPaintEvent; 26 class QResizeEvent; 27 class QSize; 28 class QWidget; 29 QT_END_NAMESPACE 30 /*! \brief QPeakView is a widget featuring a color gradient and the corresponding electron density values (q-peak height) 31 * it is used to highlight or hide q-peaks in the openGL repesentation of the structure. 32 * 33 * 34 * 35 * 36 * 37 * 38 */ 39 40 class QPeakView : public QWidget 41 { 42 Q_OBJECT 43 public: 44 bool dark; 45 explicit QPeakView(QWidget *parent = 0); sizeHint()46 QSize sizeHint() const { 47 return QSize(35,0); 48 } 49 double cutoff;//!< Q-Peaks with lower electron desitie values than this cutoff will be hidden. setMax(double m)50 void setMax(double m){ 51 max=qMax(m,min+0.001); 52 }//!< sets the maximum electron desity value of list of Q-Peaks. setMin(double m)53 void setMin(double m){ 54 min=qMin(m,max-0.001); 55 }//!< sets the minimum electron desity value of list of Q-Peaks. 56 signals: 57 void cutOffChanged(double coff);//!< This signal is emitted when the user clicks on the widget or scrolls on it with the mouse wheel 58 void findQP(double co);//!< This signal is emitted when the user hovers the mouse over the witget 59 60 public slots: 61 void qpeaksInFocus(double height);//!< when the user hovers over a Q-Peak in the OpenGL representation of the structure the corresponding area in the widget gets highlighted. 62 void unhide();//!< when the widget is visible again the cutoff value is reset to zero. 63 64 protected: 65 void paintEvent(QPaintEvent *event); 66 void mousePressEvent ( QMouseEvent * event ); 67 void mouseMoveEvent ( QMouseEvent * event ); 68 void wheelEvent ( QWheelEvent * event ); 69 private: 70 void cutOffChange(double coff); 71 QColor farbverlauf(double wrt); 72 double min,max,oco; 73 double focusHeight; 74 int fohi;//font height 75 }; 76 77 #endif // QPEAKVIEW_H 78