[vlc-commits] commit: Qt4: pictureflow, check that we use valid index (Ilkka Ollakka )
git at videolan.org
git at videolan.org
Sun Oct 31 17:08:24 CET 2010
vlc | branch: master | Ilkka Ollakka <ileoo at videolan.org> | Sun Oct 31 18:08:12 2010 +0200| [b99bed689f923a9cf3fc42ec9e130c9323509daa] | committer: Ilkka Ollakka
Qt4: pictureflow, check that we use valid index
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=b99bed689f923a9cf3fc42ec9e130c9323509daa
---
modules/gui/qt4/util/pictureflow.cpp | 33 ++++++++++++++++++---------------
1 files changed, 18 insertions(+), 15 deletions(-)
diff --git a/modules/gui/qt4/util/pictureflow.cpp b/modules/gui/qt4/util/pictureflow.cpp
index 54f6503..db894d6 100644
--- a/modules/gui/qt4/util/pictureflow.cpp
+++ b/modules/gui/qt4/util/pictureflow.cpp
@@ -448,21 +448,24 @@ void PictureFlowSoftwareRenderer::paint()
QModelIndex index = state->model->index( state->centerIndex, 0, state->model->currentIndex().parent() );
- QString title = PLModel::getMeta( index, COLUMN_TITLE );
- QString artist = PLModel::getMeta( index, COLUMN_ARTIST );
- QFont font( index.data( Qt::FontRole ).value<QFont>() );
- painter.setFont( font );
- painter.setBrush( QBrush( Qt::lightGray ) );
- painter.setPen( QColor( Qt::lightGray ) );
- QFontMetrics fm = painter.fontMetrics();
-
- QPoint textstart( buffer.width() / 2 - state->slideWidth/2 , buffer.height() / 2 + state->slideWidth/2 + 5 );
- QPoint artiststart( 0, fm.xHeight() * 2 );
-
- painter.drawText( textstart, title );
-
- textstart += artiststart;
- painter.drawText( textstart, artist);
+ if( index.isValid() )
+ {
+ QString title = PLModel::getMeta( index, COLUMN_TITLE );
+ QString artist = PLModel::getMeta( index, COLUMN_ARTIST );
+ QFont font( index.data( Qt::FontRole ).value<QFont>() );
+ painter.setFont( font );
+ painter.setBrush( QBrush( Qt::lightGray ) );
+ painter.setPen( QColor( Qt::lightGray ) );
+ QFontMetrics fm = painter.fontMetrics();
+
+ QPoint textstart( buffer.width() / 2 - state->slideWidth/2 , buffer.height() / 2 + state->slideWidth/2 + 5 );
+ QPoint artiststart( 0, fm.xHeight() * 2 );
+
+ painter.drawText( textstart, title );
+
+ textstart += artiststart;
+ painter.drawText( textstart, artist);
+ }
}
void PictureFlowSoftwareRenderer::init()
More information about the vlc-commits
mailing list