From 8d927a98fdac92b562cfd5c769f7ae7bed0ace2d Mon Sep 17 00:00:00 2001 From: Gerald Combs Date: Thu, 1 Dec 2016 14:32:29 -0800 Subject: Qt: Fix QStyledItemDelegate assertions. QStyledItemDelegate::paint asserts if you pass it an empty QModelIndex. We were doing this in PercentBarDelegate and TimelineDelegate in order to keep it from drawing any text. Return an empty string from ::displayText instead, which appears to be the correct way to paint without text. Bug: 13180 Change-Id: I8064d9575e04e95a926797eec7f6ad2b0bfef1c0 Reviewed-on: https://code.wireshark.org/review/19007 Reviewed-by: Gerald Combs Petri-Dish: Gerald Combs Reviewed-by: Michael Mann --- ui/qt/percent_bar_delegate.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ui/qt/percent_bar_delegate.cpp') diff --git a/ui/qt/percent_bar_delegate.cpp b/ui/qt/percent_bar_delegate.cpp index 2a8ea0b2f2..358650ee5d 100644 --- a/ui/qt/percent_bar_delegate.cpp +++ b/ui/qt/percent_bar_delegate.cpp @@ -37,7 +37,7 @@ void PercentBarDelegate::paint(QPainter *painter, const QStyleOptionViewItem &op // Paint our rect with no text using the current style, then draw our // bar and text over it. - QStyledItemDelegate::paint(painter, option, QModelIndex()); + QStyledItemDelegate::paint(painter, option, index); bool ok = false; double value = index.data(Qt::UserRole).toDouble(&ok); -- cgit v1.2.1