Zoom all follows mouse position.

This commit is contained in:
Luis Lucas
2015-01-18 04:10:29 +00:00
parent bb42e04dbf
commit 691db321f7
7 changed files with 49 additions and 37 deletions
+19 -4
View File
@@ -83,9 +83,11 @@ VideoSubWindow::VideoSubWindow( QWidget * parent, Bool isModule ) :
// Create a new interface to show images
m_cViewArea = new ViewArea( this );
connect( m_cViewArea, SIGNAL( zoomFactorChanged( double , QPoint) ), this, SLOT( processZoomChange( double, QPoint ) ) );
connect( m_cViewArea, SIGNAL( moveScroll( QPoint ) ), this, SLOT( adjustScrollBarByOffset( QPoint ) ) );
connect( m_cViewArea, SIGNAL( moveScroll( QPoint ) ), this, SIGNAL( scrollBarMoved( QPoint ) ) );
connect( m_cViewArea, SIGNAL( zoomFactorChanged( double , QPoint) ), this, SLOT( adjustScrollBarByScale( double, QPoint ) ) );
connect( m_cViewArea, SIGNAL( zoomFactorChanged( double , QPoint) ), this, SIGNAL( zoomFactorChanged_SWindow( double, QPoint ) ) );
connect( m_cViewArea, SIGNAL( scrollBarMoved( QPoint ) ), this, SLOT( adjustScrollBarByOffset( QPoint ) ) );
connect( m_cViewArea, SIGNAL( scrollBarMoved( QPoint ) ), this, SIGNAL( scrollBarMoved_SWindow( QPoint ) ) );
connect( m_cViewArea, SIGNAL( selectionChanged( QRect ) ), this, SLOT( updateSelectedArea( QRect ) ) );
connect( m_cViewArea, SIGNAL( positionChanged( const QPoint & ) ), this, SLOT( updatePixelValueStatusBar( const QPoint & ) ) );
@@ -343,7 +345,10 @@ Void VideoSubWindow::normalSize()
Double factor = 1.0;
Double curFactor = getScaleFactor() ;
if( factor != curFactor )
{
m_cViewArea->scaleZoomFactor( factor/curFactor, QPoint() );
adjustScrollBarByScale( factor/curFactor, QPoint() );
}
}
Void VideoSubWindow::zoomToFit()
@@ -357,13 +362,20 @@ Void VideoSubWindow::zoomToFactor( Double factor , QPoint center )
Double curFactor;
curFactor = getScaleFactor() ;
if( factor != curFactor )
{
m_cViewArea->scaleZoomFactor( factor/curFactor, center );
adjustScrollBarByScale( factor/curFactor, center );
}
}
Void VideoSubWindow::scaleView( Double scale , QPoint center )
{
Q_ASSERT( m_cViewArea->image() );
m_cViewArea->scaleZoomFactor( scale, center );
if(scale!=1.0)
{
m_cViewArea->scaleZoomFactor( scale, center );
adjustScrollBarByScale( scale, center );
}
}
Void VideoSubWindow::scaleView( const QSize & size, QPoint center )
@@ -391,7 +403,10 @@ Void VideoSubWindow::scaleView( const QSize & size, QPoint center )
Double curFactor = getScaleFactor() ;
if( factor != curFactor )
{
m_cViewArea->scaleZoomFactor( factor/curFactor, center );
adjustScrollBarByScale( factor/curFactor, center );
}
}