diff options
Diffstat (limited to 'qt-ui/modeldelegates.cpp')
-rw-r--r-- | qt-ui/modeldelegates.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/qt-ui/modeldelegates.cpp b/qt-ui/modeldelegates.cpp index 1ac2f46c6..00f10092d 100644 --- a/qt-ui/modeldelegates.cpp +++ b/qt-ui/modeldelegates.cpp @@ -14,10 +14,16 @@ void StarWidgetsDelegate::paint(QPainter* painter, const QStyleOptionViewItem& o return; } - int rating = index.model()->data(index, Qt::DisplayRole).toInt(); + QVariant value = index.model()->data(index, Qt::DisplayRole); - if (option.state & QStyle::State_Selected) - painter->fillRect(option.rect, option.palette.highlight()); + if (!value.isValid()){ + return; + } + + int rating = value.toInt(); + + if(option.state & QStyle::State_Selected) + painter->fillRect(option.rect, option.palette.highlight()); painter->save(); painter->setRenderHint(QPainter::Antialiasing, true); |