void PeerListContent::prependRow(std::unique_ptr<PeerListRow> row) {
	Expects(row != nullptr);

	if (_rowsById.find(row->id()) == _rowsById.cend()) {
		addRowEntry(row.get());
		_rows.insert(_rows.begin(), std::move(row));
		refreshIndices();
	}
}
void QEditAssessment::updateTable(QList<Question> qL)
{
    for (int i=0; i<qL.length() ; i++)
    {
        add(qL.value(i));
    }

    refreshIndices();
    update();
}
void PeerListContent::prependRowFromSearchResult(not_null<PeerListRow*> row) {
	if (!row->isSearchResult()) {
		return;
	}
	Assert(_rowsById.find(row->id()) != _rowsById.cend());
	auto index = row->absoluteIndex();
	Assert(index >= 0 && index < _searchRows.size());
	Assert(_searchRows[index].get() == row);

	row->setIsSearchResult(false);
	_rows.insert(_rows.begin(), std::move(_searchRows[index]));
	refreshIndices();
	removeRowAtIndex(_searchRows, index);

	if (addingToSearchIndex()) {
		addToSearchIndex(row);
	}
}
void QEditAssessment::del()
{
    int row = questionTable->currentRow();
    //qDebug() << "row: " << row;

    // Remind the user when no assessment is selected
    if (row < 0)
    {
        QMessageBox msgBox;
        msgBox.setText("Please select an question first!");
        msgBox.setWindowTitle("Warning");
        msgBox.exec();
    }

    questionTable->removeRow(row);

    // Refresh the indices
    refreshIndices();
}