[vlc-commits] Qt: QVLCDial: move value in corner
Francois Cartegnie
git at videolan.org
Wed Jul 10 09:29:06 CEST 2013
vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Wed Jul 10 09:28:21 2013 +0200| [126469035aacf57c94f3ef3089753e2c79573ddf] | committer: Francois Cartegnie
Qt: QVLCDial: move value in corner
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=126469035aacf57c94f3ef3089753e2c79573ddf
---
modules/gui/qt4/util/customwidgets.cpp | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/modules/gui/qt4/util/customwidgets.cpp b/modules/gui/qt4/util/customwidgets.cpp
index 8d19631..23a6150 100644
--- a/modules/gui/qt4/util/customwidgets.cpp
+++ b/modules/gui/qt4/util/customwidgets.cpp
@@ -96,10 +96,13 @@ void VLCQDial::paintEvent( QPaintEvent *event )
{
QDial::paintEvent( event );
QPainter painter( this );
- QRect rect = geometry();
painter.setPen( QPen( palette().color( QPalette::WindowText ) ) );
- painter.drawText( QRectF( 0, rect.height() * 0.66, rect.width(), rect.height() ),
- Qt::AlignHCenter, QString::number( value() ), 0 );
+ float radius = 0.5 * 0.707106 * qMin( size().width(), size().height() );
+ painter.drawText( QRectF( rect().center().x() + radius,
+ rect().center().y() + radius,
+ size().width(),
+ size().height() ),
+ 0, QString::number( value() ), 0 );
painter.end();
}
More information about the vlc-commits
mailing list