Skip to content

Commit

Permalink
identify resutlts dialog: always keep minimum QgsIdentifyResultsWebVi…
Browse files Browse the repository at this point in the history
…ew height
  • Loading branch information
blazek committed Feb 12, 2014
1 parent c64a051 commit 9784925
Showing 1 changed file with 14 additions and 17 deletions.
31 changes: 14 additions & 17 deletions src/app/qgsidentifyresultsdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,29 +151,26 @@ QSize QgsIdentifyResultsWebView::sizeHint() const
QgsDebugMsg( QString( "content size: %1 x %2" ).arg( s.width() ).arg( s.height() ) );
int height = s.height();

// if page is not yet loaded set some minimum height
if ( height == 0 )
// parent is qt_scrollarea_viewport
// parent is not available the first time - before results dialog was shown
QWidget *widget = qobject_cast<QWidget *>( parent() );
if ( widget )
{
height = 100;
// It can probably happen that parent is available but it does not have yet
// correct size, see #9377.
int max = widget->size().height() * 0.9;
QgsDebugMsg( QString( "parent widget height = %1 max height = %2" ).arg( widget->size().height() ).arg( max ) );
height = qMin( height, max );
}
else
{
// parent is qt_scrollarea_viewport
// parent is not available the first time - before results dialog was shown
QWidget *widget = qobject_cast<QWidget *>( parent() );
if ( widget )
{
int max = widget->size().height() * 0.9;
QgsDebugMsg( QString( "parent widget height = %1 max height = %2" ).arg( widget->size().height() ).arg( max ) );
if ( height > max )
height = max;
}
else
{
QgsDebugMsg( "parent not available" ) ;
}
QgsDebugMsg( "parent not available" ) ;
}

// Always keep some minimum size, e.g. if page is not yet loaded
// or parent has wrong size
height = qMax( height, 100 );

s = QSize( size().width(), height );
QgsDebugMsg( QString( "size: %1 x %2" ).arg( s.width() ).arg( s.height() ) );
return s;
Expand Down

0 comments on commit 9784925

Please sign in to comment.