Krita Source Code Documentation
Loading...
Searching...
No Matches
kis_zoom_scrollbar.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2020 Eoin O 'Neill <eoinoneill1991@gmail.com>
3 * SPDX-FileCopyrightText: 2020 Emmet O 'Neill <emmetoneill.pdx@gmail.com>
4 *
5 * SPDX-License-Identifier: GPL-2.0-or-later
6 */
7
8
9#ifndef KIS_ZOOM_SCROLLBAR_H
10#define KIS_ZOOM_SCROLLBAR_H
11
12#include <QScrollBar>
13#include <QVector2D>
14
15#include <kritaui_export.h>
16
17class KRITAUI_EXPORT KisZoomableScrollBar : public QScrollBar
18{
19 Q_OBJECT
20
21public:
22 KisZoomableScrollBar(QWidget* parent = 0);
23 KisZoomableScrollBar(Qt::Orientation orientation, QWidget * parent = 0);
25
26 QPoint barPosition();
27
28 //Catch for teleportation from one side of the screen to the other.
29 bool catchTeleports(QMouseEvent* event);
30
31 //Window-space wrapping for mouse dragging. Allows for blender-like
32 //infinite mouse scrolls.
33 void handleWrap(const QPoint &accel, const QPoint &globalMouseCoord);
34
35 //Scroll based on a mouse acceleration value.
36 void handleScroll(const QPoint &accel);
37
38 void tabletEvent(QTabletEvent *event) override;
39 virtual void mousePressEvent(QMouseEvent *event) override;
40 virtual void mouseMoveEvent(QMouseEvent *event) override;
41 virtual void mouseReleaseEvent(QMouseEvent *event) override;
42
43 virtual void wheelEvent(QWheelEvent *event) override;
44
45 void setZoomDeadzone(float value);
46 void setWheelOverscrollSensitivity(float sensitivity);
47
48Q_SIGNALS:
49 void zoom(qreal delta);
50 void overscroll(qreal delta);
51
52private:
59 bool catchTeleportCorrection = false;
60 bool zoomEnabled = true;
61};
62
63#endif // KIS_ZOOM_SCROLLBAR_H
float value(const T *src, size_t ch)
void overscroll(qreal delta)
void zoom(qreal delta)