bool VirtualSystemSortProxyModel::lessThan(const QModelIndex &leftIdx, const QModelIndex &rightIdx) const
{
    if (!leftIdx.isValid() ||
        !rightIdx.isValid())
        return false;

    ModelItem *pLeftItem = static_cast<ModelItem*>(leftIdx.internalPointer());
    ModelItem *pRightItem = static_cast<ModelItem*>(rightIdx.internalPointer());

    /* We sort hardware types only */
    if (!(pLeftItem->type() == HardwareType &&
          pRightItem->type() == HardwareType))
        return false;

    HardwareItem *pHwLeft = static_cast<HardwareItem*>(pLeftItem);
    HardwareItem *pHwRight = static_cast<HardwareItem*>(pRightItem);

    for (unsigned int i = 0; i < RT_ELEMENTS(m_sortList); ++i)
        if (pHwLeft->m_type == m_sortList[i])
        {
            for (unsigned int a = 0; a <= i; ++a)
                if (pHwRight->m_type == m_sortList[a])
                    return true;
            return false;
        }

    return true;
}
bool VirtualSystemSortProxyModel::filterAcceptsRow(int srcRow, const QModelIndex & srcParenIdx) const
{
    /* By default enable all, we will explicitly filter out below */
    if (srcParenIdx.isValid())
    {
        QModelIndex i = srcParenIdx.child(srcRow, 0);
        if (i.isValid())
        {
            ModelItem *item = static_cast<ModelItem*>(i.internalPointer());
            /* We filter hardware types only */
            if (item->type() == HardwareType)
            {
                HardwareItem *hwItem = static_cast<HardwareItem*>(item);
                /* The license type shouldn't be displayed */
                if (m_filterList.contains(hwItem->m_type))
                    return false;
            }
        }
    }
    return true;
}