Use isEmpty() vs "count() == 0"

Change-Id: I9b3103fbc4e881693039c1a5e81f0d2b97803978
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
This commit is contained in:
Montel Laurent
2017-02-21 12:33:35 +01:00
committed by Laurent Montel
parent 65e22d5a0a
commit f3c8a2db1e
5 changed files with 7 additions and 7 deletions

View File

@@ -604,7 +604,7 @@ void Parser::setFileList(const QStringList &fileList)
void Parser::removeFiles(const QStringList &fileList) void Parser::removeFiles(const QStringList &fileList)
{ {
if (fileList.count() == 0) if (fileList.isEmpty())
return; return;
QWriteLocker lockerPrj(&d->prjLocker); QWriteLocker lockerPrj(&d->prjLocker);

View File

@@ -119,7 +119,7 @@ int Utils::iconTypeSortOrder(int icon)
static QHash<int, int> sortOrder; static QHash<int, int> sortOrder;
// initialization // initialization
if (sortOrder.count() == 0) { if (sortOrder.isEmpty()) {
for (unsigned i = 0 ; for (unsigned i = 0 ;
i < sizeof(Constants::IconSortOrder) / sizeof(Constants::IconSortOrder[0]) ; ++i) i < sizeof(Constants::IconSortOrder) / sizeof(Constants::IconSortOrder[0]) ; ++i)
sortOrder.insert(Constants::IconSortOrder[i], sortOrder.count()); sortOrder.insert(Constants::IconSortOrder[i], sortOrder.count());

View File

@@ -136,7 +136,7 @@ void CMakeTargetNode::setTargetInformation(const QList<Utils::FileName> &artifac
const QString &type) const QString &type)
{ {
m_tooltip = QCoreApplication::translate("CMakeTargetNode", "Target type: ") + type + "<br>"; m_tooltip = QCoreApplication::translate("CMakeTargetNode", "Target type: ") + type + "<br>";
if (artifacts.count() == 0) { if (artifacts.isEmpty()) {
m_tooltip += QCoreApplication::translate("CMakeTargetNode", "No build artifacts"); m_tooltip += QCoreApplication::translate("CMakeTargetNode", "No build artifacts");
} else { } else {
const QStringList tmp = Utils::transform(artifacts, &Utils::FileName::toUserOutput); const QStringList tmp = Utils::transform(artifacts, &Utils::FileName::toUserOutput);

View File

@@ -143,7 +143,7 @@ void RemoteDialog::addRemote()
void RemoteDialog::removeRemote() void RemoteDialog::removeRemote()
{ {
const QModelIndexList indexList = m_ui->remoteView->selectionModel()->selectedIndexes(); const QModelIndexList indexList = m_ui->remoteView->selectionModel()->selectedIndexes();
if (indexList.count() == 0) if (indexList.isEmpty())
return; return;
int row = indexList.at(0).row(); int row = indexList.at(0).row();
@@ -159,7 +159,7 @@ void RemoteDialog::removeRemote()
void RemoteDialog::pushToRemote() void RemoteDialog::pushToRemote()
{ {
const QModelIndexList indexList = m_ui->remoteView->selectionModel()->selectedIndexes(); const QModelIndexList indexList = m_ui->remoteView->selectionModel()->selectedIndexes();
if (indexList.count() == 0) if (indexList.isEmpty())
return; return;
const int row = indexList.at(0).row(); const int row = indexList.at(0).row();
@@ -170,7 +170,7 @@ void RemoteDialog::pushToRemote()
void RemoteDialog::fetchFromRemote() void RemoteDialog::fetchFromRemote()
{ {
const QModelIndexList indexList = m_ui->remoteView->selectionModel()->selectedIndexes(); const QModelIndexList indexList = m_ui->remoteView->selectionModel()->selectedIndexes();
if (indexList.count() == 0) if (indexList.isEmpty())
return; return;
int row = indexList.at(0).row(); int row = indexList.at(0).row();

View File

@@ -164,7 +164,7 @@ void TaskModel::clearTasks(Core::Id categoryId)
typedef QHash<Core::Id,CategoryData>::ConstIterator IdCategoryConstIt; typedef QHash<Core::Id,CategoryData>::ConstIterator IdCategoryConstIt;
if (!categoryId.isValid()) { if (!categoryId.isValid()) {
if (m_tasks.count() == 0) if (m_tasks.isEmpty())
return; return;
beginRemoveRows(QModelIndex(), 0, m_tasks.count() -1); beginRemoveRows(QModelIndex(), 0, m_tasks.count() -1);
m_tasks.clear(); m_tasks.clear();