Some adjustments to viewarea widget resize. Sequence is kept in the middle of the scrollarea even when sub-window is resized.

This commit is contained in:
Luis Lucas committed 2014-03-23 16:08:51 +00:00
1 parent e36c523e1f
commit e1ec5a1f0a
2 files changed
+6 -14

No files matched your search

+5 -14
View File
@@ -104,11 +104,10 @@ void ViewArea::setZoomFactor( double f )
//return;
m_zoomFactor = f;
emit( zoomFactorChanged( m_zoomFactor ) );
//emit( zoomFactorChanged( m_zoomFactor ) );
updateSize();
repaint();
updateGeometry();
update();
}
void ViewArea::setMode( ViewMode mode )
@@ -214,16 +213,7 @@ void ViewArea::updateSize()
int h = m_pixmap.height() * m_zoomFactor;
setMinimumSize( w, h );
QWidget *p = parentWidget();
if( p )
{
// If the parent size is bigger than the minimum area to view the
// image, resize() will call resizeEvent(); otherwise, we need to
// perform the necessary updates (updateOffset).
resize( p->width(), p->height() );
}
if( w <= width() && h <= height() )
updateOffset();
updateOffset();
}
void ViewArea::updateOffset()
@@ -250,12 +240,13 @@ void ViewArea::updateOffset()
////////////////////////////////////////////////////////////////////////////////
// Resize Event
////////////////////////////////////////////////////////////////////////////////
void ViewArea::resizeEvent( QResizeEvent */* event */)
void ViewArea::resizeEvent( QResizeEvent *event )
{
if( size().isEmpty() || m_pixmap.isNull() )
return;
updateOffset();
update();
}
////////////////////////////////////////////////////////////////////////////////
// Paint Event