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:
@@ -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;
|
||||||
}
|
}
|
||||||
|
@@ -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 );
|
||||||
|
Reference in New Issue
Block a user