libkpl  5.0
A Library for Graphical Presentation of Data Sets and Functions
kplview.h
1 /***************************************************************************
2  kplview.h - description
3  -------------------
4 
5  This file is a part of kpl - a program for graphical presentation of
6  data sets and functions.
7 
8  begin : Sat Apr 24 15:14:00 MEST 1999
9 
10  copyright : (C) 2017 by Werner Stille
11  email : kpl@werner-stille.de
12  ***************************************************************************/
13 
14 /***************************************************************************
15  * *
16  * This program is free software; you can redistribute it and/or modify *
17  * it under the terms of the GNU General Public License as published by *
18  * the Free Software Foundation; either version 2 of the License, or *
19  * (at your option) any later version. *
20  * *
21  ***************************************************************************/
22 
23 #ifndef KPLVIEW_H
24 #define KPLVIEW_H
25 
26 #include <QGraphicsView>
27 #include <QPoint>
28 #include <QUrl>
29 
30 class QRectF;
31 class QRubberBand;
32 
38 class Q_DECL_EXPORT KplView : public QGraphicsView
39 {
40  Q_OBJECT
41 public:
47  KplView(double f = 1, QWidget* parent = 0);
49  virtual ~KplView();
54  void setZoomFactor(double f);
56  virtual QSize sizeHint() const;
58  inline double zoomFactor() const { return m_zoomFactor; };
59 
60 signals:
62  void mouseLeaved();
67  void urlsDropped(QList<QUrl>* list);
74  void regionSelected(const QRectF& rect);
75 
76 protected:
78  virtual void dragEnterEvent(QDragEnterEvent* e);
80  virtual void dragMoveEvent(QDragMoveEvent* e);
85  virtual void dropEvent(QDropEvent* e);
97  virtual void keyPressEvent(QKeyEvent* e);
102  virtual void leaveEvent(QEvent* e);
108  virtual void mouseMoveEvent(QMouseEvent* e);
114  virtual void mousePressEvent(QMouseEvent* e);
121  virtual void mouseReleaseEvent(QMouseEvent* e);
122  double m_zoomFactor;
123  QPoint startPos;
124  QRubberBand* rubberBand;
125 };
126 
127 #endif // KPLVIEW_H
KplView::leaveEvent
virtual void leaveEvent(QEvent *e)
Emits the signal mouseLeaved.
KplView::dragMoveEvent
virtual void dragMoveEvent(QDragMoveEvent *e)
KplView::mouseReleaseEvent
virtual void mouseReleaseEvent(QMouseEvent *e)
Implements finishing of selection of a rectangular region using the mouse with its right button press...
KplView::setZoomFactor
void setZoomFactor(double f)
Sets zoom factor.
KplView::dragEnterEvent
virtual void dragEnterEvent(QDragEnterEvent *e)
KplView
Kpl main view class.
Definition: kplview.h:39
KplView::dropEvent
virtual void dropEvent(QDropEvent *e)
Emits the signal urlsDropped, transferring a list of URLs.
KplView::mouseMoveEvent
virtual void mouseMoveEvent(QMouseEvent *e)
Implements selection of a rectangular region using the mouse with its right button pressed.
KplView::keyPressEvent
virtual void keyPressEvent(QKeyEvent *e)
Implements scrolling of the window by key sequences.
KplView::mouseLeaved
void mouseLeaved()
Emitted when mouse cursor leaves the widget.
KplView::zoomFactor
double zoomFactor() const
Returns zoom factor.
Definition: kplview.h:58
KplView::KplView
KplView(double f=1, QWidget *parent=0)
Constructor.
KplView::~KplView
virtual ~KplView()
Destructor.
KplView::regionSelected
void regionSelected(const QRectF &rect)
Emitted when rectangular region was selected using the mouse with its right button pressed.
KplView::urlsDropped
void urlsDropped(QList< QUrl > *list)
Emitted at drop event.
KplView::sizeHint
virtual QSize sizeHint() const
Calculates recommended size of the widget.
KplView::mousePressEvent
virtual void mousePressEvent(QMouseEvent *e)
Implements initiation of selection of a rectangular region using the mouse with its right button pres...