tst_QTreeView: fix use of uninited variable

Valgrind complained:

==13941== Conditional jump or move depends on uninitialised value(s)
==13941==    at 0x4206FC: tst_QTreeView::styleOptionViewItem()::MyDelegate::paint(QPainter*, QStyleOptionViewItem const&, QModelIndex const&) const (tst_qtreeview.cpp:3062)
[...]

Change-Id: I76da01c191415ba0a00b4b85312f2fe08e4ee2d2
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
This commit is contained in:
Marc Mutz 2014-04-07 13:53:36 +02:00 committed by The Qt Project
parent 9c2ecf89eb
commit d9077669a1

View File

@ -3047,7 +3047,13 @@ void tst_QTreeView::styleOptionViewItem()
static const char* s_pos[] = { "Invalid", "Beginning", "Middle", "End", "OnlyOne" };
return s_pos[pos];
}
public:
public:
MyDelegate()
: QStyledItemDelegate(),
count(0),
allCollapsed(false)
{}
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index ) const
{
QVERIFY(qstyleoption_cast<const QStyleOptionViewItemV4 *>(&option));