Debugger: Use a typed root item in ThreadModel

... and remove casts where possible.

Change-Id: I10305efbe336de7aa5efdb73a52c5f89cd2d089e
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
hjk
2016-06-27 13:46:46 +02:00
parent 06b2df0e27
commit c487217771
2 changed files with 5 additions and 5 deletions

View File

@@ -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<const ThreadItem *>(item1)->threadPart(column);
const QVariant v2 = static_cast<const ThreadItem *>(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<ThreadItem *>(rootItem()->childAt(index))->threadData.id;
return rootItem()->childAt(index)->threadData.id;
}
void ThreadsHandler::setCurrentThread(ThreadId id)

View File

@@ -41,7 +41,7 @@ namespace Internal {
class GdbMi;
class ThreadItem;
class ThreadsHandler : public Utils::LeveledTreeModel<Utils::TreeItem, ThreadItem>
class ThreadsHandler : public Utils::LeveledTreeModel<Utils::TypedTreeItem<ThreadItem>, ThreadItem>
{
Q_OBJECT