-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmainview.h
More file actions
78 lines (62 loc) · 2.61 KB
/
mainview.h
File metadata and controls
78 lines (62 loc) · 2.61 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
/*
* This file is part of the GreasePad distribution (https://github.com/FraunhoferIOSB/GreasePad).
* Copyright (c) 2022 Jochen Meidow, Fraunhofer IOSB
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef MAINVIEW_H
#define MAINVIEW_H
#include <QAction>
#include <QGraphicsView>
#include <QDebug>
// #include <QStatusBar>
#include <memory>
#include "global.h"
namespace GUI {
//! Graphics view
class MainView :public QGraphicsView
{
Q_OBJECT
public:
MainView( QGraphicsScene *scene, QWidget *parent); //!< Value constructor
~MainView() override { //qDebug() << Q_FUNC_INFO;
}
std::unique_ptr<QAction> actionCopyScreenshotToClipboard{}; //!< Copy screenshot to clipboard
std::unique_ptr<QAction> actionCopySvgToClipboard{}; //!< Copy scalable vector graphics to clipboard
std::unique_ptr<QAction> actionCopyPdfToClipboard{}; //!< Copy portable document format to clipboard
std::unique_ptr<QAction> actionToggleShowBackgroundTiles; //!< Toggle visibility of background tiles
std::unique_ptr<QAction> actionZoomIn; //!< Zoom in [+]
std::unique_ptr<QAction> actionZoomOut; //!< Zoom out [-]
protected:
void wheelEvent( QWheelEvent *event) override; //!< Zoom via mouse wheel
void drawForeground( QPainter *painter, const QRectF &) override; //!< Plot the organization name
private:
const double lod_max = 100.0;
const double lod_min = 0.01;
const double zoom_in = 1.25;
const double zoom_out = 1./zoom_in;
void createActions();
void establishConnections();
void slotToggleShowBackgroundTiles();
void slotZoomIn() { scale( zoom_in, zoom_in ); }
void slotZoomOut() { scale( zoom_out, zoom_out); }
void slotCopyScreenshotToClipboard();
void slotCopySvgToClipboard();
void slotCopyPdfToClipboard();
static bool s_showBackgroundTiles;
Q_SIGNALS:
void signalShowStatus( const QString & s); //!< Send message to status bar
};
} // namespace GUI
#endif // MAINVIEW_H