Reduce connectivity for VMainGraphicsView class.
Use a signal instead of direct read of a main window to trigger zoom fit best.
This commit is contained in:
parent
3c0c624682
commit
d6e555f482
|
@ -503,6 +503,7 @@ void MainWindow::InitScenes()
|
||||||
|
|
||||||
connect(ui->view, &VMainGraphicsView::MouseRelease, this, [this](){EndVisualization(true);});
|
connect(ui->view, &VMainGraphicsView::MouseRelease, this, [this](){EndVisualization(true);});
|
||||||
connect(ui->view, &VMainGraphicsView::ScaleChanged, this, &MainWindow::ScaleChanged);
|
connect(ui->view, &VMainGraphicsView::ScaleChanged, this, &MainWindow::ScaleChanged);
|
||||||
|
connect(ui->view, &VMainGraphicsView::ZoomFitBestCurrent, this, [this](){ZoomFitBestCurrent();});
|
||||||
QSizePolicy policy(QSizePolicy::Expanding, QSizePolicy::Expanding);
|
QSizePolicy policy(QSizePolicy::Expanding, QSizePolicy::Expanding);
|
||||||
policy.setHorizontalStretch(12);
|
policy.setHorizontalStretch(12);
|
||||||
ui->view->setSizePolicy(policy);
|
ui->view->setSizePolicy(policy);
|
||||||
|
|
|
@ -55,7 +55,7 @@
|
||||||
#include "vmaingraphicsscene.h"
|
#include "vmaingraphicsscene.h"
|
||||||
#include "vsimplecurve.h"
|
#include "vsimplecurve.h"
|
||||||
#include "vcontrolpointspline.h"
|
#include "vcontrolpointspline.h"
|
||||||
#include "../vmisc/vabstractvalapplication.h"
|
#include "../vmisc/vabstractapplication.h"
|
||||||
#include "../vmisc/vsettings.h"
|
#include "../vmisc/vsettings.h"
|
||||||
#include "vabstractmainwindow.h"
|
#include "vabstractmainwindow.h"
|
||||||
#include "global.h"
|
#include "global.h"
|
||||||
|
@ -645,10 +645,7 @@ void VMainGraphicsView::mouseDoubleClickEvent(QMouseEvent *event)
|
||||||
{
|
{
|
||||||
if (event->button() == Qt::LeftButton && qApp->Settings()->IsDoubleClickZoomFitBestCurrentPP())
|
if (event->button() == Qt::LeftButton && qApp->Settings()->IsDoubleClickZoomFitBestCurrentPP())
|
||||||
{
|
{
|
||||||
if (VAbstractMainWindow *window = qobject_cast<VAbstractMainWindow *>(qApp->getMainWindow()))
|
emit ZoomFitBestCurrent();
|
||||||
{
|
|
||||||
window->ZoomFitBestCurrent();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QGraphicsView::mouseDoubleClickEvent(event);
|
QGraphicsView::mouseDoubleClickEvent(event);
|
||||||
|
|
|
@ -149,6 +149,7 @@ signals:
|
||||||
void MouseRelease();
|
void MouseRelease();
|
||||||
void itemClicked(QGraphicsItem *item);
|
void itemClicked(QGraphicsItem *item);
|
||||||
void ScaleChanged(qreal scale);
|
void ScaleChanged(qreal scale);
|
||||||
|
void ZoomFitBestCurrent();
|
||||||
public slots:
|
public slots:
|
||||||
void Zoom(qreal scale);
|
void Zoom(qreal scale);
|
||||||
void ZoomIn();
|
void ZoomIn();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user