16#include <QApplication>
19#include <klocalizedstring.h>
34#include <kconfiggroup.h>
35#include <ksharedconfig.h>
39 , m_lastOverviewMousePos(0.0, 0.0)
65 KConfigGroup config = KSharedConfig::openConfig()->group(
"OverviewDocker");
76 KConfigGroup config = KSharedConfig::openConfig()->group(
"OverviewDocker");
86 setEnabled(canvas !=
nullptr);
89 m_canvas->disconnectCanvasObserver(
this);
138 bool usePrintResolutionMode =
m_canvas->imageView()->canvasController()->usePrintResolutionMode();
155 Q_FOREACH(QAction* action, actions) {
156 if (action->objectName()==
"mirror_canvas") {
168 i18nc(
"Make the controls in the overview docker auto-hide or always visible",
"Pin navigation controls")
178 i18nc(
"Show the overview docker preview in shades of gray",
"Grayscale preview")
227 if (canvasController) {
265#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
271 m_cursorIsHover =
true;
272 if (isEnabled() && !m_pinControls) {
273 showControls(showControlsTimerDuration);
279 if (e->type() == QEvent::StyleChange || e->type() == QEvent::FontChange) {
282 return QWidget::event(e);
294 if (e->type() == QEvent::MouseButtonPress) {
296 return static_cast<QMouseEvent*
>(e)->
source() != Qt::MouseEventSynthesizedByApplication;
299 }
else if (e->type() == QEvent::MouseButtonRelease) {
301 return static_cast<QMouseEvent*
>(e)->
source() != Qt::MouseEventSynthesizedByApplication;
304 }
else if (e->type() == QEvent::MouseMove) {
306 return static_cast<QMouseEvent*
>(e)->
source() != Qt::MouseEventSynthesizedByApplication;
309 QMouseEvent *me =
static_cast<QMouseEvent*
>(e);
312 const double distanceSquared = d.x() * d.x() + d.y() * d.y();
314 if (distanceSquared >= showControlsAreaRadiusSquared) {
324 }
else if (e->type() == QEvent::TouchBegin) {
326 QTouchEvent *te =
static_cast<QTouchEvent*
>(e);
336 }
else if (e->type() == QEvent::TouchUpdate) {
340 QTouchEvent *te =
static_cast<QTouchEvent*
>(e);
342 QPointF currentPosition;
343 for (
const QTouchEvent::TouchPoint &touchPoint : te->touchPoints()) {
347 if (touchPoint.state() == Qt::TouchPointStationary) {
350 currentPosition = touchPoint.pos();
357 const qreal distanceSquared = delta.x() * delta.x() + delta.y() * delta.y();
361 QMouseEvent *se =
new QMouseEvent(QEvent::MouseButtonPress,
363 Qt::LeftButton, Qt::LeftButton, Qt::NoModifier,
364 Qt::MouseEventSynthesizedByApplication);
370 QMouseEvent *se =
new QMouseEvent(QEvent::MouseMove,
371 currentPosition, QPointF(), QPointF(),
372 Qt::LeftButton, Qt::LeftButton, Qt::NoModifier,
373 Qt::MouseEventSynthesizedByApplication);
380 }
else if (e->type() == QEvent::TouchEnd || e->type() == QEvent::TouchCancel) {
384 QTouchEvent *te =
static_cast<QTouchEvent*
>(e);
385 if (e->type() == QEvent::TouchEnd) {
388 for (
const QTouchEvent::TouchPoint &touchPoint : te->touchPoints()) {
390 if (touchPoint.state() != Qt::TouchPointReleased) {
400 QMouseEvent *se =
new QMouseEvent(QEvent::MouseButtonRelease,
402 Qt::LeftButton, Qt::LeftButton, Qt::NoModifier,
403 Qt::MouseEventSynthesizedByApplication);
405 }
else if (e->type() == QEvent::TouchEnd) {
430 const qreal pageHeight =
static_cast<qreal
>(this->height());
431 const qreal controlsContainerHeight =
static_cast<qreal
>(
m_controlsContainer->sizeHint().height());
433 const int widgetLimitPosition =
static_cast<int>(std::round(pageHeight - animationProgress * controlsContainerHeight));
435 m_controlsContainer->setGeometry(0, widgetLimitPosition, this->width(),
static_cast<int>(controlsContainerHeight));
439 const int widgetLimitPosition = this->height() - controlsContainerHeight;
441 m_controlsContainer->setGeometry(0, widgetLimitPosition, this->width(), controlsContainerHeight);
444 m_controlsContainer->setGeometry(0, this->height(), this->width(), controlsContainerHeight);
454 int animationDuration;
455 qreal animationStartValue;
465 animationStartValue = 0.0;
468 animationDuration = 1;
469 animationStartValue = 1.0;
479 delay = qMax(delay, 0);
491 int animationDuration;
492 qreal animationStartValue;
502 animationStartValue = 1.0;
505 animationDuration = 1;
506 animationStartValue = 0.0;
516 delay = qMax(delay, 0);
KisMagneticGraph::vertex_descriptor source(typename KisMagneticGraph::edge_descriptor e, KisMagneticGraph g)
@ IncreasingDirection_Clockwise
A widget with several options to select an angle.
@ FlipOptionsMode_ContextMenu
The flip options are shown only as a context menu when right-clicking the gauge widget.
qreal angle() const
Gets the current angle.
void setFlipOptionsMode(FlipOptionsMode newMode)
Sets the mode in which the flip options should be shown.
void setIncreasingDirection(KisAngleGauge::IncreasingDirection newIncreasingDirection)
Sets the increasing direction in the angle gauge.
void setAngle(qreal newAngle)
Sets the current angle.
void setRange(qreal newMinimum, qreal newMaximum)
Sets the minimum and maximum values for the angle.
void rotateCanvas(qreal angle, const std::optional< KoViewTransformStillPoint > &stillPoint, bool isNativeGesture=false)
void leaveEvent(QEvent *) override
bool eventFilter(QObject *o, QEvent *e) override
void setPinControls(bool pin)
void showControls(int delay) const
double m_cumulatedMouseDistanceSquared
OverviewDockerPage(QWidget *parent=0, const char *name=0, Qt::WindowFlags f=Qt::WindowFlags())
void setGrayscale(bool grayscale)
QToolButton * m_pinControlsButton
bool m_isDraggingWithTouch
static constexpr double touchDragDistanceSquared
static constexpr double showControlsAnimationDuration
QHBoxLayout * m_controlsSecondRowLayout
QToolButton * m_grayscaleButton
QTimer m_showControlsTimer
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
QWidget * m_controlsContainer
bool event(QEvent *e) override
QPointer< KisCanvas2 > m_canvas
void on_overviewWidget_signalDraggingFinished()
~OverviewDockerPage() override
QPointF m_lastOverviewMousePos
void rotateCanvasView(qreal rotation)
void updateRotationSlider(qreal rotation)
void on_overviewWidget_signalDraggingStarted()
void hideControls(int delay) const
void enterEvent(QEnterEvent *event) override
QToolButton * m_mirrorCanvas
OverviewWidget * m_overviewWidget
QIcon loadIcon(const QString &name)