[vlc-commits] qt: fix rendering of FramelessButton with HiDpi
Pierre Lamot
git at videolan.org
Sat Oct 14 22:28:30 CEST 2017
vlc | branch: master | Pierre Lamot <pierre at videolabs.io> | Fri Sep 29 10:25:10 2017 +0200| [2c62c0b5b940f5be52f101ad5e9e82933a0ee808] | committer: Jean-Baptiste Kempf
qt: fix rendering of FramelessButton with HiDpi
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=2c62c0b5b940f5be52f101ad5e9e82933a0ee808
---
modules/gui/qt/components/playlist/selector.cpp | 4 +++-
modules/gui/qt/util/customwidgets.cpp | 5 ++---
2 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/modules/gui/qt/components/playlist/selector.cpp b/modules/gui/qt/components/playlist/selector.cpp
index 1d41f7f6af..a7cef6be13 100644
--- a/modules/gui/qt/components/playlist/selector.cpp
+++ b/modules/gui/qt/components/playlist/selector.cpp
@@ -93,7 +93,9 @@ void PLSelItem::addAction( ItemAction act, const QString& tooltip )
lblAction = new SelectorActionButton();
lblAction->setIcon( icon );
- lblAction->setMinimumWidth( lblAction->sizeHint().width() + 6 );
+ int icon_size = fontMetrics().height();
+ lblAction->setIconSize( QSize( icon_size, icon_size ) );
+ lblAction->setMinimumWidth( lblAction->sizeHint().width() + icon_size );
if( !tooltip.isEmpty() ) lblAction->setToolTip( tooltip );
diff --git a/modules/gui/qt/util/customwidgets.cpp b/modules/gui/qt/util/customwidgets.cpp
index 8ffb6d7870..dfb8307337 100644
--- a/modules/gui/qt/util/customwidgets.cpp
+++ b/modules/gui/qt/util/customwidgets.cpp
@@ -50,9 +50,8 @@ QFramelessButton::QFramelessButton( QWidget *parent )
void QFramelessButton::paintEvent( QPaintEvent * )
{
QPainter painter( this );
- QPixmap pix = icon().pixmap( size() );
- QPoint pos( (width() - pix.width()) / 2, (height() - pix.height()) / 2 );
- painter.drawPixmap( QRect( pos.x(), pos.y(), pix.width(), pix.height() ), pix );
+ icon().paint(&painter, QRect( 0, 0, width(), height()));
+
}
QElidingLabel::QElidingLabel( const QString &s, Qt::TextElideMode mode, QWidget * parent )
More information about the vlc-commits
mailing list