1 /******************************************************************************************************
2  * (C) 2014 markummitchell@github.com. This file is part of Engauge Digitizer, which is released      *
3  * under GNU General Public License version 2 (GPLv2) or (at your option) any later version. See file *
4  * LICENSE or go to gnu.org/licenses for details. Distribution requires prior written permission.     *
5  ******************************************************************************************************/
6 
7 #ifndef VIEW_PROFILE_H
8 #define VIEW_PROFILE_H
9 
10 #include <QGraphicsView>
11 
12 class QGraphicsRectItem;
13 
14 /// Class that modifies QGraphicsView to present a two-dimensional profile, with movable dividers for selecting a range.
15 class ViewProfile : public QGraphicsView
16 {
17 public:
18   /// Single constructor.
19   ViewProfile(QGraphicsScene *scene,
20               int minimumWidth,
21               QWidget *parent = 0);
22 
23   /// Intercept resize events so the geometry can be scaled to perfectly fit into the window.
24   virtual void resizeEvent(QResizeEvent *event);
25 
26 private:
27   ViewProfile();
28 
29   void createFrame();
30   void refit();
31 
32   QGraphicsRectItem *m_frame;
33 };
34 
35 #endif // VIEW_PROFILE_H
36