forked from qt-creator/qt-creator
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user