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) void TaskModel::addCategory(Core::Id categoryId, const QString &categoryName)
{ {
QTC_ASSERT(categoryId.uniqueIdentifier(), return); QTC_ASSERT(categoryId.isValid(), return);
CategoryData data; CategoryData data;
data.displayName = categoryName; data.displayName = categoryName;
m_categories.insert(categoryId, data); 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 QList<Task> TaskModel::tasks(Core::Id categoryId) const
{ {
if (categoryId.uniqueIdentifier() == 0) if (!categoryId.isValid())
return m_tasks; return m_tasks;
QList<Task> taskList; QList<Task> taskList;
foreach (const Task &t, m_tasks) { foreach (const Task &t, m_tasks) {
if (t.category.uniqueIdentifier() == categoryId.uniqueIdentifier()) if (t.category == categoryId)
taskList.append(t); taskList.append(t);
} }
return taskList; return taskList;
@@ -170,7 +170,7 @@ void TaskModel::clearTasks(Core::Id categoryId)
{ {
typedef QHash<Core::Id,CategoryData>::ConstIterator IdCategoryConstIt; typedef QHash<Core::Id,CategoryData>::ConstIterator IdCategoryConstIt;
if (categoryId.uniqueIdentifier() == 0) { if (!categoryId.isValid()) {
if (m_tasks.count() == 0) if (m_tasks.count() == 0)
return; return;
beginRemoveRows(QModelIndex(), 0, m_tasks.count() -1); 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) void TaskWindow::setCategoryVisibility(Core::Id categoryId, bool visible)
{ {
if (categoryId.uniqueIdentifier() == 0) if (!categoryId.isValid())
return; return;
QList<Core::Id> categories = d->m_filter->filteredCategories(); QList<Core::Id> categories = d->m_filter->filteredCategories();