Skip to content

Commit

Permalink
1
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaoyifang committed Dec 28, 2024
1 parent f44c148 commit 26a9970
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 7 deletions.
6 changes: 1 addition & 5 deletions src/instances.cc
Original file line number Diff line number Diff line change
Expand Up @@ -88,18 +88,14 @@ Config::Group Group::makeConfigGroup()
return result;
}

QIcon Group::makeIcon( int size ) const
QIcon Group::makeIcon() const
{
if ( !iconData.isNull() ) {
return iconData;
}

QIcon i = icon.size() ? QIcon( ":/flags/" + icon ) : QIcon();

if ( size > 0 ) {
return i.pixmap( size, size );
}

return i;
}

Expand Down
2 changes: 1 addition & 1 deletion src/instances.hh
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ struct Group
Config::Group makeConfigGroup();

/// Makes an icon object for this group, based on the icon's name or iconData.
QIcon makeIcon( int size = -1 ) const;
QIcon makeIcon() const;

/// Remove id's if not presented in group dictionaries
void checkMutedDictionaries( Config::MutedDictionaries * mutedDictionaries ) const;
Expand Down
3 changes: 2 additions & 1 deletion src/ui/groupcombobox.cc
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,9 @@ void GroupComboBox::fill( Instances::Groups const & groups )

QFontMetrics metrics( font() );
int size = metrics.height();
setIconSize( QSize( size, size ) );
for ( unsigned x = 0; x < groups.size(); ++x ) {
addItem( groups[ x ].makeIcon( size ), groups[ x ].name, groups[ x ].id );
addItem( groups[ x ].makeIcon(), groups[ x ].name, groups[ x ].id );

if ( prevId == groups[ x ].id ) {
setCurrentIndex( x );
Expand Down

0 comments on commit 26a9970

Please sign in to comment.