[vlc-commits] Qt: PLModel: Move font's contextual style to views

Francois Cartegnie git at videolan.org
Fri Jul 20 13:58:18 CEST 2012


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Fri Jul 20 13:57:43 2012 +0200| [229c807ce1cf5b5edebb7de9621a8191d78209b5] | committer: Francois Cartegnie

Qt: PLModel: Move font's contextual style to views

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=229c807ce1cf5b5edebb7de9621a8191d78209b5
---

 modules/gui/qt4/components/playlist/playlist_model.cpp |    5 +----
 modules/gui/qt4/components/playlist/views.cpp          |    2 ++
 2 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/modules/gui/qt4/components/playlist/playlist_model.cpp b/modules/gui/qt4/components/playlist/playlist_model.cpp
index 9e58022..a41c356 100644
--- a/modules/gui/qt4/components/playlist/playlist_model.cpp
+++ b/modules/gui/qt4/components/playlist/playlist_model.cpp
@@ -363,10 +363,7 @@ QVariant PLModel::data( const QModelIndex &index, const int role ) const
     }
     else if( role == Qt::FontRole )
     {
-        QFont f;
-        if( isCurrent( index ) )
-            f.setBold( true );
-        return QVariant( f );
+        return QVariant( QFont() );
     }
     else if( role == Qt::ToolTipRole )
     {
diff --git a/modules/gui/qt4/components/playlist/views.cpp b/modules/gui/qt4/components/playlist/views.cpp
index d33222a..5512e05 100644
--- a/modules/gui/qt4/components/playlist/views.cpp
+++ b/modules/gui/qt4/components/playlist/views.cpp
@@ -80,6 +80,7 @@ void PlIconViewItemDelegate::paint( QPainter * painter, const QStyleOptionViewIt
 
     QFont font( index.data( Qt::FontRole ).value<QFont>() );
     font.setPointSize( __MAX( font.pointSize() + i_zoom, 4 ) );
+    font.setBold( option.state & QStyle::State_Selected );
     painter->setFont( font );
     QFontMetrics fm = painter->fontMetrics();
 
@@ -220,6 +221,7 @@ void PlListViewItemDelegate::paint( QPainter * painter, const QStyleOptionViewIt
     //Draw title info
     f.setItalic( true );
     f.setPointSize( __MAX( f.pointSize() + i_zoom, 4 ) );
+    f.setBold( option.state & QStyle::State_Selected );
     painter->setFont( f );
     QFontMetrics fm( painter->fontMetrics() );
 



More information about the vlc-commits mailing list