Utils: Introduce a UniformTreeModel::itemForIndex function

In uniform trees the type of the items is fixed and known,
no need for user code to cast around.

Change-Id: Id20e507036e180c24997b236230f0f71b285202c
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
hjk
2016-06-09 15:34:48 +02:00
parent e4ff33e622
commit 57042da683
2 changed files with 6 additions and 2 deletions

View File

@@ -1015,7 +1015,7 @@ bool WatchModel::setData(const QModelIndex &idx, const QVariant &value, int role
if (!idx.isValid())
return false; // Triggered by ModelTester.
WatchItem *item = static_cast<WatchItem *>(itemForIndex(idx));
WatchItem *item = itemForIndex(idx);
QTC_ASSERT(item, return false);
switch (role) {
@@ -1622,7 +1622,7 @@ WatchModelBase *WatchHandler::model() const
const WatchItem *WatchHandler::watchItem(const QModelIndex &idx) const
{
return static_cast<WatchItem *>(m_model->itemForIndex(idx));
return m_model->itemForIndex(idx);
}
void WatchHandler::fetchMore(const QString &iname) const