Commit d9ac0cfc authored by Enrico Ros's avatar Enrico Ros
Browse files

Usability fix. Set initial focus on PageView.

CCMAIL: zanettea@dei.unipd.it

svn path=/branches/kpdf_experiments/kdegraphics/kpdf/; revision=362051
parent b1ad685b
......@@ -126,6 +126,7 @@ Part::Part(QWidget *parentWidget, const char *widgetName,
// widgets: [] | [right 'pageView']
m_pageView = new PageView( m_splitter, m_document );
m_pageView->setFocus(); //usability setting
connect( m_pageView, SIGNAL( urlDropped( const KURL& ) ), SLOT( openURL( const KURL & )));
//connect(m_pageView, SIGNAL( rightClick() ), this, SIGNAL( rightClick() ));
......
......@@ -656,20 +656,18 @@ void PageView::contentsMouseReleaseEvent( QMouseEvent * e )
if ( leftButton && !d->mouseSelectionRect.isNull() )
{
QRect selRect = d->mouseSelectionRect.normalize();
if ( selRect.width() < 2 || selRect.height() < 2 )
if ( selRect.width() < 4 || selRect.height() < 4 )
break;
// find out new zoom ratio and normalized view center (relative to the contentsRect)
double zoom = QMIN( (double)visibleWidth() / (double)selRect.width(), (double)visibleHeight() / (double)selRect.height() );
double nX = ( selRect.left() + (double)selRect.width() / 2 ) / (double)contentsWidth();
double nY = ( selRect.top() + (double)selRect.height() / 2 ) / (double)contentsHeight();
double nX = (double)(selRect.left() + selRect.right()) / (2.0 * (double)contentsWidth());
double nY = (double)(selRect.top() + selRect.bottom()) / (2.0 * (double)contentsHeight());
// zoom up to 400%
if ( d->zoomFactor <= 4.0 || zoom <= 1.0 )
{
d->zoomFactor *= zoom;
if ( d->zoomFactor > 4.0 )
d->zoomFactor = 4.0;
viewport()->setUpdatesEnabled( false );
updateZoom( ZoomRefreshCurrent );
viewport()->setUpdatesEnabled( true );
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment