void VirtualSystemModel::restoreDefaults(const QModelIndex &parentIdx /* = QModelIndex() */) { ModelItem *parentItem; if (!parentIdx.isValid()) parentItem = m_pRootItem; else parentItem = static_cast<ModelItem*>(parentIdx.internalPointer()); for (int i = 0; i < parentItem->childCount(); ++i) { parentItem->child(i)->restoreDefaults(); restoreDefaults(index(i, 0, parentIdx)); } emit dataChanged(index(0, 0, parentIdx), index(parentItem->childCount()-1, 0, parentIdx)); }
int VirtualSystemModel::rowCount(const QModelIndex &parentIdx /* = QModelIndex() */) const { ModelItem *parentItem; if (parentIdx.column() > 0) return 0; if (!parentIdx.isValid()) parentItem = m_pRootItem; else parentItem = static_cast<ModelItem*>(parentIdx.internalPointer()); return parentItem->childCount(); }