2

連続していない複数の行を QAbstractListModel から効率的に削除する方法はありますか? 非効率的な例:

// Single row removal
void remove (int idx) {
    beginRemoveRows (noParent (), idx, idx);
    // internal remove
    endRemoveRows ();
}

// Remove each row by calling beginRemoveRows multiple times
void removeMultiple (const QList<QObject*> &items) {
    foreach (auto item, items)
    {
        int idx = findIndexInternal(item);
        beginRemoveRows (noParent (), idx, idx);
        // internal remove
        endRemoveRows ();
    }
}

よろしく、

4

1 に答える 1