Skip to content

Commit

Permalink
Merge pull request #5820 from elpaso/colorramp-hidpi
Browse files Browse the repository at this point in the history
Adjust colorramp height on HiDPI screens
  • Loading branch information
elpaso committed Dec 9, 2017
2 parents 53ebe05 + e4cf065 commit fb28adf
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
5 changes: 3 additions & 2 deletions src/gui/qgscolorrampbutton.cpp
Expand Up @@ -67,9 +67,10 @@ QSize QgsColorRampButton::sizeHint() const
{
//make sure height of button looks good under different platforms
#ifdef Q_OS_WIN
return QSize( 120, 22 );
return QSize( 120, static_cast<int>( std::max( Qgis::UI_SCALE_FACTOR * fontMetrics().height( ), 22.0 ) ) );
#else
return QSize( 120, 28 );
// Adjust height for HiDPI screens
return QSize( 120, static_cast<int>( std::max( Qgis::UI_SCALE_FACTOR * fontMetrics().height( ) * 1.4, 28.0 ) ) );
#endif
}

Expand Down
7 changes: 5 additions & 2 deletions src/gui/symbology/qgscategorizedsymbolrendererwidget.cpp
Expand Up @@ -64,9 +64,12 @@ void QgsCategorizedSymbolRendererModel::setRenderer( QgsCategorizedSymbolRendere
}
if ( renderer )
{
beginInsertRows( QModelIndex(), 0, renderer->categories().size() - 1 );
mRenderer = renderer;
endInsertRows();
if ( renderer->categories().size() > 0 )
{
beginInsertRows( QModelIndex(), 0, renderer->categories().size() - 1 );
endInsertRows();
}
}
}

Expand Down

0 comments on commit fb28adf

Please sign in to comment.