Removing a few unneeded "? true : false"

Change-Id: Ib13f0ddd65fe78f5559f343f2fc30756b1d3ef76
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
This commit is contained in:
Alessandro Portale 2014-09-09 15:18:54 +02:00 committed by Marc Mutz
parent e5f528fb0e
commit 106487387d
17 changed files with 30 additions and 32 deletions

View File

@ -97,7 +97,7 @@ bool CeSdkHandler::parse()
return false;
}
return m_list.size() > 0 ? true : false;
return m_list.size() > 0;
}
QString CeSdkHandler::fixPaths(QString path) const

View File

@ -391,9 +391,9 @@ void QLoggingRegistry::defaultCategoryFilter(QLoggingCategory *cat)
Q_ASSERT(reg->categories.contains(cat));
QtMsgType enableForLevel = reg->categories.value(cat);
bool debug = (enableForLevel == QtDebugMsg) ? true : false;
bool warning = (enableForLevel <= QtWarningMsg) ? true : false;
bool critical = (enableForLevel <= QtCriticalMsg) ? true : false;
bool debug = (enableForLevel == QtDebugMsg);
bool warning = (enableForLevel <= QtWarningMsg);
bool critical = (enableForLevel <= QtCriticalMsg);
// hard-wired implementation of
// qt.*.debug=false

View File

@ -1163,7 +1163,7 @@ bool QNativeSocketEnginePrivate::nativeHasPendingDatagrams() const
timeout.tv_sec = 0;
timeout.tv_usec = 5000;
int available = ::select(1, &readS, 0, 0, &timeout);
result = available > 0 ? true : false;
result = available > 0;
#endif
#if defined (QNATIVESOCKETENGINE_DEBUG)

View File

@ -163,7 +163,7 @@ static bool writeIconDirEntry(QIODevice *iodev, const ICONDIRENTRY &iconEntry)
qToLittleEndian<quint16>(iconEntry.wBitCount, &tmp[6]);
qToLittleEndian<quint32>(iconEntry.dwBytesInRes, &tmp[8]);
qToLittleEndian<quint32>(iconEntry.dwImageOffset, &tmp[12]);
return (iodev->write((char*)tmp, ICONDIRENTRY_SIZE) == ICONDIRENTRY_SIZE) ? true : false;
return iodev->write((char*)tmp, ICONDIRENTRY_SIZE) == ICONDIRENTRY_SIZE;
}
return false;
@ -190,7 +190,7 @@ static bool writeIconDir(QIODevice *iodev, const ICONDIR &iconDir)
qToLittleEndian(iconDir.idReserved, tmp);
qToLittleEndian(iconDir.idType, &tmp[2]);
qToLittleEndian(iconDir.idCount, &tmp[4]);
return (iodev->write((char*)tmp, 6) == 6) ? true : false;
return iodev->write((char*)tmp, 6) == 6;
}
return false;
}
@ -233,7 +233,7 @@ static bool writeBMPInfoHeader(QIODevice *iodev, const BMP_INFOHDR &header)
qToLittleEndian<quint32>(header.biClrUsed, &tmp[32]);
qToLittleEndian<quint32>(header.biClrImportant, &tmp[36]);
return (iodev->write((char*)tmp, BMP_INFOHDR_SIZE) == BMP_INFOHDR_SIZE) ? true : false;
return iodev->write((char*)tmp, BMP_INFOHDR_SIZE) == BMP_INFOHDR_SIZE;
}
return false;
}
@ -881,7 +881,7 @@ bool QtIcoHandler::jumpToImage(int imageNumber)
m_currentIconIndex = imageNumber;
}
return (imageNumber < imageCount()) ? true : false;
return imageNumber < imageCount();
}
/*! \reimp

View File

@ -1679,7 +1679,7 @@ QSqlRecord QIBaseDriver::record(const QString& tablename) const
f.setLength(q.value(2).toInt());
f.setPrecision(0);
}
f.setRequired(q.value(5).toInt() > 0 ? true : false);
f.setRequired(q.value(5).toInt() > 0);
f.setSqlType(type);
rec.append(f);

View File

@ -162,7 +162,7 @@ bool QTestElementAttribute::setPair(QTest::AttributeIndex index, const char *val
attributeIndex = index;
attributeValue = qstrdup(value);
return (attributeValue!=0) ? true:false;
return attributeValue != 0;
}
QT_END_NAMESPACE

View File

@ -1101,7 +1101,7 @@ void Config::load(Location location, const QString& fileName)
ConfigVarMultimap::Iterator i;
i = configVars_.insert(*key, ConfigVar(*key, rhsValues, QDir::currentPath(), keyLoc));
i.value().plus_ = (plus ? true : false);
i.value().plus_ = plus;
++key;
}
}

View File

@ -1076,7 +1076,7 @@ bool CppCodeParser::skipTo(int target)
{
while ((tok != Tok_Eoi) && (tok != target))
readToken();
return (tok == target ? true : false);
return tok == target;
}
/*!

View File

@ -3471,7 +3471,7 @@ void DomWidget::read(QXmlStreamReader &reader)
continue;
}
if (name == QStringLiteral("native")) {
setAttributeNative((attribute.value().toString() == QStringLiteral("true") ? true : false));
setAttributeNative(attribute.value().toString() == QStringLiteral("true"));
continue;
}
reader.raiseError(QStringLiteral("Unexpected attribute ") + name.toString());
@ -4845,23 +4845,23 @@ void DomFont::read(QXmlStreamReader &reader)
continue;
}
if (tag == QStringLiteral("italic")) {
setElementItalic((reader.readElementText() == QStringLiteral("true") ? true : false));
setElementItalic(reader.readElementText() == QStringLiteral("true"));
continue;
}
if (tag == QStringLiteral("bold")) {
setElementBold((reader.readElementText() == QStringLiteral("true") ? true : false));
setElementBold(reader.readElementText() == QStringLiteral("true"));
continue;
}
if (tag == QStringLiteral("underline")) {
setElementUnderline((reader.readElementText() == QStringLiteral("true") ? true : false));
setElementUnderline(reader.readElementText() == QStringLiteral("true"));
continue;
}
if (tag == QStringLiteral("strikeout")) {
setElementStrikeOut((reader.readElementText() == QStringLiteral("true") ? true : false));
setElementStrikeOut(reader.readElementText() == QStringLiteral("true"));
continue;
}
if (tag == QStringLiteral("antialiasing")) {
setElementAntialiasing((reader.readElementText() == QStringLiteral("true") ? true : false));
setElementAntialiasing(reader.readElementText() == QStringLiteral("true"));
continue;
}
if (tag == QStringLiteral("stylestrategy")) {
@ -4869,7 +4869,7 @@ void DomFont::read(QXmlStreamReader &reader)
continue;
}
if (tag == QStringLiteral("kerning")) {
setElementKerning((reader.readElementText() == QStringLiteral("true") ? true : false));
setElementKerning(reader.readElementText() == QStringLiteral("true"));
continue;
}
reader.raiseError(QStringLiteral("Unexpected element ") + tag);

View File

@ -198,7 +198,7 @@ int QAccessibleMenuItem::indexOfChild(const QAccessibleInterface * child) const
bool QAccessibleMenuItem::isValid() const
{
return m_action && m_owner ? true : false;
return m_action && m_owner;
}
QAccessibleInterface *QAccessibleMenuItem::parent() const

View File

@ -295,7 +295,7 @@ QSize QComboBoxPrivate::recomputeSizeHint(QSize &sh) const
{
Q_Q(const QComboBox);
if (!sh.isValid()) {
bool hasIcon = sizeAdjustPolicy == QComboBox::AdjustToMinimumContentsLengthWithIcon ? true : false;
bool hasIcon = sizeAdjustPolicy == QComboBox::AdjustToMinimumContentsLengthWithIcon;
int count = q->count();
QSize iconSize = q->iconSize();
const QFontMetrics &fm = q->fontMetrics();

View File

@ -1466,7 +1466,7 @@ QMdiSubWindow *QMdiAreaPrivate::nextVisibleSubWindow(int increaseFactor, QMdiAre
// Find the index for the current sub-window in the given activation order
const int indexToCurrent = subWindows.indexOf(current);
const bool increasing = increaseFactor > 0 ? true : false;
const bool increasing = increaseFactor > 0;
// and use that index + increseFactor as a candidate.
int index = -1;
@ -2553,7 +2553,7 @@ bool QMdiArea::eventFilter(QObject *object, QEvent *event)
if (!area)
return QAbstractScrollArea::eventFilter(object, event);
const bool keyPress = (event->type() == QEvent::KeyPress) ? true : false;
const bool keyPress = (event->type() == QEvent::KeyPress);
// 1) Ctrl-Tab once -> activate the previously active window.
// 2) Ctrl-Tab (Tab, Tab, ...) -> iterate through all windows (activateNextSubWindow()).

View File

@ -2188,7 +2188,7 @@ void QWidgetTextControlPrivate::editFocusEvent(QEvent *e)
setBlinkingCursorEnabled(false);
}
hasEditFocus = e->type() == QEvent::EnterEditFocus ? true : false;
hasEditFocus = e->type() == QEvent::EnterEditFocus;
}
#endif

View File

@ -166,8 +166,7 @@ void tst_Spdy::settingsAndNegotiation()
QFETCH(QByteArray, expectedProtocol);
#ifndef QT_NO_OPENSSL
bool expectedSpdyUsed = (expectedProtocol == QSslConfiguration::NextProtocolSpdy3_0)
? true : false;
bool expectedSpdyUsed = (expectedProtocol == QSslConfiguration::NextProtocolSpdy3_0);
QCOMPARE(reply->attribute(QNetworkRequest::SpdyWasUsedAttribute).toBool(), expectedSpdyUsed);
#endif // QT_NO_OPENSSL

View File

@ -984,7 +984,7 @@ void tst_QGraphicsProxyWidget::hoverEnterLeaveEvent()
// in
QTest::mouseMove(&view, QPoint(50, 50));
QSKIP("QTBUG-25294");
QTRY_COMPARE(widget->testAttribute(Qt::WA_UnderMouse), hasWidget ? true : false);
QTRY_COMPARE(widget->testAttribute(Qt::WA_UnderMouse), hasWidget);
// ### this attribute isn't supported
QCOMPARE(widget->enterCount, hasWidget ? 1 : 0);
QCOMPARE(widget->hoverEnter, (hasWidget && hoverEnabled) ? 1 : 0);
@ -1366,7 +1366,7 @@ void tst_QGraphicsProxyWidget::sizeHint()
void tst_QGraphicsProxyWidget::sizePolicy()
{
for (int p = 0; p < 2; ++p) {
bool hasWidget = (p == 0 ? true : false);
bool hasWidget = (p == 0);
SubQGraphicsProxyWidget proxy;
QWidget *widget = new QWidget;
QSizePolicy proxyPol(QSizePolicy::Maximum, QSizePolicy::Expanding);

View File

@ -1080,7 +1080,7 @@ public:
bool isEditingState(QListWidgetItem *item) {
Q_UNUSED(item);
return (QListWidget::state() == QListWidget::EditingState ? true : false);
return QListWidget::state() == QListWidget::EditingState;
}
};

View File

@ -381,8 +381,7 @@ void tst_qnetworkreply::spdy()
QFETCH(QByteArray, expectedProtocol);
bool expectedSpdyUsed = (expectedProtocol == QSslConfiguration::NextProtocolSpdy3_0)
? true : false;
bool expectedSpdyUsed = (expectedProtocol == QSslConfiguration::NextProtocolSpdy3_0);
QCOMPARE(reply->attribute(QNetworkRequest::SpdyWasUsedAttribute).toBool(), expectedSpdyUsed);
QCOMPARE(metaDataChangedSpy.count(), 1);