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:
@@ -45,6 +45,7 @@ SubWindowHandle::SubWindowHandle( QWidget * parent ) :
|
||||
|
||||
// Define the cViewArea as the widget inside the scroll area
|
||||
m_cScrollArea->setWidget( m_cViewArea );
|
||||
m_cScrollArea->setWidgetResizable(true);
|
||||
|
||||
m_pcCurrentModule = NULL;
|
||||
|
||||
|
||||
+5
-14
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user