bool TableView::setSelectedRows(QList<int> rows)
{
	QItemSelectionModel * selection = selectionModel();
	selection->clear();

	TableModel * currentModel = static_cast<TableModel *>(model());

	QItemSelection totalSelection;
	for(int i = 0; i < rows.size(); i++)
	{
		if(!currentModel->isValidRow(rows[i]))
		{
			continue;
		}

		QModelIndex index = model()->index(rows[i], 0);
		QItemSelection currentSelection(index, index);
		totalSelection.merge(currentSelection, QItemSelectionModel::SelectCurrent);
	}
	selection->select(totalSelection, QItemSelectionModel::ClearAndSelect);
	setSelectionModel(selection);

	return true;
}