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
30class QRectF;
31class QRubberBand;
32
38class Q_DECL_EXPORT KplView : public QGraphicsView
39{
40 Q_OBJECT
41public:
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
60signals:
67 void urlsDropped(QList<QUrl>* list);
74 void regionSelected(const QRectF& rect);
75
76protected:
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
Kpl main view class.
Definition: kplview.h:39
void urlsDropped(QList< QUrl > *list)
Emitted at drop event.
virtual QSize sizeHint() const
Calculates recommended size of the widget.
double zoomFactor() const
Returns zoom factor.
Definition: kplview.h:58
virtual void dropEvent(QDropEvent *e)
Emits the signal urlsDropped, transferring a list of URLs.
virtual void mouseReleaseEvent(QMouseEvent *e)
Implements finishing of selection of a rectangular region using the mouse with its right button press...
void setZoomFactor(double f)
Sets zoom factor.
virtual void leaveEvent(QEvent *e)
Emits the signal mouseLeaved.
void mouseLeaved()
Emitted when mouse cursor leaves the widget.
virtual void dragMoveEvent(QDragMoveEvent *e)
virtual void mouseMoveEvent(QMouseEvent *e)
Implements selection of a rectangular region using the mouse with its right button pressed.
virtual ~KplView()
Destructor.
virtual void mousePressEvent(QMouseEvent *e)
Implements initiation of selection of a rectangular region using the mouse with its right button pres...
virtual void dragEnterEvent(QDragEnterEvent *e)
virtual void keyPressEvent(QKeyEvent *e)
Implements scrolling of the window by key sequences.
KplView(double f=1, QWidget *parent=0)
Constructor.
void regionSelected(const QRectF &rect)
Emitted when rectangular region was selected using the mouse with its right button pressed.