mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-03-23 17:29:42 +01:00
* Added squareCenterPixmap( QPixmap ) to TomahawkUtils.
This commit is contained in:
parent
a01233124b
commit
455e525b11
@ -913,6 +913,28 @@ addDropShadow( const QPixmap& source, const QSize& targetSize )
|
||||
}
|
||||
|
||||
|
||||
QPixmap
|
||||
squareCenterPixmap( const QPixmap& sourceImage )
|
||||
{
|
||||
if ( sourceImage.width() != sourceImage.height() )
|
||||
{
|
||||
const int sqwidth = qMin( sourceImage.width(), sourceImage.height() );
|
||||
const int delta = abs( sourceImage.width() - sourceImage.height() );
|
||||
|
||||
if ( sourceImage.width() > sourceImage.height() )
|
||||
{
|
||||
return sourceImage.copy( delta / 2, 0, sqwidth, sqwidth );
|
||||
}
|
||||
else
|
||||
{
|
||||
return sourceImage.copy( 0, delta / 2, sqwidth, sqwidth );
|
||||
}
|
||||
}
|
||||
|
||||
return sourceImage;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
drawCompositedPopup( QWidget* widget,
|
||||
const QPainterPath& outline,
|
||||
|
@ -63,17 +63,15 @@ namespace TomahawkUtils
|
||||
DLLEXPORT int defaultFontHeight();
|
||||
DLLEXPORT QSize defaultIconSize();
|
||||
|
||||
DLLEXPORT QPixmap defaultPixmap( ImageType type, ImageMode mode = TomahawkUtils::Original, const QSize& size = QSize( 0, 0 ) );
|
||||
|
||||
DLLEXPORT void prepareStyleOption( QStyleOptionViewItemV4* option, const QModelIndex& index, PlayableItem* item );
|
||||
|
||||
DLLEXPORT void drawRoundedButton( QPainter* painter, const QRect& btnRect, const QColor& color, const QColor &gradient1bottom = QColor(), const QColor& gradient2top = QColor(), const QColor& gradient2bottom = QColor() );
|
||||
|
||||
DLLEXPORT void styleScrollBar( QScrollBar* scrollBar );
|
||||
|
||||
DLLEXPORT QPixmap defaultPixmap( ImageType type, ImageMode mode = TomahawkUtils::Original, const QSize& size = QSize( 0, 0 ) );
|
||||
DLLEXPORT QPixmap createTiledPixmap( int width, int height, const QImage& src );
|
||||
|
||||
DLLEXPORT QPixmap addDropShadow( const QPixmap& sourceImage, const QSize& targetSize );
|
||||
DLLEXPORT QPixmap squareCenterPixmap( const QPixmap& sourceImage );
|
||||
|
||||
DLLEXPORT void drawCompositedPopup( QWidget* widget, const QPainterPath& outline, const QColor& lineColor, const QBrush& backgroundBrush, qreal opacity );
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user