Krita Source Code Documentation
Loading...
Searching...
No Matches
overviewdocker_page.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2009 Cyrille Berger <cberger@cberger.net>
3 * SPDX-FileCopyrightText: 2021 Deif Lou <ginoba@gmail.com>
4 *
5 * SPDX-License-Identifier: LGPL-2.0-or-later
6 */
7
8#ifndef _OVERVIEW_PAGE_H_
9#define _OVERVIEW_PAGE_H_
10
11#include <QPointer>
12#include <QVariantAnimation>
13
15#include <kis_canvas2.h>
16
17class QVBoxLayout;
18class QHBoxLayout;
19class QToolButton;
20class OverviewWidget;
22
23class OverviewDockerPage : public QWidget {
24 Q_OBJECT
25public:
26 OverviewDockerPage(QWidget *parent = 0, const char *name = 0, Qt::WindowFlags f = Qt::WindowFlags());
27 ~OverviewDockerPage() override;
28 void setCanvas(KoCanvasBase *canvas);
29 void unsetCanvas();
30
31public Q_SLOTS:
32 void mirrorUpdateIcon();
33 void rotateCanvasView(qreal rotation);
34 void updateRotationSlider(qreal rotation);
35 void setPinControls(bool pin);
36
37protected:
38 void resizeEvent(QResizeEvent*) override;
39#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
40 void enterEvent(QEvent *event) override;
41#else
42 void enterEvent(QEnterEvent *event) override;
43#endif
44
45 void leaveEvent(QEvent*) override;
46 bool event(QEvent *e) override;
47 bool eventFilter(QObject *o, QEvent *e) override;
48
49private:
50 static constexpr int showControlsTimerDuration {500};
51 // How much the cursor has to move to prevent the showing animation
52 static constexpr double showControlsAreaRadius {4.0};
53 static constexpr double showControlsAnimationDuration {150.0};
54 static constexpr double touchDragDistance {8.0};
56
57 QVBoxLayout *m_controlsLayout {nullptr};
58 QHBoxLayout *m_controlsSecondRowLayout {nullptr};
60 QWidget *m_controlsContainer {nullptr};
61 QWidget *m_zoomSlider {nullptr};
63 QToolButton *m_mirrorCanvas {nullptr};
64 QToolButton *m_pinControlsButton {nullptr};
66 bool m_pinControls {true};
67 bool m_cursorIsHover {false};
68 bool m_isTouching {false};
72 mutable QVariantAnimation m_showControlsAnimation;
73 mutable QTimer m_showControlsTimer;
74 mutable bool m_areControlsHidden {false};
77
78 void layoutMainWidgets();
79
80private Q_SLOTS:
81 void showControls(int delay) const;
82 void hideControls(int delay) const;
83
86};
87
88
89#endif
A widget with several options to select an angle.
void leaveEvent(QEvent *) override
bool eventFilter(QObject *o, QEvent *e) override
void showControls(int delay) const
OverviewDockerPage(QWidget *parent=0, const char *name=0, Qt::WindowFlags f=Qt::WindowFlags())
QToolButton * m_pinControlsButton
static constexpr double touchDragDistanceSquared
static constexpr double showControlsAnimationDuration
QHBoxLayout * m_controlsSecondRowLayout
static constexpr double showControlsAreaRadius
QVariantAnimation m_showControlsAnimation
KisAngleSelector * m_rotateAngleSelector
static constexpr int showControlsTimerDuration
QVBoxLayout * m_controlsLayout
void setCanvas(KoCanvasBase *canvas)
void resizeEvent(QResizeEvent *) override
bool event(QEvent *e) override
QPointer< KisCanvas2 > m_canvas
void on_overviewWidget_signalDraggingFinished()
void rotateCanvasView(qreal rotation)
static constexpr double touchDragDistance
void updateRotationSlider(qreal rotation)
void hideControls(int delay) const
void enterEvent(QEnterEvent *event) override
QToolButton * m_mirrorCanvas
OverviewWidget * m_overviewWidget