39 , m_lastOverviewMousePos(0.0, 0.0)
65 KConfigGroup config = KSharedConfig::openConfig()->group(
"OverviewDocker");
83 setEnabled(canvas !=
nullptr);
86 m_canvas->disconnectCanvasObserver(
this);
129 bool usePrintResolutionMode =
m_canvas->imageView()->canvasController()->usePrintResolutionMode();
146 Q_FOREACH(QAction* action, actions) {
147 if (action->objectName()==
"mirror_canvas") {
159 i18nc(
"Make the controls in the overview docker auto-hide or always visible",
"Pin navigation controls")
269 if (e->type() == QEvent::MouseButtonPress) {
271 return static_cast<QMouseEvent*
>(e)->
source() != Qt::MouseEventSynthesizedByApplication;
274 }
else if (e->type() == QEvent::MouseButtonRelease) {
276 return static_cast<QMouseEvent*
>(e)->
source() != Qt::MouseEventSynthesizedByApplication;
279 }
else if (e->type() == QEvent::MouseMove) {
281 return static_cast<QMouseEvent*
>(e)->
source() != Qt::MouseEventSynthesizedByApplication;
284 QMouseEvent *me =
static_cast<QMouseEvent*
>(e);
287 const double distanceSquared = d.x() * d.x() + d.y() * d.y();
289 if (distanceSquared >= showControlsAreaRadiusSquared) {
299 }
else if (e->type() == QEvent::TouchBegin) {
301 QTouchEvent *te =
static_cast<QTouchEvent*
>(e);
311 }
else if (e->type() == QEvent::TouchUpdate) {
315 QTouchEvent *te =
static_cast<QTouchEvent*
>(e);
317 QPointF currentPosition;
318 for (
const QTouchEvent::TouchPoint &touchPoint : te->touchPoints()) {
322 if (touchPoint.state() == Qt::TouchPointStationary) {
325 currentPosition = touchPoint.pos();
332 const qreal distanceSquared = delta.x() * delta.x() + delta.y() * delta.y();
336 QMouseEvent *se =
new QMouseEvent(QEvent::MouseButtonPress,
338 Qt::LeftButton, Qt::LeftButton, Qt::NoModifier,
339 Qt::MouseEventSynthesizedByApplication);
345 QMouseEvent *se =
new QMouseEvent(QEvent::MouseMove,
346 currentPosition, QPointF(), QPointF(),
347 Qt::LeftButton, Qt::LeftButton, Qt::NoModifier,
348 Qt::MouseEventSynthesizedByApplication);
355 }
else if (e->type() == QEvent::TouchEnd || e->type() == QEvent::TouchCancel) {
359 QTouchEvent *te =
static_cast<QTouchEvent*
>(e);
360 if (e->type() == QEvent::TouchEnd) {
363 for (
const QTouchEvent::TouchPoint &touchPoint : te->touchPoints()) {
365 if (touchPoint.state() != Qt::TouchPointReleased) {
375 QMouseEvent *se =
new QMouseEvent(QEvent::MouseButtonRelease,
377 Qt::LeftButton, Qt::LeftButton, Qt::NoModifier,
378 Qt::MouseEventSynthesizedByApplication);
380 }
else if (e->type() == QEvent::TouchEnd) {
405 const qreal pageHeight =
static_cast<qreal
>(this->height());
406 const qreal controlsContainerHeight =
static_cast<qreal
>(
m_controlsContainer->sizeHint().height());
408 const int widgetLimitPosition =
static_cast<int>(std::round(pageHeight - animationProgress * controlsContainerHeight));
410 m_controlsContainer->setGeometry(0, widgetLimitPosition, this->width(),
static_cast<int>(controlsContainerHeight));
414 const int widgetLimitPosition = this->height() - controlsContainerHeight;
416 m_controlsContainer->setGeometry(0, widgetLimitPosition, this->width(), controlsContainerHeight);
419 m_controlsContainer->setGeometry(0, this->height(), this->width(), controlsContainerHeight);
429 int animationDuration;
430 qreal animationStartValue;
440 animationStartValue = 0.0;
443 animationDuration = 1;
444 animationStartValue = 1.0;
454 delay = qMax(delay, 0);
466 int animationDuration;
467 qreal animationStartValue;
477 animationStartValue = 1.0;
480 animationDuration = 1;
481 animationStartValue = 0.0;
491 delay = qMax(delay, 0);
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())
QToolButton * m_pinControlsButton
bool m_isDraggingWithTouch
static constexpr double touchDragDistanceSquared
static constexpr double showControlsAnimationDuration
QHBoxLayout * m_controlsSecondRowLayout
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