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));
}
QModelIndex VirtualSystemModel::index(int row, int column, const QModelIndex &parentIdx /* = QModelIndex() */) const
{
    if (!hasIndex(row, column, parentIdx))
        return QModelIndex();

    ModelItem *parentItem;

    if (!parentIdx.isValid())
        parentItem = m_pRootItem;
    else
        parentItem = static_cast<ModelItem*>(parentIdx.internalPointer());

    ModelItem *childItem = parentItem->child(row);
    if (childItem)
        return createIndex(row, column, childItem);
    else
        return QModelIndex();
}