Tasks: Remove other uses of Id::uniqueIdentifier()

Ids can be compared and tested for default-constructedness without.

Change-Id: I410c8a3922faa32fa27a090ea8fba7562a9a0231
Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
This commit is contained in:
hjk
2015-06-23 13:15:17 +02:00
parent b646c37f0e
commit 1c119185d0
2 changed files with 5 additions and 5 deletions

View File

@@ -85,7 +85,7 @@ bool TaskModel::hasFile(const QModelIndex &index) const
void TaskModel::addCategory(Core::Id categoryId, const QString &categoryName)
{
QTC_ASSERT(categoryId.uniqueIdentifier(), return);
QTC_ASSERT(categoryId.isValid(), return);
CategoryData data;
data.displayName = categoryName;
m_categories.insert(categoryId, data);
@@ -93,12 +93,12 @@ void TaskModel::addCategory(Core::Id categoryId, const QString &categoryName)
QList<Task> TaskModel::tasks(Core::Id categoryId) const
{
if (categoryId.uniqueIdentifier() == 0)
if (!categoryId.isValid())
return m_tasks;
QList<Task> taskList;
foreach (const Task &t, m_tasks) {
if (t.category.uniqueIdentifier() == categoryId.uniqueIdentifier())
if (t.category == categoryId)
taskList.append(t);
}
return taskList;
@@ -170,7 +170,7 @@ void TaskModel::clearTasks(Core::Id categoryId)
{
typedef QHash<Core::Id,CategoryData>::ConstIterator IdCategoryConstIt;
if (categoryId.uniqueIdentifier() == 0) {
if (!categoryId.isValid()) {
if (m_tasks.count() == 0)
return;
beginRemoveRows(QModelIndex(), 0, m_tasks.count() -1);

View File

@@ -384,7 +384,7 @@ void TaskWindow::clearTasks(Core::Id categoryId)
void TaskWindow::setCategoryVisibility(Core::Id categoryId, bool visible)
{
if (categoryId.uniqueIdentifier() == 0)
if (!categoryId.isValid())
return;
QList<Core::Id> categories = d->m_filter->filteredCategories();