From c48721777126095140cc2168818429d21fbf21e9 Mon Sep 17 00:00:00 2001 From: hjk Date: Mon, 27 Jun 2016 13:46:46 +0200 Subject: [PATCH] Debugger: Use a typed root item in ThreadModel ... and remove casts where possible. Change-Id: I10305efbe336de7aa5efdb73a52c5f89cd2d089e Reviewed-by: Christian Stenger --- src/plugins/debugger/threadshandler.cpp | 8 ++++---- src/plugins/debugger/threadshandler.h | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/plugins/debugger/threadshandler.cpp b/src/plugins/debugger/threadshandler.cpp index 306cd6146bf..b5a2d343b86 100644 --- a/src/plugins/debugger/threadshandler.cpp +++ b/src/plugins/debugger/threadshandler.cpp @@ -266,9 +266,9 @@ int ThreadsHandler::currentThreadIndex() const void ThreadsHandler::sort(int column, Qt::SortOrder order) { - rootItem()->sortChildren([order, column](const TreeItem *item1, const TreeItem *item2) -> bool { - const QVariant v1 = static_cast(item1)->threadPart(column); - const QVariant v2 = static_cast(item2)->threadPart(column); + rootItem()->sortChildren([order, column](const ThreadItem *item1, const ThreadItem *item2) -> bool { + const QVariant v1 = item1->threadPart(column); + const QVariant v2 = item2->threadPart(column); if (v1 == v2) return false; if (column == 0) @@ -286,7 +286,7 @@ ThreadId ThreadsHandler::currentThread() const ThreadId ThreadsHandler::threadAt(int index) const { QTC_ASSERT(index >= 0 && index < rootItem()->childCount(), return ThreadId()); - return static_cast(rootItem()->childAt(index))->threadData.id; + return rootItem()->childAt(index)->threadData.id; } void ThreadsHandler::setCurrentThread(ThreadId id) diff --git a/src/plugins/debugger/threadshandler.h b/src/plugins/debugger/threadshandler.h index 9a29b5314e7..feeb57aa174 100644 --- a/src/plugins/debugger/threadshandler.h +++ b/src/plugins/debugger/threadshandler.h @@ -41,7 +41,7 @@ namespace Internal { class GdbMi; class ThreadItem; -class ThreadsHandler : public Utils::LeveledTreeModel +class ThreadsHandler : public Utils::LeveledTreeModel, ThreadItem> { Q_OBJECT