1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-17 19:37:09 +02:00

* Use relative corner sizes.

This commit is contained in:
Christian Muehlhaeuser
2012-11-15 08:11:55 +01:00
parent 4b3bf16edc
commit e9a59522ca
2 changed files with 3 additions and 5 deletions

View File

@@ -329,8 +329,6 @@ createRoundedImage( const QPixmap& pixmap, const QSize& size, float frameWidthPc
if ( !height || !width ) if ( !height || !width )
return QPixmap(); return QPixmap();
int frameWidth = (float)width * frameWidthPct;
QPixmap scaledAvatar = pixmap.scaled( width, height, Qt::IgnoreAspectRatio, Qt::SmoothTransformation ); QPixmap scaledAvatar = pixmap.scaled( width, height, Qt::IgnoreAspectRatio, Qt::SmoothTransformation );
QPixmap frame( width, height ); QPixmap frame( width, height );
frame.fill( Qt::transparent ); frame.fill( Qt::transparent );
@@ -346,11 +344,11 @@ createRoundedImage( const QPixmap& pixmap, const QSize& size, float frameWidthPc
painter.setBrush( brush ); painter.setBrush( brush );
painter.setPen( pen ); painter.setPen( pen );
painter.drawRoundedRect( outerRect, frameWidth * 2, frameWidth * 2 ); painter.drawRoundedRect( outerRect, frameWidthPct * 100.0, frameWidthPct * 100.0, Qt::RelativeSize );
/* painter.setBrush( Qt::transparent ); /* painter.setBrush( Qt::transparent );
painter.setPen( Qt::white ); painter.setPen( Qt::white );
painter.drawRoundedRect( outerRect, frameWidth * 2, frameWidth * 2 ); */ painter.drawRoundedRect( outerRect, frameWidthPct, frameWidthPct, Qt::RelativeSize ); */
return frame; return frame;
} }

View File

@@ -48,7 +48,7 @@ namespace TomahawkUtils
DLLEXPORT void openUrl( const QUrl& url ); DLLEXPORT void openUrl( const QUrl& url );
DLLEXPORT QPixmap createRoundedImage( const QPixmap& avatar, const QSize& size, float frameWidthPct = 0.10 ); DLLEXPORT QPixmap createRoundedImage( const QPixmap& avatar, const QSize& size, float frameWidthPct = 0.20 );
DLLEXPORT QColor alphaBlend( const QColor& colorFrom, const QColor& colorTo, float opacity ); DLLEXPORT QColor alphaBlend( const QColor& colorFrom, const QColor& colorTo, float opacity );
DLLEXPORT QPixmap createDragPixmap( MediaType type, int itemCount = 1 ); DLLEXPORT QPixmap createDragPixmap( MediaType type, int itemCount = 1 );