mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-06 22:26:32 +02:00
* Added squareCenterPixmap( QPixmap ) to TomahawkUtils.
This commit is contained in:
@@ -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
|
void
|
||||||
drawCompositedPopup( QWidget* widget,
|
drawCompositedPopup( QWidget* widget,
|
||||||
const QPainterPath& outline,
|
const QPainterPath& outline,
|
||||||
|
@@ -63,17 +63,15 @@ namespace TomahawkUtils
|
|||||||
DLLEXPORT int defaultFontHeight();
|
DLLEXPORT int defaultFontHeight();
|
||||||
DLLEXPORT QSize defaultIconSize();
|
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 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 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 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 createTiledPixmap( int width, int height, const QImage& src );
|
||||||
|
|
||||||
DLLEXPORT QPixmap addDropShadow( const QPixmap& sourceImage, const QSize& targetSize );
|
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 );
|
DLLEXPORT void drawCompositedPopup( QWidget* widget, const QPainterPath& outline, const QColor& lineColor, const QBrush& backgroundBrush, qreal opacity );
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user