diff --git a/ChangeLog.txt b/ChangeLog.txt index a8fed032b..42628077d 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -49,6 +49,7 @@ - [#818] Improve Piece path validation. Check uniqueness. - [#819] Use OpenGL as render for view. - [#826] New Feature. Add and remove items to groups from the context menu. +- Mouse double click zoom fit best current pattern piece. # Version 0.5.1 (unreleased) - [#683] Tool Seam allowance's dialog is off screen on small resolutions. diff --git a/src/app/valentina/mainwindow.h b/src/app/valentina/mainwindow.h index 60a4fbe04..93db26146 100644 --- a/src/app/valentina/mainwindow.h +++ b/src/app/valentina/mainwindow.h @@ -71,6 +71,7 @@ public slots: virtual void ShowToolTip(const QString &toolTip) Q_DECL_OVERRIDE; virtual void UpdateVisibilityGroups() Q_DECL_OVERRIDE; virtual void UpdateDetailsList() Q_DECL_OVERRIDE; + virtual void ZoomFitBestCurrent() Q_DECL_OVERRIDE; signals: void RefreshHistory(); @@ -190,7 +191,6 @@ private slots: void ClosedDialogPlaceLabel(int result); void ClosedDialogInsertNode(int result); - void ZoomFitBestCurrent(); void LoadIndividual(); void LoadMultisize(); void UnloadMeasurements(); diff --git a/src/libs/vwidgets/vabstractmainwindow.cpp b/src/libs/vwidgets/vabstractmainwindow.cpp index 7a19e720f..9ec962dca 100644 --- a/src/libs/vwidgets/vabstractmainwindow.cpp +++ b/src/libs/vwidgets/vabstractmainwindow.cpp @@ -168,3 +168,9 @@ void VAbstractMainWindow::UpdateDetailsList() { // do nothing } + +//--------------------------------------------------------------------------------------------------------------------- +void VAbstractMainWindow::ZoomFitBestCurrent() +{ + // do nothing +} diff --git a/src/libs/vwidgets/vabstractmainwindow.h b/src/libs/vwidgets/vabstractmainwindow.h index cb84fa510..f88d96f46 100644 --- a/src/libs/vwidgets/vabstractmainwindow.h +++ b/src/libs/vwidgets/vabstractmainwindow.h @@ -48,6 +48,7 @@ public slots: virtual void ShowToolTip(const QString &toolTip)=0; virtual void UpdateVisibilityGroups(); virtual void UpdateDetailsList(); + virtual void ZoomFitBestCurrent(); protected slots: void WindowsLocale(); diff --git a/src/libs/vwidgets/vmaingraphicsview.cpp b/src/libs/vwidgets/vmaingraphicsview.cpp index adf2145dd..c8c77476d 100644 --- a/src/libs/vwidgets/vmaingraphicsview.cpp +++ b/src/libs/vwidgets/vmaingraphicsview.cpp @@ -61,6 +61,7 @@ #include "vsimplecurve.h" #include "../vmisc/vabstractapplication.h" #include "../vmisc/vsettings.h" +#include "vabstractmainwindow.h" const int GraphicsViewZoom::duration = 300; const int GraphicsViewZoom::updateInterval = 40; @@ -607,6 +608,20 @@ void VMainGraphicsView::mouseReleaseEvent(QMouseEvent *event) } } +//--------------------------------------------------------------------------------------------------------------------- +void VMainGraphicsView::mouseDoubleClickEvent(QMouseEvent *event) +{ + if (event->button() == Qt::LeftButton) + { + if (VAbstractMainWindow *window = qobject_cast(qApp->getMainWindow())) + { + window->ZoomFitBestCurrent(); + } + } + + QGraphicsView::mouseDoubleClickEvent(event); +} + //--------------------------------------------------------------------------------------------------------------------- qreal VMainGraphicsView::MinScale() { diff --git a/src/libs/vwidgets/vmaingraphicsview.h b/src/libs/vwidgets/vmaingraphicsview.h index 5bbb76cb2..b9290d49e 100644 --- a/src/libs/vwidgets/vmaingraphicsview.h +++ b/src/libs/vwidgets/vmaingraphicsview.h @@ -158,6 +158,7 @@ protected: virtual void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE; virtual void mouseMoveEvent(QMouseEvent *event) Q_DECL_OVERRIDE; virtual void mouseReleaseEvent(QMouseEvent *event) Q_DECL_OVERRIDE; + virtual void mouseDoubleClickEvent(QMouseEvent *event) Q_DECL_OVERRIDE; private: Q_DISABLE_COPY(VMainGraphicsView) GraphicsViewZoom* zoom;