Skip to content

Commit fb28adf

Browse files
authored
Merge pull request #5820 from elpaso/colorramp-hidpi
Adjust colorramp height on HiDPI screens
2 parents 53ebe05 + e4cf065 commit fb28adf

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

src/gui/qgscolorrampbutton.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,10 @@ QSize QgsColorRampButton::sizeHint() const
6767
{
6868
//make sure height of button looks good under different platforms
6969
#ifdef Q_OS_WIN
70-
return QSize( 120, 22 );
70+
return QSize( 120, static_cast<int>( std::max( Qgis::UI_SCALE_FACTOR * fontMetrics().height( ), 22.0 ) ) );
7171
#else
72-
return QSize( 120, 28 );
72+
// Adjust height for HiDPI screens
73+
return QSize( 120, static_cast<int>( std::max( Qgis::UI_SCALE_FACTOR * fontMetrics().height( ) * 1.4, 28.0 ) ) );
7374
#endif
7475
}
7576

src/gui/symbology/qgscategorizedsymbolrendererwidget.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,12 @@ void QgsCategorizedSymbolRendererModel::setRenderer( QgsCategorizedSymbolRendere
6464
}
6565
if ( renderer )
6666
{
67-
beginInsertRows( QModelIndex(), 0, renderer->categories().size() - 1 );
6867
mRenderer = renderer;
69-
endInsertRows();
68+
if ( renderer->categories().size() > 0 )
69+
{
70+
beginInsertRows( QModelIndex(), 0, renderer->categories().size() - 1 );
71+
endInsertRows();
72+
}
7073
}
7174
}
7275

0 commit comments

Comments
 (0)