summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/libs/cplusplus/LookupContext.cpp2
-rw-r--r--src/libs/cplusplus/TypePrettyPrinter.cpp2
-rw-r--r--src/libs/modelinglib/qmt/infrastructure/qcompressedfile.cpp2
-rw-r--r--src/libs/modelinglib/qmt/stereotype/iconshape.cpp2
-rw-r--r--src/libs/qmldebug/qpacketprotocol.cpp2
-rw-r--r--src/libs/tracing/timelinenotesrenderpass.cpp2
-rw-r--r--src/libs/utils/consoleprocess.cpp2
-rw-r--r--src/libs/utils/differ.cpp31
-rw-r--r--src/libs/utils/qtcprocess.cpp4
-rw-r--r--src/plugins/android/androidbuildapkwidget.cpp2
-rw-r--r--src/plugins/android/androidcreatekeystorecertificate.cpp4
-rw-r--r--src/plugins/android/androidmanager.cpp2
-rw-r--r--src/plugins/autotest/boost/boosttestparser.cpp2
-rw-r--r--src/plugins/autotest/gtest/gtestconfiguration.cpp2
-rw-r--r--src/plugins/autotest/gtest/gtestparser.cpp2
-rw-r--r--src/plugins/autotest/itestparser.cpp2
-rw-r--r--src/plugins/autotest/qtest/qttestconfiguration.cpp2
-rw-r--r--src/plugins/autotest/qtest/qttestvisitors.cpp2
-rw-r--r--src/plugins/autotest/quick/quicktestconfiguration.cpp2
-rw-r--r--src/plugins/bineditor/bineditorwidget.cpp4
-rw-r--r--src/plugins/bineditor/bineditorwidget.h4
-rw-r--r--src/plugins/coreplugin/dialogs/shortcutsettings.cpp2
-rw-r--r--src/plugins/coreplugin/editormanager/editorview.cpp4
-rw-r--r--src/plugins/coreplugin/locator/directoryfilter.cpp4
-rw-r--r--src/plugins/coreplugin/sidebar.cpp2
-rw-r--r--src/plugins/coreplugin/sidebarwidget.cpp2
-rw-r--r--src/plugins/cppeditor/cppeditorwidget.cpp2
-rw-r--r--src/plugins/cppeditor/cpphighlighter.cpp2
-rw-r--r--src/plugins/cpptools/builtineditordocumentprocessor.cpp2
-rw-r--r--src/plugins/cpptools/headerpathfilter.cpp2
-rw-r--r--src/plugins/debugger/breakpoint.cpp2
-rw-r--r--src/plugins/debugger/lldb/lldbengine.cpp2
-rw-r--r--src/plugins/debugger/qml/qmlengine.cpp4
-rw-r--r--src/plugins/debugger/qml/qmlinspectoragent.cpp4
-rw-r--r--src/plugins/diffeditor/diffutils.cpp10
-rw-r--r--src/plugins/diffeditor/unifieddiffeditorwidget.cpp4
-rw-r--r--src/plugins/fakevim/fakevimhandler.cpp2
-rw-r--r--src/plugins/git/branchmodel.cpp2
-rw-r--r--src/plugins/git/remotedialog.cpp2
-rw-r--r--src/plugins/glsleditor/glslhighlighter.cpp2
-rw-r--r--src/plugins/ios/iosbuildconfiguration.cpp2
-rw-r--r--src/plugins/macros/macro.cpp2
-rw-r--r--src/plugins/macros/macromanager.cpp2
-rw-r--r--src/plugins/modeleditor/uicontroller.cpp4
-rw-r--r--src/plugins/projectexplorer/abi.cpp2
-rw-r--r--src/plugins/projectexplorer/projectnodes.cpp2
-rw-r--r--src/plugins/projectexplorer/projecttree.cpp2
-rw-r--r--src/plugins/qbsprojectmanager/qbsprofilemanager.cpp2
-rw-r--r--src/plugins/qmldesigner/components/componentcore/modelnodeoperations.cpp2
-rw-r--r--src/plugins/qmljseditor/qmljscompletionassist.cpp2
-rw-r--r--src/plugins/qmljseditor/qmloutlinemodel.cpp2
-rw-r--r--src/plugins/scxmleditor/common/mainwidget.cpp4
-rw-r--r--src/plugins/scxmleditor/common/shapestoolbox.cpp2
-rw-r--r--src/plugins/scxmleditor/plugin_interface/connectableitem.cpp6
-rw-r--r--src/plugins/scxmleditor/plugin_interface/graphicsscene.cpp4
-rw-r--r--src/plugins/scxmleditor/plugin_interface/parallelitem.cpp2
-rw-r--r--src/plugins/scxmleditor/plugin_interface/sceneutils.cpp2
-rw-r--r--src/plugins/scxmleditor/plugin_interface/scxmldocument.cpp4
-rw-r--r--src/plugins/scxmleditor/plugin_interface/scxmltag.cpp2
-rw-r--r--src/plugins/scxmleditor/plugin_interface/scxmltagutils.cpp2
-rw-r--r--src/plugins/scxmleditor/plugin_interface/stateitem.cpp4
-rw-r--r--src/plugins/scxmleditor/plugin_interface/transitionitem.cpp10
-rw-r--r--src/plugins/texteditor/texteditor.cpp2
-rw-r--r--src/plugins/todo/optionsdialog.cpp2
-rw-r--r--src/plugins/todo/todoprojectsettingswidget.cpp4
-rw-r--r--src/shared/help/bookmarkmanager.cpp2
-rw-r--r--src/shared/proparser/ioutils.cpp4
-rw-r--r--src/shared/proparser/qmakeparser.cpp2
-rw-r--r--src/tools/sdktool/addkeysoperation.cpp2
-rw-r--r--src/tools/sdktool/rmkeysoperation.cpp2
70 files changed, 110 insertions, 111 deletions
diff --git a/src/libs/cplusplus/LookupContext.cpp b/src/libs/cplusplus/LookupContext.cpp
index 451e3d3a78..8c5a883e7d 100644
--- a/src/libs/cplusplus/LookupContext.cpp
+++ b/src/libs/cplusplus/LookupContext.cpp
@@ -1100,7 +1100,7 @@ ClassOrNamespace *ClassOrNamespace::nestedType(const Name *name,
// for "using" we should use the real one ClassOrNamespace(it should be the first
// one item from usings list)
// we indicate that it is a 'using' by checking number of symbols(it should be 0)
- if (reference->symbols().count() == 0 && reference->usings().count() != 0)
+ if (reference->symbols().isEmpty() && !reference->usings().isEmpty())
reference = reference->_usings[0];
// if it is a TemplateNameId it could be a specialization(full or partial) or
diff --git a/src/libs/cplusplus/TypePrettyPrinter.cpp b/src/libs/cplusplus/TypePrettyPrinter.cpp
index 2ad59c55c8..193a00803c 100644
--- a/src/libs/cplusplus/TypePrettyPrinter.cpp
+++ b/src/libs/cplusplus/TypePrettyPrinter.cpp
@@ -335,7 +335,7 @@ void TypePrettyPrinter::prependSpaceAfterIndirection(bool hasName)
const bool case2 = ! hasCvSpecifier && spaceBeforeNameNeeded;
// case 3: In "char *argv[]", put a space between '*' and "argv" when requested
const bool case3 = ! hasCvSpecifier && ! shouldBindToIdentifier
- && ! _isIndirectionToArrayOrFunction && _text.size() && _text.at(0).isLetter();
+ && ! _isIndirectionToArrayOrFunction && !_text.isEmpty() && _text.at(0).isLetter();
if (case1 || case2 || case3)
_text.prepend(QLatin1Char(' '));
}
diff --git a/src/libs/modelinglib/qmt/infrastructure/qcompressedfile.cpp b/src/libs/modelinglib/qmt/infrastructure/qcompressedfile.cpp
index 7853ad2341..98caf69541 100644
--- a/src/libs/modelinglib/qmt/infrastructure/qcompressedfile.cpp
+++ b/src/libs/modelinglib/qmt/infrastructure/qcompressedfile.cpp
@@ -105,7 +105,7 @@ qint64 QCompressedDevice::writeData(const char *data, qint64 len)
qint64 QCompressedDevice::flush()
{
- if (openMode() == QIODevice::WriteOnly && m_buffer.size() > 0) {
+ if (openMode() == QIODevice::WriteOnly && !m_buffer.isEmpty()) {
QMT_ASSERT(m_targetDevice->isOpen(), return 0);
QMT_ASSERT(m_targetDevice->openMode() == QIODevice::WriteOnly, return 0);
QByteArray compressedBuffer = qCompress(m_buffer);
diff --git a/src/libs/modelinglib/qmt/stereotype/iconshape.cpp b/src/libs/modelinglib/qmt/stereotype/iconshape.cpp
index f138684b64..172bb36984 100644
--- a/src/libs/modelinglib/qmt/stereotype/iconshape.cpp
+++ b/src/libs/modelinglib/qmt/stereotype/iconshape.cpp
@@ -76,7 +76,7 @@ public:
PathShape *IconShape::IconShapePrivate::activePath()
{
PathShape *pathShape = nullptr;
- if (m_shapes.count() > 0)
+ if (!m_shapes.isEmpty())
pathShape = dynamic_cast<PathShape *>(m_shapes.last());
if (!pathShape) {
pathShape = new PathShape();
diff --git a/src/libs/qmldebug/qpacketprotocol.cpp b/src/libs/qmldebug/qpacketprotocol.cpp
index 3bbabc1cf7..76822d34d4 100644
--- a/src/libs/qmldebug/qpacketprotocol.cpp
+++ b/src/libs/qmldebug/qpacketprotocol.cpp
@@ -254,7 +254,7 @@ qint64 QPacketProtocol::packetsAvailable() const
*/
QByteArray QPacketProtocol::read()
{
- if (0 == d->packets.count())
+ if (d->packets.isEmpty())
return QByteArray();
return d->packets.takeFirst();
diff --git a/src/libs/tracing/timelinenotesrenderpass.cpp b/src/libs/tracing/timelinenotesrenderpass.cpp
index bfc3273eed..de41d5a1b1 100644
--- a/src/libs/tracing/timelinenotesrenderpass.cpp
+++ b/src/libs/tracing/timelinenotesrenderpass.cpp
@@ -141,7 +141,7 @@ TimelineRenderPass::State *TimelineNotesRenderPass::update(const TimelineAbstrac
QSGGeometryNode *collapsedNode = static_cast<QSGGeometryNode *>(state->collapsedOverlay());
- if (collapsed.count() > 0) {
+ if (!collapsed.isEmpty()) {
collapsedNode->setGeometry(NotesGeometry::createGeometry(collapsed, model, parentState,
true));
collapsedNode->setFlag(QSGGeometryNode::OwnsGeometry, true);
diff --git a/src/libs/utils/consoleprocess.cpp b/src/libs/utils/consoleprocess.cpp
index 1e51550def..e30d020d95 100644
--- a/src/libs/utils/consoleprocess.cpp
+++ b/src/libs/utils/consoleprocess.cpp
@@ -271,7 +271,7 @@ static QString quoteWinCommand(const QString &program)
static QString quoteWinArgument(const QString &arg)
{
- if (!arg.length())
+ if (arg.isEmpty())
return QString::fromLatin1("\"\"");
QString ret(arg);
diff --git a/src/libs/utils/differ.cpp b/src/libs/utils/differ.cpp
index 74ec99c78c..8fb4cf4ad4 100644
--- a/src/libs/utils/differ.cpp
+++ b/src/libs/utils/differ.cpp
@@ -206,7 +206,7 @@ static int cleanupSemanticsScore(const QString &text1, const QString &text2)
const QRegularExpression blankLineStart("^\\r?\\n\\r?\\n");
const QRegularExpression sentenceEnd("\\. $");
- if (!text1.count() || !text2.count()) // Edges
+ if (text1.isEmpty() || text2.isEmpty()) // Edges
return 6;
const QChar char1 = text1[text1.count() - 1];
@@ -551,13 +551,12 @@ static QString encodeExpandedWhitespace(const QString &leftEquality,
return QString(); // equalities broken
}
- if ((leftWhitespaces.count() && !rightWhitespaces.count())
- || (!leftWhitespaces.count() && rightWhitespaces.count())) {
+ if (leftWhitespaces.isEmpty() ^ rightWhitespaces.isEmpty()) {
// there must be at least 1 corresponding whitespace, equalities broken
return QString();
}
- if (leftWhitespaces.count() && rightWhitespaces.count()) {
+ if (!leftWhitespaces.isEmpty() && !rightWhitespaces.isEmpty()) {
const int replacementPosition = output.count();
const int replacementSize = qMax(leftWhitespaces.count(), rightWhitespaces.count());
const QString replacement(replacementSize, ' ');
@@ -723,10 +722,10 @@ static void appendWithEqualitiesSquashed(const QList<Diff> &leftInput,
QList<Diff> *leftOutput,
QList<Diff> *rightOutput)
{
- if (leftInput.count()
- && rightInput.count()
- && leftOutput->count()
- && rightOutput->count()
+ if (!leftInput.isEmpty()
+ && !rightInput.isEmpty()
+ && !leftOutput->isEmpty()
+ && !rightOutput->isEmpty()
&& leftInput.first().command == Diff::Equal
&& rightInput.first().command == Diff::Equal
&& leftOutput->last().command == Diff::Equal
@@ -1245,7 +1244,7 @@ QList<Diff> Differ::diffNonCharMode(const QString &text1, const QString &text2)
} else if (diffItem.command == Diff::Insert) {
lastInsert += diffItem.text;
} else { // Diff::Equal
- if (lastDelete.count() || lastInsert.count()) {
+ if (!(lastDelete.isEmpty() && lastInsert.isEmpty())) {
// Rediff here on char basis
newDiffList += preprocess1AndDiff(lastDelete, lastInsert);
@@ -1334,7 +1333,7 @@ QList<Diff> Differ::merge(const QList<Diff> &diffList)
} else if (diff.command == Diff::Insert) {
lastInsert += diff.text;
} else { // Diff::Equal
- if (lastDelete.count() || lastInsert.count()) {
+ if (!(lastDelete.isEmpty() && lastInsert.isEmpty())) {
// common prefix
const int prefixCount = commonPrefix(lastDelete, lastInsert);
@@ -1343,7 +1342,7 @@ QList<Diff> Differ::merge(const QList<Diff> &diffList)
lastDelete = lastDelete.mid(prefixCount);
lastInsert = lastInsert.mid(prefixCount);
- if (newDiffList.count()
+ if (!newDiffList.isEmpty()
&& newDiffList.last().command == Diff::Equal) {
newDiffList.last().text += prefix;
} else {
@@ -1362,20 +1361,20 @@ QList<Diff> Differ::merge(const QList<Diff> &diffList)
}
// append delete / insert / equal
- if (lastDelete.count())
+ if (!lastDelete.isEmpty())
newDiffList.append(Diff(Diff::Delete, lastDelete));
- if (lastInsert.count())
+ if (!lastInsert.isEmpty())
newDiffList.append(Diff(Diff::Insert, lastInsert));
- if (diff.text.count())
+ if (!diff.text.isEmpty())
newDiffList.append(diff);
lastDelete.clear();
lastInsert.clear();
} else { // join with last equal diff
- if (newDiffList.count()
+ if (!newDiffList.isEmpty()
&& newDiffList.last().command == Diff::Equal) {
newDiffList.last().text += diff.text;
} else {
- if (diff.text.count())
+ if (!diff.text.isEmpty())
newDiffList.append(diff);
}
}
diff --git a/src/libs/utils/qtcprocess.cpp b/src/libs/utils/qtcprocess.cpp
index 6d608a441b..3b92f64997 100644
--- a/src/libs/utils/qtcprocess.cpp
+++ b/src/libs/utils/qtcprocess.cpp
@@ -538,7 +538,7 @@ QStringList QtcProcess::splitArgs(const QString &args, OsType osType,
QString QtcProcess::quoteArgUnix(const QString &arg)
{
- if (!arg.length())
+ if (arg.isEmpty())
return QString::fromLatin1("''");
QString ret(arg);
@@ -574,7 +574,7 @@ static bool hasSpecialCharsWin(const QString &arg)
static QString quoteArgWin(const QString &arg)
{
- if (!arg.length())
+ if (arg.isEmpty())
return QString::fromLatin1("\"\"");
QString ret(arg);
diff --git a/src/plugins/android/androidbuildapkwidget.cpp b/src/plugins/android/androidbuildapkwidget.cpp
index a9dd54f8b6..3217f6b7b2 100644
--- a/src/plugins/android/androidbuildapkwidget.cpp
+++ b/src/plugins/android/androidbuildapkwidget.cpp
@@ -191,7 +191,7 @@ QWidget *AndroidBuildApkWidget::createSignPackageGroup()
auto updateAlias = [this](int idx) {
QString alias = m_certificatesAliasComboBox->itemText(idx);
- if (alias.length())
+ if (!alias.isEmpty())
m_step->setCertificateAlias(alias);
};
diff --git a/src/plugins/android/androidcreatekeystorecertificate.cpp b/src/plugins/android/androidcreatekeystorecertificate.cpp
index 3ff0a02de8..82becd6d98 100644
--- a/src/plugins/android/androidcreatekeystorecertificate.cpp
+++ b/src/plugins/android/androidcreatekeystorecertificate.cpp
@@ -165,10 +165,10 @@ void AndroidCreateKeystoreCertificate::on_buttonBox_accepted()
.arg(ui->localityNameLineEdit->text().replace(QLatin1Char(','), QLatin1String("\\,")))
.arg(ui->countryLineEdit->text().replace(QLatin1Char(','), QLatin1String("\\,"))));
- if (ui->organizationUnitLineEdit->text().length())
+ if (!ui->organizationUnitLineEdit->text().isEmpty())
distinguishedNames += QLatin1String(", OU=") + ui->organizationUnitLineEdit->text().replace(QLatin1Char(','), QLatin1String("\\,"));
- if (ui->stateNameLineEdit->text().length())
+ if (!ui->stateNameLineEdit->text().isEmpty())
distinguishedNames += QLatin1String(", S=") + ui->stateNameLineEdit->text().replace(QLatin1Char(','), QLatin1String("\\,"));
const CommandLine command(AndroidConfigurations::currentConfig().keytoolPath(),
diff --git a/src/plugins/android/androidmanager.cpp b/src/plugins/android/androidmanager.cpp
index 1ada7a75ca..4ecf2a0480 100644
--- a/src/plugins/android/androidmanager.cpp
+++ b/src/plugins/android/androidmanager.cpp
@@ -427,7 +427,7 @@ QString AndroidManager::apkDevicePreferredAbi(Target *target)
auto libsPath = dirPath(target).pathAppended("libs");
QStringList apkAbis;
for (const auto &abi : QDir{libsPath.toString()}.entryList(QDir::Dirs | QDir::NoDotAndDotDot))
- if (QDir{libsPath.pathAppended(abi).toString()}.entryList(QStringList("*.so"), QDir::Files | QDir::NoDotAndDotDot).length())
+ if (!QDir{libsPath.pathAppended(abi).toString()}.entryList(QStringList("*.so"), QDir::Files | QDir::NoDotAndDotDot).isEmpty())
apkAbis << abi;
return preferredAbi(apkAbis, target);
}
diff --git a/src/plugins/autotest/boost/boosttestparser.cpp b/src/plugins/autotest/boost/boosttestparser.cpp
index 6f953e515a..09c216c1b6 100644
--- a/src/plugins/autotest/boost/boosttestparser.cpp
+++ b/src/plugins/autotest/boost/boosttestparser.cpp
@@ -144,7 +144,7 @@ static bool handleBoostTest(QFutureInterface<TestParseResultPtr> futureInterface
firstSuite);
BoostTestParseResult *currentSuite = topLevelSuite;
suitesStates.removeFirst();
- while (suitesStates.size()) {
+ while (!suitesStates.isEmpty()) {
firstSuite = suitesStates.first();
suites = firstSuite.fullName.split('/');
BoostTestParseResult *suiteResult = createParseResult(suites.last(), filePath,
diff --git a/src/plugins/autotest/gtest/gtestconfiguration.cpp b/src/plugins/autotest/gtest/gtestconfiguration.cpp
index 0608c3db72..e662f3702f 100644
--- a/src/plugins/autotest/gtest/gtestconfiguration.cpp
+++ b/src/plugins/autotest/gtest/gtestconfiguration.cpp
@@ -83,7 +83,7 @@ QStringList GTestConfiguration::argumentsForTestRunner(QStringList *omitted) con
}
const QStringList &testSets = testCases();
- if (testSets.size())
+ if (!testSets.isEmpty())
arguments << "--gtest_filter=" + testSets.join(':');
TestFrameworkManager *manager = TestFrameworkManager::instance();
diff --git a/src/plugins/autotest/gtest/gtestparser.cpp b/src/plugins/autotest/gtest/gtestparser.cpp
index f57f774ec0..e5eecf44ff 100644
--- a/src/plugins/autotest/gtest/gtestparser.cpp
+++ b/src/plugins/autotest/gtest/gtestparser.cpp
@@ -103,7 +103,7 @@ static bool handleGTest(QFutureInterface<TestParseResultPtr> futureInterface,
QMap<GTestCaseSpec, GTestCodeLocationList> result = visitor.gtestFunctions();
QString proFile;
const QList<CppTools::ProjectPart::Ptr> &ppList = modelManager->projectPart(filePath);
- if (ppList.size())
+ if (!ppList.isEmpty())
proFile = ppList.first()->projectFile;
else
return false; // happens if shutting down while parsing
diff --git a/src/plugins/autotest/itestparser.cpp b/src/plugins/autotest/itestparser.cpp
index f0310041d7..316245cdee 100644
--- a/src/plugins/autotest/itestparser.cpp
+++ b/src/plugins/autotest/itestparser.cpp
@@ -51,7 +51,7 @@ bool CppParser::selectedForBuilding(const QString &fileName)
QList<CppTools::ProjectPart::Ptr> projParts =
CppTools::CppModelManager::instance()->projectPart(fileName);
- return projParts.size() && projParts.at(0)->selectedForBuilding;
+ return !projParts.isEmpty() && projParts.at(0)->selectedForBuilding;
}
QByteArray CppParser::getFileContent(const QString &filePath)
diff --git a/src/plugins/autotest/qtest/qttestconfiguration.cpp b/src/plugins/autotest/qtest/qttestconfiguration.cpp
index 86fce62f80..1212f3b852 100644
--- a/src/plugins/autotest/qtest/qttestconfiguration.cpp
+++ b/src/plugins/autotest/qtest/qttestconfiguration.cpp
@@ -65,7 +65,7 @@ QStringList QtTestConfiguration::argumentsForTestRunner(QStringList *omitted) co
return arguments;
if (qtSettings->useXMLOutput)
arguments << "-xml";
- if (testCases().count())
+ if (!testCases().isEmpty())
arguments << testCases();
const QString &metricsOption = QtTestSettings::metricsTypeToOption(qtSettings->metrics);
diff --git a/src/plugins/autotest/qtest/qttestvisitors.cpp b/src/plugins/autotest/qtest/qttestvisitors.cpp
index 48177921bf..7b8374985b 100644
--- a/src/plugins/autotest/qtest/qttestvisitors.cpp
+++ b/src/plugins/autotest/qtest/qttestvisitors.cpp
@@ -128,7 +128,7 @@ bool TestAstVisitor::visit(CallAST *ast)
QList<LookupItem> toeItems
= toe(argumentExpressionAST, m_currentDoc, m_currentScope);
- if (toeItems.size()) {
+ if (!toeItems.isEmpty()) {
if (const auto pointerType = toeItems.first().type()->asPointerType())
m_className = o.prettyType(pointerType->elementType());
}
diff --git a/src/plugins/autotest/quick/quicktestconfiguration.cpp b/src/plugins/autotest/quick/quicktestconfiguration.cpp
index 024b2223c2..57d075fe7d 100644
--- a/src/plugins/autotest/quick/quicktestconfiguration.cpp
+++ b/src/plugins/autotest/quick/quicktestconfiguration.cpp
@@ -72,7 +72,7 @@ QStringList QuickTestConfiguration::argumentsForTestRunner(QStringList *omitted)
return arguments;
if (qtSettings->useXMLOutput)
arguments << "-xml";
- if (testCases().count())
+ if (!testCases().isEmpty())
arguments << testCases();
const QString &metricsOption = QtTestSettings::metricsTypeToOption(qtSettings->metrics);
diff --git a/src/plugins/bineditor/bineditorwidget.cpp b/src/plugins/bineditor/bineditorwidget.cpp
index 9cf0a06c4d..ab8f6d0ba4 100644
--- a/src/plugins/bineditor/bineditorwidget.cpp
+++ b/src/plugins/bineditor/bineditorwidget.cpp
@@ -1556,7 +1556,7 @@ void BinEditorWidget::undo()
setCursorPosition(cmd.position);
if (emitModificationChanged)
emit modificationChanged(m_undoStack.size() != m_unmodifiedState);
- if (!m_undoStack.size())
+ if (m_undoStack.isEmpty())
emit undoAvailable(false);
if (m_redoStack.size() == 1)
emit redoAvailable(true);
@@ -1577,7 +1577,7 @@ void BinEditorWidget::redo()
emit modificationChanged(m_undoStack.size() != m_unmodifiedState);
if (m_undoStack.size() == 1)
emit undoAvailable(true);
- if (!m_redoStack.size())
+ if (m_redoStack.isEmpty())
emit redoAvailable(false);
}
diff --git a/src/plugins/bineditor/bineditorwidget.h b/src/plugins/bineditor/bineditorwidget.h
index 50c369caf0..0bd217ff66 100644
--- a/src/plugins/bineditor/bineditorwidget.h
+++ b/src/plugins/bineditor/bineditorwidget.h
@@ -113,8 +113,8 @@ public:
bool event(QEvent*) override;
- bool isUndoAvailable() const { return m_undoStack.size(); }
- bool isRedoAvailable() const { return m_redoStack.size(); }
+ bool isUndoAvailable() const { return !m_undoStack.isEmpty(); }
+ bool isRedoAvailable() const { return !m_redoStack.isEmpty(); }
QString addressString(quint64 address);
diff --git a/src/plugins/coreplugin/dialogs/shortcutsettings.cpp b/src/plugins/coreplugin/dialogs/shortcutsettings.cpp
index 86ee6146da..a9a6a6ff96 100644
--- a/src/plugins/coreplugin/dialogs/shortcutsettings.cpp
+++ b/src/plugins/coreplugin/dialogs/shortcutsettings.cpp
@@ -56,7 +56,7 @@ static int translateModifiers(Qt::KeyboardModifiers state,
int result = 0;
// The shift modifier only counts when it is not used to type a symbol
// that is only reachable using the shift key anyway
- if ((state & Qt::ShiftModifier) && (text.size() == 0
+ if ((state & Qt::ShiftModifier) && (text.isEmpty()
|| !text.at(0).isPrint()
|| text.at(0).isLetterOrNumber()
|| text.at(0).isSpace()))
diff --git a/src/plugins/coreplugin/editormanager/editorview.cpp b/src/plugins/coreplugin/editormanager/editorview.cpp
index 01e838f83c..9d2fe45ba7 100644
--- a/src/plugins/coreplugin/editormanager/editorview.cpp
+++ b/src/plugins/coreplugin/editormanager/editorview.cpp
@@ -348,12 +348,12 @@ void EditorView::removeEditor(IEditor *editor)
m_toolBar->removeToolbarForEditor(editor);
if (wasCurrent)
- setCurrentEditor(m_editors.count() ? m_editors.last() : nullptr);
+ setCurrentEditor(!m_editors.isEmpty() ? m_editors.last() : nullptr);
}
IEditor *EditorView::currentEditor() const
{
- if (m_editors.count() > 0)
+ if (!m_editors.isEmpty())
return m_widgetEditorMap.value(m_container->currentWidget());
return nullptr;
}
diff --git a/src/plugins/coreplugin/locator/directoryfilter.cpp b/src/plugins/coreplugin/locator/directoryfilter.cpp
index b8761b78cf..c6212571f6 100644
--- a/src/plugins/coreplugin/locator/directoryfilter.cpp
+++ b/src/plugins/coreplugin/locator/directoryfilter.cpp
@@ -207,7 +207,7 @@ void DirectoryFilter::handleRemoveDirectory()
void DirectoryFilter::updateOptionButtons()
{
- bool haveSelectedItem = (m_ui->directoryList->selectedItems().count() > 0);
+ bool haveSelectedItem = !m_ui->directoryList->selectedItems().isEmpty();
m_ui->editButton->setEnabled(haveSelectedItem);
m_ui->removeButton->setEnabled(haveSelectedItem);
}
@@ -222,7 +222,7 @@ void DirectoryFilter::refresh(QFutureInterface<void> &future)
QStringList directories;
{
QMutexLocker locker(&m_lock);
- if (m_directories.count() < 1) {
+ if (m_directories.isEmpty()) {
m_files.clear();
QTimer::singleShot(0, this, &DirectoryFilter::updateFileIterator);
future.setProgressRange(0, 1);
diff --git a/src/plugins/coreplugin/sidebar.cpp b/src/plugins/coreplugin/sidebar.cpp
index f811e1df33..4accc99cd9 100644
--- a/src/plugins/coreplugin/sidebar.cpp
+++ b/src/plugins/coreplugin/sidebar.cpp
@@ -289,7 +289,7 @@ void SideBar::readSettings(QSettings *settings, const QString &name)
const QString viewsKey = prefix + QLatin1String("Views");
if (settings->contains(viewsKey)) {
QStringList views = settings->value(viewsKey).toStringList();
- if (views.count()) {
+ if (!views.isEmpty()) {
foreach (const QString &id, views)
if (availableItemIds().contains(id))
insertSideBarWidget(d->m_widgets.count(), id);
diff --git a/src/plugins/coreplugin/sidebarwidget.cpp b/src/plugins/coreplugin/sidebarwidget.cpp
index 2cb1c6539e..0d13db6976 100644
--- a/src/plugins/coreplugin/sidebarwidget.cpp
+++ b/src/plugins/coreplugin/sidebarwidget.cpp
@@ -89,7 +89,7 @@ SideBarWidget::SideBarWidget(SideBar *sideBar, const QString &id)
QStringList titleList = m_sideBar->availableItemTitles();
Utils::sort(titleList);
QString t = id;
- if (titleList.count()) {
+ if (!titleList.isEmpty()) {
foreach (const QString &itemTitle, titleList)
m_comboBox->addItem(itemTitle, m_sideBar->idForTitle(itemTitle));
diff --git a/src/plugins/cppeditor/cppeditorwidget.cpp b/src/plugins/cppeditor/cppeditorwidget.cpp
index 678d529965..2ce2c1092b 100644
--- a/src/plugins/cppeditor/cppeditorwidget.cpp
+++ b/src/plugins/cppeditor/cppeditorwidget.cpp
@@ -413,7 +413,7 @@ static void addSearchResults(CppTools::Usages usages, SearchResult &search, cons
const QString lineContent = getDocumentLine(document, usage.line);
- if (lineContent.size()) {
+ if (!lineContent.isEmpty()) {
Search::TextRange range{Search::TextPosition(usage.line, usage.column - 1),
Search::TextPosition(usage.line, usage.column + text.length() - 1)};
search.addResult(usage.path, lineContent, range);
diff --git a/src/plugins/cppeditor/cpphighlighter.cpp b/src/plugins/cppeditor/cpphighlighter.cpp
index 5abfe71a26..d862ea3c2c 100644
--- a/src/plugins/cppeditor/cpphighlighter.cpp
+++ b/src/plugins/cppeditor/cpphighlighter.cpp
@@ -74,7 +74,7 @@ void CppHighlighter::highlightBlock(const QString &text)
if (tokens.isEmpty()) {
setCurrentBlockState((braceDepth << 8) | lexerState);
TextDocumentLayout::clearParentheses(currentBlock());
- if (text.length()) {// the empty line can still contain whitespace
+ if (!text.isEmpty()) {// the empty line can still contain whitespace
if (initialLexerState == T_COMMENT)
setFormatWithSpaces(text, 0, text.length(), formatForCategory(C_COMMENT));
else if (initialLexerState == T_DOXY_COMMENT)
diff --git a/src/plugins/cpptools/builtineditordocumentprocessor.cpp b/src/plugins/cpptools/builtineditordocumentprocessor.cpp
index c9f69f644c..5c78dbbdf8 100644
--- a/src/plugins/cpptools/builtineditordocumentprocessor.cpp
+++ b/src/plugins/cpptools/builtineditordocumentprocessor.cpp
@@ -131,7 +131,7 @@ CppTools::CheckSymbols *createHighlighter(const CPlusPlus::Document::Ptr &doc,
// Filter out C++ keywords
const Tokens tokens = tokenize(name);
- if (tokens.length() && (tokens.at(0).isKeyword() || tokens.at(0).isObjCAtKeyword()))
+ if (!tokens.isEmpty() && (tokens.at(0).isKeyword() || tokens.at(0).isObjCAtKeyword()))
continue;
int line, column;
diff --git a/src/plugins/cpptools/headerpathfilter.cpp b/src/plugins/cpptools/headerpathfilter.cpp
index c7265e4044..5268511b52 100644
--- a/src/plugins/cpptools/headerpathfilter.cpp
+++ b/src/plugins/cpptools/headerpathfilter.cpp
@@ -165,7 +165,7 @@ void HeaderPathFilter::tweakHeaderPaths()
void HeaderPathFilter::addPreIncludesPath()
{
- if (projectDirectory.size()) {
+ if (!projectDirectory.isEmpty()) {
const Utils::FilePath rootProjectDirectory = Utils::FilePath::fromString(projectDirectory)
.pathAppended(".pre_includes");
diff --git a/src/plugins/debugger/breakpoint.cpp b/src/plugins/debugger/breakpoint.cpp
index 673052bcd7..088f948e9e 100644
--- a/src/plugins/debugger/breakpoint.cpp
+++ b/src/plugins/debugger/breakpoint.cpp
@@ -134,7 +134,7 @@ bool BreakpointParameters::conditionsMatch(const QString &other) const
void BreakpointParameters::updateLocation(const QString &location)
{
- if (location.size()) {
+ if (!location.isEmpty()) {
int pos = location.indexOf(':');
lineNumber = location.midRef(pos + 1).toInt();
QString file = location.left(pos);
diff --git a/src/plugins/debugger/lldb/lldbengine.cpp b/src/plugins/debugger/lldb/lldbengine.cpp
index e2a80bad35..c8d9ff30de 100644
--- a/src/plugins/debugger/lldb/lldbengine.cpp
+++ b/src/plugins/debugger/lldb/lldbengine.cpp
@@ -376,7 +376,7 @@ void LldbEngine::handleResponse(const QString &response)
const QString name = item.name();
if (name == "result") {
QString msg = item["status"].data();
- if (msg.size())
+ if (!msg.isEmpty())
msg[0] = msg.at(0).toUpper();
showStatusMessage(msg);
diff --git a/src/plugins/debugger/qml/qmlengine.cpp b/src/plugins/debugger/qml/qmlengine.cpp
index 8bde882a44..fa2992ed17 100644
--- a/src/plugins/debugger/qml/qmlengine.cpp
+++ b/src/plugins/debugger/qml/qmlengine.cpp
@@ -1364,7 +1364,7 @@ void QmlEnginePrivate::scripts(int types, const QList<int> ids, bool includeSour
DebuggerCommand cmd(SCRIPTS);
cmd.arg(TYPES, types);
- if (ids.count())
+ if (!ids.isEmpty())
cmd.arg(IDS, ids);
if (includeSource)
@@ -1727,7 +1727,7 @@ void QmlEnginePrivate::messageReceived(const QByteArray &data)
const QVariantList actualLocations =
breakpointData.value("actual_locations").toList();
const int line = breakpointData.value("line").toInt() + 1;
- if (actualLocations.count()) {
+ if (!actualLocations.isEmpty()) {
//The breakpoint requested line should be same as
//actual line
if (bp && bp->state() != BreakpointInserted) {
diff --git a/src/plugins/debugger/qml/qmlinspectoragent.cpp b/src/plugins/debugger/qml/qmlinspectoragent.cpp
index 35bc8492e5..580a4c3bd4 100644
--- a/src/plugins/debugger/qml/qmlinspectoragent.cpp
+++ b/src/plugins/debugger/qml/qmlinspectoragent.cpp
@@ -254,7 +254,7 @@ void QmlInspectorAgent::onResult(quint32 queryId, const QVariant &value,
} else if (queryId == m_engineQueryId) {
m_engineQueryId = 0;
QList<EngineReference> engines = qvariant_cast<QList<EngineReference> >(value);
- QTC_ASSERT(engines.count(), return);
+ QTC_ASSERT(!engines.isEmpty(), return);
m_engines = engines;
queryEngineContext();
} else {
@@ -637,7 +637,7 @@ void QmlInspectorAgent::addWatchData(const ObjectReference &obj,
}
// properties
- if (append && obj.properties().count()) {
+ if (append && !obj.properties().isEmpty()) {
QString iname = objIname + ".[properties]";
auto propertiesWatch = new WatchItem;
propertiesWatch->iname = iname;
diff --git a/src/plugins/diffeditor/diffutils.cpp b/src/plugins/diffeditor/diffutils.cpp
index 6c024ebd01..0378cb2f22 100644
--- a/src/plugins/diffeditor/diffutils.cpp
+++ b/src/plugins/diffeditor/diffutils.cpp
@@ -61,10 +61,10 @@ static QList<TextLineData> assemblyRows(const QList<TextLineData> &lines,
static bool lastLinesEqual(const QList<TextLineData> &leftLines,
const QList<TextLineData> &rightLines)
{
- const bool leftLineEqual = leftLines.count()
+ const bool leftLineEqual = !leftLines.isEmpty()
? leftLines.last().text.isEmpty()
: true;
- const bool rightLineEqual = rightLines.count()
+ const bool rightLineEqual = !rightLines.isEmpty()
? rightLines.last().text.isEmpty()
: true;
return leftLineEqual && rightLineEqual;
@@ -166,7 +166,7 @@ ChunkData DiffUtils::calculateOriginalData(const QList<Diff> &leftDiffList,
int line = 0;
- if (i < leftDiffList.count() || j < rightDiffList.count() || (leftLines.count() && rightLines.count())) {
+ if (i < leftDiffList.count() || j < rightDiffList.count() || (!leftLines.isEmpty() && !rightLines.isEmpty())) {
while (line < qMax(newLeftLines.count(), newRightLines.count())) {
handleLine(newLeftLines, line, &leftLines, &leftLineNumber);
handleLine(newRightLines, line, &rightLines, &rightLineNumber);
@@ -409,7 +409,7 @@ QString DiffUtils::makePatch(const ChunkData &chunkData,
// ensure we process buffers to the end.
// rowData will be equal
if (rowData.equal && i != rowToBeSplit) {
- if (leftBuffer.count()) {
+ if (!leftBuffer.isEmpty()) {
for (int j = 0; j < leftBuffer.count(); j++) {
const QString line = makePatchLine('-',
leftBuffer.at(j).text,
@@ -424,7 +424,7 @@ QString DiffUtils::makePatch(const ChunkData &chunkData,
}
leftBuffer.clear();
}
- if (rightBuffer.count()) {
+ if (!rightBuffer.isEmpty()) {
for (int j = 0; j < rightBuffer.count(); j++) {
const QString line = makePatchLine('+',
rightBuffer.at(j).text,
diff --git a/src/plugins/diffeditor/unifieddiffeditorwidget.cpp b/src/plugins/diffeditor/unifieddiffeditorwidget.cpp
index f5ef0ad8ee..8675c73892 100644
--- a/src/plugins/diffeditor/unifieddiffeditorwidget.cpp
+++ b/src/plugins/diffeditor/unifieddiffeditorwidget.cpp
@@ -373,7 +373,7 @@ QString UnifiedDiffEditorWidget::showChunk(const ChunkData &chunkData,
// ensure we process buffers to the end.
// rowData will be equal
if (rowData.equal && i != lastEqualRow) {
- if (leftBuffer.count()) {
+ if (!leftBuffer.isEmpty()) {
for (int j = 0; j < leftBuffer.count(); j++) {
const TextLineData &lineData = leftBuffer.at(j);
const QString line = DiffUtils::makePatchLine(
@@ -414,7 +414,7 @@ QString UnifiedDiffEditorWidget::showChunk(const ChunkData &chunkData,
leftBuffer.clear();
leftRowsBuffer.clear();
}
- if (rightBuffer.count()) {
+ if (!rightBuffer.isEmpty()) {
for (int j = 0; j < rightBuffer.count(); j++) {
const TextLineData &lineData = rightBuffer.at(j);
const QString line = DiffUtils::makePatchLine(
diff --git a/src/plugins/fakevim/fakevimhandler.cpp b/src/plugins/fakevim/fakevimhandler.cpp
index 6a202c614c..743e511248 100644
--- a/src/plugins/fakevim/fakevimhandler.cpp
+++ b/src/plugins/fakevim/fakevimhandler.cpp
@@ -6666,7 +6666,7 @@ static int someInt(const QString &str)
{
if (str.toInt())
return str.toInt();
- if (str.size())
+ if (!str.isEmpty())
return str.at(0).unicode();
return 0;
}
diff --git a/src/plugins/git/branchmodel.cpp b/src/plugins/git/branchmodel.cpp
index f225f0e604..24e64294be 100644
--- a/src/plugins/git/branchmodel.cpp
+++ b/src/plugins/git/branchmodel.cpp
@@ -179,7 +179,7 @@ public:
QStringList childrenNames() const
{
- if (children.count() > 0) {
+ if (!children.isEmpty()) {
QStringList names;
for (BranchNode *n : children) {
names.append(n->childrenNames());
diff --git a/src/plugins/git/remotedialog.cpp b/src/plugins/git/remotedialog.cpp
index e02f62ad5f..50b7a994f2 100644
--- a/src/plugins/git/remotedialog.cpp
+++ b/src/plugins/git/remotedialog.cpp
@@ -223,7 +223,7 @@ void RemoteDialog::updateButtonState()
{
const QModelIndexList indexList = m_ui->remoteView->selectionModel()->selectedIndexes();
- const bool haveSelection = (indexList.count() > 0);
+ const bool haveSelection = !indexList.isEmpty();
m_ui->addButton->setEnabled(true);
m_ui->fetchButton->setEnabled(haveSelection);
m_ui->pushButton->setEnabled(haveSelection);
diff --git a/src/plugins/glsleditor/glslhighlighter.cpp b/src/plugins/glsleditor/glslhighlighter.cpp
index c21e2ab1dc..0ec949e05c 100644
--- a/src/plugins/glsleditor/glslhighlighter.cpp
+++ b/src/plugins/glsleditor/glslhighlighter.cpp
@@ -86,7 +86,7 @@ void GlslHighlighter::highlightBlock(const QString &text)
if (tokens.isEmpty()) {
setCurrentBlockState(previousState);
TextDocumentLayout::clearParentheses(currentBlock());
- if (text.length()) // the empty line can still contain whitespace
+ if (!text.isEmpty()) // the empty line can still contain whitespace
setFormat(0, text.length(), formatForCategory(C_VISUAL_WHITESPACE));
TextDocumentLayout::setFoldingIndent(currentBlock(), foldingIndent);
return;
diff --git a/src/plugins/ios/iosbuildconfiguration.cpp b/src/plugins/ios/iosbuildconfiguration.cpp
index aabc82e7e6..37c19a5d51 100644
--- a/src/plugins/ios/iosbuildconfiguration.cpp
+++ b/src/plugins/ios/iosbuildconfiguration.cpp
@@ -274,7 +274,7 @@ void IosBuildSettingsWidget::populateProvisioningProfiles()
QSignalBlocker blocker(m_signEntityCombo);
m_signEntityCombo->clear();
const ProvisioningProfiles profiles = IosConfigurations::provisioningProfiles();
- if (profiles.count() > 0) {
+ if (!profiles.isEmpty()) {
for (auto profile : profiles) {
m_signEntityCombo->addItem(profile->displayName());
const int index = m_signEntityCombo->count() - 1;
diff --git a/src/plugins/macros/macro.cpp b/src/plugins/macros/macro.cpp
index 55e9383b8d..f5719eb076 100644
--- a/src/plugins/macros/macro.cpp
+++ b/src/plugins/macros/macro.cpp
@@ -98,7 +98,7 @@ Macro& Macro::operator=(const Macro &other)
bool Macro::load(QString fileName)
{
- if (d->events.count())
+ if (!d->events.isEmpty())
return true; // the macro is not empty
// Take the current filename if the parameter is null
diff --git a/src/plugins/macros/macromanager.cpp b/src/plugins/macros/macromanager.cpp
index 7767e1d161..08aa7b087f 100644
--- a/src/plugins/macros/macromanager.cpp
+++ b/src/plugins/macros/macromanager.cpp
@@ -381,7 +381,7 @@ void MacroManager::changeMacro(const QString &name, const QString &description)
void MacroManager::saveLastMacro()
{
- if (d->currentMacro->events().count())
+ if (!d->currentMacro->events().isEmpty())
d->showSaveDialog();
}
diff --git a/src/plugins/modeleditor/uicontroller.cpp b/src/plugins/modeleditor/uicontroller.cpp
index 8f5b7fd22a..706e208904 100644
--- a/src/plugins/modeleditor/uicontroller.cpp
+++ b/src/plugins/modeleditor/uicontroller.cpp
@@ -52,7 +52,7 @@ UiController::~UiController()
bool UiController::hasRightSplitterState() const
{
- return d->rightSplitterState.size() > 0;
+ return !d->rightSplitterState.isEmpty();
}
QByteArray UiController::rightSplitterState() const
@@ -62,7 +62,7 @@ QByteArray UiController::rightSplitterState() const
bool UiController::hasRightHorizSplitterState() const
{
- return d->rightHorizSplitterState.size() > 0;
+ return !d->rightHorizSplitterState.isEmpty();
}
QByteArray UiController::rightHorizSplitterState() const
diff --git a/src/plugins/projectexplorer/abi.cpp b/src/plugins/projectexplorer/abi.cpp
index a51d441ba4..afaeb126e1 100644
--- a/src/plugins/projectexplorer/abi.cpp
+++ b/src/plugins/projectexplorer/abi.cpp
@@ -790,7 +790,7 @@ Abi Abi::fromString(const QString &abiString)
{
Abi::Architecture architecture = UnknownArchitecture;
const QVector<QStringRef> abiParts = abiString.splitRef('-');
- if (abiParts.count() >= 1) {
+ if (!abiParts.isEmpty()) {
architecture = architectureFromString(abiParts.at(0));
if (abiParts.at(0) != toString(architecture))
return Abi();
diff --git a/src/plugins/projectexplorer/projectnodes.cpp b/src/plugins/projectexplorer/projectnodes.cpp
index f8e20c7e3e..d9dba7d710 100644
--- a/src/plugins/projectexplorer/projectnodes.cpp
+++ b/src/plugins/projectexplorer/projectnodes.cpp
@@ -80,7 +80,7 @@ static FolderNode *recursiveFindOrCreateFolderNode(FolderNode *folder,
}
}
QStringList parts = directoryWithoutPrefix.toString().split('/', QString::SkipEmptyParts);
- if (!Utils::HostOsInfo::isWindowsHost() && !isRelative && parts.count() > 0)
+ if (!Utils::HostOsInfo::isWindowsHost() && !isRelative && !parts.isEmpty())
parts[0].prepend('/');
ProjectExplorer::FolderNode *parent = folder;
diff --git a/src/plugins/projectexplorer/projecttree.cpp b/src/plugins/projectexplorer/projecttree.cpp
index b42da7ad66..1ff829a061 100644
--- a/src/plugins/projectexplorer/projecttree.cpp
+++ b/src/plugins/projectexplorer/projecttree.cpp
@@ -364,7 +364,7 @@ void ProjectTree::showContextMenu(ProjectTreeWidget *focus, const QPoint &global
contextMenu = Core::ActionManager::actionContainer(Constants::M_FILECONTEXT)->menu();
}
- if (contextMenu && contextMenu->actions().count() > 0) {
+ if (contextMenu && !contextMenu->actions().isEmpty()) {
s_instance->m_focusForContextMenu = focus;
contextMenu->popup(globalPos);
connect(contextMenu, &QMenu::aboutToHide,
diff --git a/src/plugins/qbsprojectmanager/qbsprofilemanager.cpp b/src/plugins/qbsprojectmanager/qbsprofilemanager.cpp
index 1d81e6c507..ad557de5cc 100644
--- a/src/plugins/qbsprojectmanager/qbsprofilemanager.cpp
+++ b/src/plugins/qbsprojectmanager/qbsprofilemanager.cpp
@@ -85,7 +85,7 @@ QString toJSLiteral(const QVariant &val)
QString res;
const auto list = val.toList();
for (const QVariant &child : list) {
- if (res.length()) res.append(", ");
+ if (!res.isEmpty() ) res.append(", ");
res.append(toJSLiteral(child));
}
res.prepend('[');
diff --git a/src/plugins/qmldesigner/components/componentcore/modelnodeoperations.cpp b/src/plugins/qmldesigner/components/componentcore/modelnodeoperations.cpp
index b35349872b..098ce88d7c 100644
--- a/src/plugins/qmldesigner/components/componentcore/modelnodeoperations.cpp
+++ b/src/plugins/qmldesigner/components/componentcore/modelnodeoperations.cpp
@@ -652,7 +652,7 @@ void addSignalHandlerOrGotoImplementation(const SelectionContext &selectionState
Core::ModeManager::activateMode(Core::Constants::MODE_EDIT);
- if (usages.count() > 0 && (addAlwaysNewSlot || usages.count() < 2) && (!isModelNodeRoot || addAlwaysNewSlot)) {
+ if (!usages.isEmpty() && (addAlwaysNewSlot || usages.count() < 2) && (!isModelNodeRoot || addAlwaysNewSlot)) {
Core::EditorManager::openEditorAt(usages.constFirst().path, usages.constFirst().line, usages.constFirst().col);
if (!signalNames.isEmpty()) {
diff --git a/src/plugins/qmljseditor/qmljscompletionassist.cpp b/src/plugins/qmljseditor/qmljscompletionassist.cpp
index a581a2a2f3..839e3fd19f 100644
--- a/src/plugins/qmljseditor/qmljscompletionassist.cpp
+++ b/src/plugins/qmljseditor/qmljscompletionassist.cpp
@@ -466,7 +466,7 @@ QString FunctionHintProposalModel::text(int index) const
prettyMethod += arg;
}
if (m_isVariadic) {
- if (m_namedArguments.size())
+ if (!m_namedArguments.isEmpty())
prettyMethod += QLatin1String(", ");
prettyMethod += QLatin1String("...");
}
diff --git a/src/plugins/qmljseditor/qmloutlinemodel.cpp b/src/plugins/qmljseditor/qmloutlinemodel.cpp
index 15c7c2fa0c..50162fb1fc 100644
--- a/src/plugins/qmljseditor/qmloutlinemodel.cpp
+++ b/src/plugins/qmljseditor/qmloutlinemodel.cpp
@@ -332,7 +332,7 @@ QStringList QmlOutlineModel::mimeTypes() const
QMimeData *QmlOutlineModel::mimeData(const QModelIndexList &indexes) const
{
- if (indexes.count() <= 0)
+ if (indexes.isEmpty())
return nullptr;
auto data = new Utils::DropMimeData;
data->setOverrideFileDropAction(Qt::CopyAction);
diff --git a/src/plugins/scxmleditor/common/mainwidget.cpp b/src/plugins/scxmleditor/common/mainwidget.cpp
index 298d021910..766161cfdf 100644
--- a/src/plugins/scxmleditor/common/mainwidget.cpp
+++ b/src/plugins/scxmleditor/common/mainwidget.cpp
@@ -535,7 +535,7 @@ void MainWidget::addStateView(BaseItem *item)
m_actionHandler->action(ActionPaste)->setEnabled(currentView && para);
});
- if (m_views.count() > 0)
+ if (!m_views.isEmpty())
m_views.last()->scene()->unselectAll();
if (item) {
@@ -582,7 +582,7 @@ void MainWidget::newDocument()
void MainWidget::clear()
{
// Clear and delete all stateviews
- while (m_views.count() > 0) {
+ while (!m_views.isEmpty()) {
m_views.last()->clear();
delete m_views.takeLast();
}
diff --git a/src/plugins/scxmleditor/common/shapestoolbox.cpp b/src/plugins/scxmleditor/common/shapestoolbox.cpp
index 632cdd7371..e62ad794a8 100644
--- a/src/plugins/scxmleditor/common/shapestoolbox.cpp
+++ b/src/plugins/scxmleditor/common/shapestoolbox.cpp
@@ -56,7 +56,7 @@ void ShapesToolbox::setUIFactory(ScxmlEditor::PluginInterface::ScxmlUiFactory *f
void ShapesToolbox::initView()
{
// Delete old widgets
- while (m_widgets.count() > 0)
+ while (!m_widgets.isEmpty())
delete m_widgets.takeLast();
// Create new widgets
diff --git a/src/plugins/scxmleditor/plugin_interface/connectableitem.cpp b/src/plugins/scxmleditor/plugin_interface/connectableitem.cpp
index 90076c9eed..fb971da145 100644
--- a/src/plugins/scxmleditor/plugin_interface/connectableitem.cpp
+++ b/src/plugins/scxmleditor/plugin_interface/connectableitem.cpp
@@ -740,7 +740,7 @@ void ConnectableItem::addOverlappingItem(ConnectableItem *item)
if (!m_overlappedItems.contains(item))
m_overlappedItems.append(item);
- setOverlapping(m_overlappedItems.count() > 0);
+ setOverlapping(!m_overlappedItems.isEmpty());
}
void ConnectableItem::removeOverlappingItem(ConnectableItem *item)
@@ -748,7 +748,7 @@ void ConnectableItem::removeOverlappingItem(ConnectableItem *item)
if (m_overlappedItems.contains(item))
m_overlappedItems.removeAll(item);
- setOverlapping(m_overlappedItems.count() > 0);
+ setOverlapping(!m_overlappedItems.isEmpty());
}
void ConnectableItem::checkOverlapping()
@@ -776,7 +776,7 @@ void ConnectableItem::checkOverlapping()
}
}
- setOverlapping(m_overlappedItems.count() > 0);
+ setOverlapping(!m_overlappedItems.isEmpty());
}
bool ConnectableItem::canStartTransition(ItemType type) const
diff --git a/src/plugins/scxmleditor/plugin_interface/graphicsscene.cpp b/src/plugins/scxmleditor/plugin_interface/graphicsscene.cpp
index 3773635f44..5513ed1ee7 100644
--- a/src/plugins/scxmleditor/plugin_interface/graphicsscene.cpp
+++ b/src/plugins/scxmleditor/plugin_interface/graphicsscene.cpp
@@ -201,7 +201,7 @@ void GraphicsScene::cut()
void GraphicsScene::removeSelectedItems()
{
QVector<ScxmlTag*> tags = SceneUtils::findRemovedTags(m_baseItems);
- if (tags.count() > 0) {
+ if (!tags.isEmpty()) {
m_document->undoStack()->beginMacro(tr("Remove items"));
// Then remove found tags
@@ -235,7 +235,7 @@ void GraphicsScene::copy()
if (tags.isEmpty() && m_document->currentTag())
tags << m_document->currentTag();
- if (tags.count() > 0) {
+ if (!tags.isEmpty()) {
auto mime = new QMimeData;
QByteArray result = m_document->content(tags);
mime->setText(QLatin1String(result));
diff --git a/src/plugins/scxmleditor/plugin_interface/parallelitem.cpp b/src/plugins/scxmleditor/plugin_interface/parallelitem.cpp
index b98ea4f703..d3ed8c127d 100644
--- a/src/plugins/scxmleditor/plugin_interface/parallelitem.cpp
+++ b/src/plugins/scxmleditor/plugin_interface/parallelitem.cpp
@@ -92,7 +92,7 @@ void ParallelItem::doLayout(int d)
// 3. Relocate children-states
// a) sort list
QVector<StateItem*> sortedList;
- while (children.count() > 0) {
+ while (!children.isEmpty()) {
qreal minTop = children.first()->boundingRect().top();
int minTopIndex = 0;
for (int i = 1; i < children.count(); ++i) {
diff --git a/src/plugins/scxmleditor/plugin_interface/sceneutils.cpp b/src/plugins/scxmleditor/plugin_interface/sceneutils.cpp
index 04456168d6..f27ba00a97 100644
--- a/src/plugins/scxmleditor/plugin_interface/sceneutils.cpp
+++ b/src/plugins/scxmleditor/plugin_interface/sceneutils.cpp
@@ -238,7 +238,7 @@ void layout(const QList<QGraphicsItem*> &items)
int startAngle = qrand() % 2 == 0 ? 180 : 90;
int startDistance = 40 + childItems.count() * 10;
- if (childItems.count() > 0) {
+ if (!childItems.isEmpty()) {
// Init position of the items
int angleDiff = 360 / (childItems.count() + 1);
for (int i = 0; i < childItems.count(); ++i) {
diff --git a/src/plugins/scxmleditor/plugin_interface/scxmldocument.cpp b/src/plugins/scxmleditor/plugin_interface/scxmldocument.cpp
index 033a6fbe1f..74f288e899 100644
--- a/src/plugins/scxmleditor/plugin_interface/scxmldocument.cpp
+++ b/src/plugins/scxmleditor/plugin_interface/scxmldocument.cpp
@@ -400,7 +400,7 @@ void ScxmlDocument::printSCXML()
QByteArray ScxmlDocument::content(const QVector<ScxmlTag*> &tags) const
{
QByteArray result;
- if (tags.count() > 0) {
+ if (!tags.isEmpty()) {
QBuffer buffer(&result);
buffer.open(QIODevice::WriteOnly);
@@ -666,7 +666,7 @@ ScxmlTag *ScxmlDocument::popRootTag()
void ScxmlDocument::deleteRootTags()
{
- while (m_rootTags.count() > 0)
+ while (!m_rootTags.isEmpty())
delete m_rootTags.takeLast();
}
diff --git a/src/plugins/scxmleditor/plugin_interface/scxmltag.cpp b/src/plugins/scxmleditor/plugin_interface/scxmltag.cpp
index b037fb9bb9..248eeff99a 100644
--- a/src/plugins/scxmleditor/plugin_interface/scxmltag.cpp
+++ b/src/plugins/scxmleditor/plugin_interface/scxmltag.cpp
@@ -269,7 +269,7 @@ void ScxmlTag::setContent(const QString &content)
bool ScxmlTag::hasData() const
{
- if (m_attributeNames.count() > 0 || !m_content.isEmpty())
+ if (!m_attributeNames.isEmpty() || !m_content.isEmpty())
return true;
foreach (ScxmlTag *tag, m_childTags) {
diff --git a/src/plugins/scxmleditor/plugin_interface/scxmltagutils.cpp b/src/plugins/scxmleditor/plugin_interface/scxmltagutils.cpp
index f4761c5351..24e5789f08 100644
--- a/src/plugins/scxmleditor/plugin_interface/scxmltagutils.cpp
+++ b/src/plugins/scxmleditor/plugin_interface/scxmltagutils.cpp
@@ -264,7 +264,7 @@ void initChildMenu(TagType tagType, QMenu *menu)
QVector<TagType> childTags = childTypes(tagType);
- if (childTags.count() > 0) {
+ if (!childTags.isEmpty()) {
for (int i = 0; i < childTags.count(); ++i) {
if (childTags[i] == OnEntry || childTags[i] == OnExit)
initChildMenu(childTags[i], menu->addMenu(QLatin1String(scxml_tags[childTags[i]].name)));
diff --git a/src/plugins/scxmleditor/plugin_interface/stateitem.cpp b/src/plugins/scxmleditor/plugin_interface/stateitem.cpp
index 01fd5a994b..acecc460b8 100644
--- a/src/plugins/scxmleditor/plugin_interface/stateitem.cpp
+++ b/src/plugins/scxmleditor/plugin_interface/stateitem.cpp
@@ -120,7 +120,7 @@ void StateItem::updateAttributes()
QString strNewId = tagValue("id", true);
if (!m_parallelState) {
QStringList NSIDs = strNewId.split(tag()->document()->nameSpaceDelimiter(), QString::SkipEmptyParts);
- if (NSIDs.count() > 0) {
+ if (!NSIDs.isEmpty()) {
NSIDs[NSIDs.count() - 1] = m_stateNameItem->toPlainText();
QString strOldId = NSIDs.join(tag()->document()->nameSpaceDelimiter());
ScxmlTag *parentTag = tag()->parentTag();
@@ -388,7 +388,7 @@ void StateItem::checkInitial(bool parent)
tag = this->tag();
}
- if (items.count() > 0 && tag && uiFactory()) {
+ if (!items.isEmpty() && tag && uiFactory()) {
auto utilsProvider = static_cast<UtilsProvider*>(uiFactory()->object("utilsProvider"));
if (utilsProvider)
utilsProvider->checkInitialState(items, tag);
diff --git a/src/plugins/scxmleditor/plugin_interface/transitionitem.cpp b/src/plugins/scxmleditor/plugin_interface/transitionitem.cpp
index fefa5c3e56..e388a43cc8 100644
--- a/src/plugins/scxmleditor/plugin_interface/transitionitem.cpp
+++ b/src/plugins/scxmleditor/plugin_interface/transitionitem.cpp
@@ -133,7 +133,7 @@ void TransitionItem::createGrabbers()
if (m_cornerGrabbers.count() != m_cornerPoints.count()) {
int selectedGrabberIndex = m_cornerGrabbers.indexOf(m_selectedCornerGrabber);
- if (m_cornerGrabbers.count() > 0) {
+ if (!m_cornerGrabbers.isEmpty()) {
qDeleteAll(m_cornerGrabbers);
m_cornerGrabbers.clear();
}
@@ -158,7 +158,7 @@ void TransitionItem::createGrabbers()
void TransitionItem::removeGrabbers()
{
- if (m_cornerGrabbers.count() > 0) {
+ if (!m_cornerGrabbers.isEmpty()) {
qDeleteAll(m_cornerGrabbers);
m_cornerGrabbers.clear();
}
@@ -267,7 +267,7 @@ void TransitionItem::mousePressEvent(QGraphicsSceneMouseEvent *event)
m_cornerPoints.append(p);
snapToAnyPoint(m_cornerPoints.count() - 1, p);
- if (m_cornerGrabbers.count() > 0) {
+ if (!m_cornerGrabbers.isEmpty()) {
auto corner = new CornerGrabberItem(this);
corner->setGrabberType(CornerGrabberItem::Circle);
corner->setPos(p);
@@ -615,7 +615,7 @@ void TransitionItem::connectToTopItem(const QPointF &pos, TransitionPoint tp, It
// First try to find parentItem
QList<QGraphicsItem*> items = scene()->items(p);
- if (items.count() > 0) {
+ if (!items.isEmpty()) {
for (int i = 0; i < items.count(); ++i) {
ItemType type = ItemType(items[i]->type());
if ((targetType == UnknownType && type >= FinalStateType) || type >= StateType) {
@@ -797,7 +797,7 @@ QPointF TransitionItem::findIntersectionPoint(ConnectableItem *item, const QLine
// Find intersection point between line and target item
QPolygonF itemPolygon = item->polygonShape();
- if (itemPolygon.count() > 0) {
+ if (!itemPolygon.isEmpty()) {
QPointF intersectPoint;
QPointF p1 = itemPolygon.at(0) + item->scenePos();
QPointF p2;
diff --git a/src/plugins/texteditor/texteditor.cpp b/src/plugins/texteditor/texteditor.cpp
index 2e4f9c4b15..547423e2a5 100644
--- a/src/plugins/texteditor/texteditor.cpp
+++ b/src/plugins/texteditor/texteditor.cpp
@@ -4603,7 +4603,7 @@ void TextEditorWidgetPrivate::paintCursor(const PaintEventData &data, QPainter &
void TextEditorWidgetPrivate::clearSelectionBackground(PaintEventData &data) const
{
- if (m_inBlockSelectionMode && data.context.selections.count()
+ if (m_inBlockSelectionMode && !data.context.selections.isEmpty()
&& data.context.selections.last().cursor == data.textCursor) {
data.blockSelectionIndex = data.context.selections.size() - 1;
data.context.selections[data.blockSelectionIndex].format.clearBackground();
diff --git a/src/plugins/todo/optionsdialog.cpp b/src/plugins/todo/optionsdialog.cpp
index d4b1860c8d..e06e90c9fe 100644
--- a/src/plugins/todo/optionsdialog.cpp
+++ b/src/plugins/todo/optionsdialog.cpp
@@ -144,7 +144,7 @@ void OptionsDialog::resetKeywordsButtonClicked()
void OptionsDialog::setKeywordsButtonsEnabled()
{
- bool isSomethingSelected = ui->keywordsList->selectedItems().count() != 0;
+ const bool isSomethingSelected = !ui->keywordsList->selectedItems().isEmpty();
ui->removeKeywordButton->setEnabled(isSomethingSelected);
ui->editKeywordButton->setEnabled(isSomethingSelected);
}
diff --git a/src/plugins/todo/todoprojectsettingswidget.cpp b/src/plugins/todo/todoprojectsettingswidget.cpp
index 59c544e0e5..5f2c427e8d 100644
--- a/src/plugins/todo/todoprojectsettingswidget.cpp
+++ b/src/plugins/todo/todoprojectsettingswidget.cpp
@@ -103,7 +103,7 @@ void TodoProjectSettingsWidget::prepareItem(QListWidgetItem *item) const
void TodoProjectSettingsWidget::addExcludedPatternButtonClicked()
{
- if (ui->excludedPatternsList->findItems(excludePlaceholder(), Qt::MatchFixedString).count())
+ if (!ui->excludedPatternsList->findItems(excludePlaceholder(), Qt::MatchFixedString).isEmpty())
return;
ui->excludedPatternsList->editItem(addToExcludedPatternsList(excludePlaceholder()));
}
@@ -116,7 +116,7 @@ void TodoProjectSettingsWidget::removeExcludedPatternButtonClicked()
void TodoProjectSettingsWidget::setExcludedPatternsButtonsEnabled()
{
- bool isSomethingSelected = ui->excludedPatternsList->selectedItems().count() != 0;
+ const bool isSomethingSelected = !ui->excludedPatternsList->selectedItems().isEmpty();
ui->removeExcludedPatternButton->setEnabled(isSomethingSelected);
}
diff --git a/src/shared/help/bookmarkmanager.cpp b/src/shared/help/bookmarkmanager.cpp
index 7f652b41cf..c067334d4c 100644
--- a/src/shared/help/bookmarkmanager.cpp
+++ b/src/shared/help/bookmarkmanager.cpp
@@ -702,7 +702,7 @@ void BookmarkManager::itemChanged(QStandardItem *item)
if (item->text() != oldText) {
if (item->data(Qt::UserRole + 10).toString() != QLatin1String("Folder")) {
QList<QStandardItem*>itemList = listModel->findItems(oldText);
- if (itemList.count() > 0)
+ if (!itemList.isEmpty())
itemList.at(0)->setText(item->text());
}
}
diff --git a/src/shared/proparser/ioutils.cpp b/src/shared/proparser/ioutils.cpp
index 302811cac4..74bdedc62c 100644
--- a/src/shared/proparser/ioutils.cpp
+++ b/src/shared/proparser/ioutils.cpp
@@ -139,7 +139,7 @@ QString IoUtils::shellQuoteUnix(const QString &arg)
0x00, 0x00, 0x00, 0x38, 0x01, 0x00, 0x00, 0x78
}; // 0-32 \'"$`<>|;&(){}*?#!~[]
- if (!arg.length())
+ if (arg.isEmpty())
return QString::fromLatin1("''");
QString ret(arg);
@@ -167,7 +167,7 @@ QString IoUtils::shellQuoteWin(const QString &arg)
0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x10
}; // &()<>^|
- if (!arg.length())
+ if (arg.isEmpty())
return QString::fromLatin1("\"\"");
QString ret(arg);
diff --git a/src/shared/proparser/qmakeparser.cpp b/src/shared/proparser/qmakeparser.cpp
index 8d6ef622fd..1d72f72f16 100644
--- a/src/shared/proparser/qmakeparser.cpp
+++ b/src/shared/proparser/qmakeparser.cpp
@@ -885,7 +885,7 @@ void QMakeParser::read(ProFile *pro, const QStringRef &in, int line, SubGrammar
flushScopes(tokPtr);
if (m_blockstack.size() > 1 || m_blockstack.top().braceLevel)
parseError(fL1S("Missing closing brace(s)."));
- while (m_blockstack.size())
+ while (!m_blockstack.isEmpty())
leaveScope(tokPtr);
tokBuff.resize(tokPtr - (ushort *)tokBuff.constData()); // Reserved capacity stays
*pro->itemsRef() = tokBuff;
diff --git a/src/tools/sdktool/addkeysoperation.cpp b/src/tools/sdktool/addkeysoperation.cpp
index b7abd5aaca..95535a7e97 100644
--- a/src/tools/sdktool/addkeysoperation.cpp
+++ b/src/tools/sdktool/addkeysoperation.cpp
@@ -250,7 +250,7 @@ QVariantMap AddKeysOperation::addKeys(const QVariantMap &map, const KeyValuePair
foldBack = current;
}
- Q_ASSERT(stack.count() == 0);
+ Q_ASSERT(stack.isEmpty());
Q_ASSERT(foldBack != map);
result = foldBack;
diff --git a/src/tools/sdktool/rmkeysoperation.cpp b/src/tools/sdktool/rmkeysoperation.cpp
index ff1f7f8baf..6f3d190d5e 100644
--- a/src/tools/sdktool/rmkeysoperation.cpp
+++ b/src/tools/sdktool/rmkeysoperation.cpp
@@ -203,7 +203,7 @@ QVariantMap RmKeysOperation::rmKeys(const QVariantMap &map, const QStringList &r
foldBack = current;
}
- Q_ASSERT(stack.count() == 0);
+ Q_ASSERT(stack.isEmpty());
Q_ASSERT(foldBack != map);
result = foldBack;