forked from qt-creator/qt-creator
Use isEmpty() vs "count() == 0"
Change-Id: I9b3103fbc4e881693039c1a5e81f0d2b97803978 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
This commit is contained in:
committed by
Laurent Montel
parent
65e22d5a0a
commit
f3c8a2db1e
@@ -604,7 +604,7 @@ void Parser::setFileList(const QStringList &fileList)
|
||||
|
||||
void Parser::removeFiles(const QStringList &fileList)
|
||||
{
|
||||
if (fileList.count() == 0)
|
||||
if (fileList.isEmpty())
|
||||
return;
|
||||
|
||||
QWriteLocker lockerPrj(&d->prjLocker);
|
||||
|
||||
@@ -119,7 +119,7 @@ int Utils::iconTypeSortOrder(int icon)
|
||||
static QHash<int, int> sortOrder;
|
||||
|
||||
// initialization
|
||||
if (sortOrder.count() == 0) {
|
||||
if (sortOrder.isEmpty()) {
|
||||
for (unsigned i = 0 ;
|
||||
i < sizeof(Constants::IconSortOrder) / sizeof(Constants::IconSortOrder[0]) ; ++i)
|
||||
sortOrder.insert(Constants::IconSortOrder[i], sortOrder.count());
|
||||
|
||||
@@ -136,7 +136,7 @@ void CMakeTargetNode::setTargetInformation(const QList<Utils::FileName> &artifac
|
||||
const QString &type)
|
||||
{
|
||||
m_tooltip = QCoreApplication::translate("CMakeTargetNode", "Target type: ") + type + "<br>";
|
||||
if (artifacts.count() == 0) {
|
||||
if (artifacts.isEmpty()) {
|
||||
m_tooltip += QCoreApplication::translate("CMakeTargetNode", "No build artifacts");
|
||||
} else {
|
||||
const QStringList tmp = Utils::transform(artifacts, &Utils::FileName::toUserOutput);
|
||||
|
||||
@@ -143,7 +143,7 @@ void RemoteDialog::addRemote()
|
||||
void RemoteDialog::removeRemote()
|
||||
{
|
||||
const QModelIndexList indexList = m_ui->remoteView->selectionModel()->selectedIndexes();
|
||||
if (indexList.count() == 0)
|
||||
if (indexList.isEmpty())
|
||||
return;
|
||||
|
||||
int row = indexList.at(0).row();
|
||||
@@ -159,7 +159,7 @@ void RemoteDialog::removeRemote()
|
||||
void RemoteDialog::pushToRemote()
|
||||
{
|
||||
const QModelIndexList indexList = m_ui->remoteView->selectionModel()->selectedIndexes();
|
||||
if (indexList.count() == 0)
|
||||
if (indexList.isEmpty())
|
||||
return;
|
||||
|
||||
const int row = indexList.at(0).row();
|
||||
@@ -170,7 +170,7 @@ void RemoteDialog::pushToRemote()
|
||||
void RemoteDialog::fetchFromRemote()
|
||||
{
|
||||
const QModelIndexList indexList = m_ui->remoteView->selectionModel()->selectedIndexes();
|
||||
if (indexList.count() == 0)
|
||||
if (indexList.isEmpty())
|
||||
return;
|
||||
|
||||
int row = indexList.at(0).row();
|
||||
|
||||
@@ -164,7 +164,7 @@ void TaskModel::clearTasks(Core::Id categoryId)
|
||||
typedef QHash<Core::Id,CategoryData>::ConstIterator IdCategoryConstIt;
|
||||
|
||||
if (!categoryId.isValid()) {
|
||||
if (m_tasks.count() == 0)
|
||||
if (m_tasks.isEmpty())
|
||||
return;
|
||||
beginRemoveRows(QModelIndex(), 0, m_tasks.count() -1);
|
||||
m_tasks.clear();
|
||||
|
||||
Reference in New Issue
Block a user