diff options
author | Zhang Sheng <zhangsheng@uniontech.com> | 2020-11-16 11:19:17 +0800 |
---|---|---|
committer | Zhang Sheng <zhangsheng@uniontech.com> | 2020-11-16 12:53:37 +0000 |
commit | e13173c112b729da8f53dd2e81e8116a1ed857cf (patch) | |
tree | 49c2bce0c3349eebd0f2b62c80a1b7168ae45dc2 /src | |
parent | 802e5a45baf3ac7da2cb3be06d10bdd69696fcae (diff) |
Adjust code format, add space after 'if'
Change-Id: Ice081c891ff7f4b766f49dd4bd5cf18c30237acf
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Reviewed-by: hjk <hjk@qt.io>
Diffstat (limited to 'src')
105 files changed, 398 insertions, 398 deletions
diff --git a/src/corelib/animation/qabstractanimation.cpp b/src/corelib/animation/qabstractanimation.cpp index 7ccb5772d6..133bc5689d 100644 --- a/src/corelib/animation/qabstractanimation.cpp +++ b/src/corelib/animation/qabstractanimation.cpp @@ -293,7 +293,7 @@ void QUnifiedTimer::stopAnimationDriver() void QUnifiedTimer::updateAnimationTimers() { //setCurrentTime can get this called again while we're the for loop. At least with pauseAnimations - if(insideTick) + if (insideTick) return; const qint64 totalElapsed = elapsed(); diff --git a/src/corelib/global/qlibraryinfo.cpp b/src/corelib/global/qlibraryinfo.cpp index 4cd940a7a3..301c3ab89a 100644 --- a/src/corelib/global/qlibraryinfo.cpp +++ b/src/corelib/global/qlibraryinfo.cpp @@ -700,7 +700,7 @@ QLibraryInfo::rawLocation(LibraryPath loc, PathGroup group) } #endif - if(!key.isNull()) { + if (!key.isNull()) { QSettings *config = QLibraryInfoPrivate::configuration(); config->beginGroup(QLatin1String( #ifdef QT_BUILD_QMAKE diff --git a/src/corelib/io/qdiriterator.cpp b/src/corelib/io/qdiriterator.cpp index d958318708..9799c9b075 100644 --- a/src/corelib/io/qdiriterator.cpp +++ b/src/corelib/io/qdiriterator.cpp @@ -355,9 +355,9 @@ bool QDirIteratorPrivate::matchesFilters(const QString &fileName, const QFileInf // skip symlinks const bool skipSymlinks = (filters & QDir::NoSymLinks); const bool includeSystem = (filters & QDir::System); - if(skipSymlinks && fi.isSymLink()) { + if (skipSymlinks && fi.isSymLink()) { // The only reason to save this file is if it is a broken link and we are requesting system files. - if(!includeSystem || fi.exists()) + if (!includeSystem || fi.exists()) return false; } diff --git a/src/corelib/io/qfile.cpp b/src/corelib/io/qfile.cpp index 77c83d08b6..36e2b4476a 100644 --- a/src/corelib/io/qfile.cpp +++ b/src/corelib/io/qfile.cpp @@ -453,7 +453,7 @@ QFile::remove() } unsetError(); close(); - if(error() == QFile::NoError) { + if (error() == QFile::NoError) { if (d->engine()->remove()) { unsetError(); return true; @@ -630,7 +630,7 @@ QFile::rename(const QString &newName) } unsetError(); close(); - if(error() == QFile::NoError) { + if (error() == QFile::NoError) { if (changingCase ? d->engine()->renameOverwrite(newName) : d->engine()->rename(newName)) { unsetError(); // engine was able to handle the new name so we just reset it @@ -661,7 +661,7 @@ QFile::rename(const QString &newName) d->setError(QFile::RenameError, errorString()); error = true; } - if(!error) { + if (!error) { if (!remove()) { d->setError(QFile::RenameError, tr("Cannot remove source file")); error = true; @@ -785,13 +785,13 @@ QFile::copy(const QString &newName) } unsetError(); close(); - if(error() == QFile::NoError) { + if (error() == QFile::NoError) { if (d->engine()->copy(newName)) { unsetError(); return true; } else { bool error = false; - if(!open(QFile::ReadOnly)) { + if (!open(QFile::ReadOnly)) { error = true; d->setError(QFile::CopyError, tr("Cannot open %1 for input").arg(d->fileName)); } else { @@ -855,7 +855,7 @@ QFile::copy(const QString &newName) #endif } } - if(!error) { + if (!error) { QFile::setPermissions(newName, permissions()); close(); unsetError(); @@ -920,7 +920,7 @@ bool QFile::open(OpenMode mode) return true; } QFile::FileError err = d->fileEngine->error(); - if(err == QFile::UnspecifiedError) + if (err == QFile::UnspecifiedError) err = QFile::OpenError; d->setError(err, d->fileEngine->errorString()); return false; diff --git a/src/corelib/io/qfilesystemengine_win.cpp b/src/corelib/io/qfilesystemengine_win.cpp index d876fdf4ae..f27040b07c 100644 --- a/src/corelib/io/qfilesystemengine_win.cpp +++ b/src/corelib/io/qfilesystemengine_win.cpp @@ -792,7 +792,7 @@ bool QFileSystemEngine::fillPermissions(const QFileSystemEntry &entry, QFileSyst DWORD res = GetNamedSecurityInfo(reinterpret_cast<const wchar_t*>(fname.utf16()), SE_FILE_OBJECT, OWNER_SECURITY_INFORMATION | GROUP_SECURITY_INFORMATION | DACL_SECURITY_INFORMATION, &pOwner, &pGroup, &pDacl, 0, &pSD); - if(res == ERROR_SUCCESS) { + if (res == ERROR_SUCCESS) { ACCESS_MASK access_mask; TRUSTEE_W trustee; if (what & QFileSystemMetaData::UserPermissions) { // user @@ -845,11 +845,11 @@ bool QFileSystemEngine::fillPermissions(const QFileSystemEntry &entry, QFileSyst BuildTrusteeWithSid(&trustee, pOwner); if (GetEffectiveRightsFromAcl(pDacl, &trustee, &access_mask) != ERROR_SUCCESS) access_mask = (ACCESS_MASK)-1; - if(access_mask & ReadMask) + if (access_mask & ReadMask) data.entryFlags |= QFileSystemMetaData::OwnerReadPermission; - if(access_mask & WriteMask) + if (access_mask & WriteMask) data.entryFlags |= QFileSystemMetaData::OwnerWritePermission; - if(access_mask & ExecMask) + if (access_mask & ExecMask) data.entryFlags |= QFileSystemMetaData::OwnerExecutePermission; } if (what & QFileSystemMetaData::GroupPermissions) { // group @@ -857,22 +857,22 @@ bool QFileSystemEngine::fillPermissions(const QFileSystemEntry &entry, QFileSyst BuildTrusteeWithSid(&trustee, pGroup); if (GetEffectiveRightsFromAcl(pDacl, &trustee, &access_mask) != ERROR_SUCCESS) access_mask = (ACCESS_MASK)-1; - if(access_mask & ReadMask) + if (access_mask & ReadMask) data.entryFlags |= QFileSystemMetaData::GroupReadPermission; - if(access_mask & WriteMask) + if (access_mask & WriteMask) data.entryFlags |= QFileSystemMetaData::GroupWritePermission; - if(access_mask & ExecMask) + if (access_mask & ExecMask) data.entryFlags |= QFileSystemMetaData::GroupExecutePermission; } if (what & QFileSystemMetaData::OtherPermissions) { // other (world) data.knownFlagsMask |= QFileSystemMetaData::OtherPermissions; if (GetEffectiveRightsFromAcl(pDacl, &worldTrusteeW, &access_mask) != ERROR_SUCCESS) access_mask = (ACCESS_MASK)-1; // ### - if(access_mask & ReadMask) + if (access_mask & ReadMask) data.entryFlags |= QFileSystemMetaData::OtherReadPermission; - if(access_mask & WriteMask) + if (access_mask & WriteMask) data.entryFlags |= QFileSystemMetaData::OtherWritePermission; - if(access_mask & ExecMask) + if (access_mask & ExecMask) data.entryFlags |= QFileSystemMetaData::OwnerExecutePermission; } LocalFree(pSD); @@ -1281,7 +1281,7 @@ bool QFileSystemEngine::setCurrentPath(const QFileSystemEntry &entry) { QFileSystemMetaData meta; fillMetaData(entry, meta, QFileSystemMetaData::ExistsAttribute | QFileSystemMetaData::DirectoryType); - if(!(meta.exists() && meta.isDirectory())) + if (!(meta.exists() && meta.isDirectory())) return false; //TODO: this should really be using nativeFilePath(), but that returns a path in long format \\?\c:\foo @@ -1326,7 +1326,7 @@ bool QFileSystemEngine::copyFile(const QFileSystemEntry &source, const QFileSyst { bool ret = ::CopyFile((wchar_t*)source.nativeFilePath().utf16(), (wchar_t*)target.nativeFilePath().utf16(), true) != 0; - if(!ret) + if (!ret) error = QSystemError(::GetLastError(), QSystemError::NativeError); return ret; } @@ -1339,7 +1339,7 @@ bool QFileSystemEngine::renameFile(const QFileSystemEntry &source, const QFileSy bool ret = ::MoveFile((wchar_t*)source.nativeFilePath().utf16(), (wchar_t*)target.nativeFilePath().utf16()) != 0; - if(!ret) + if (!ret) error = QSystemError(::GetLastError(), QSystemError::NativeError); return ret; } @@ -1364,7 +1364,7 @@ bool QFileSystemEngine::removeFile(const QFileSystemEntry &entry, QSystemError & Q_CHECK_FILE_NAME(entry, false); bool ret = ::DeleteFile((wchar_t*)entry.nativeFilePath().utf16()) != 0; - if(!ret) + if (!ret) error = QSystemError(::GetLastError(), QSystemError::NativeError); return ret; } @@ -1477,7 +1477,7 @@ bool QFileSystemEngine::setPermissions(const QFileSystemEntry &entry, QFile::Per return false; bool ret = ::_wchmod(reinterpret_cast<const wchar_t*>(entry.nativeFilePath().utf16()), mode) == 0; - if(!ret) + if (!ret) error = QSystemError(errno, QSystemError::StandardLibraryError); return ret; } diff --git a/src/corelib/io/qfilesystemwatcher.cpp b/src/corelib/io/qfilesystemwatcher.cpp index 1712fec751..bd5a73da84 100644 --- a/src/corelib/io/qfilesystemwatcher.cpp +++ b/src/corelib/io/qfilesystemwatcher.cpp @@ -121,7 +121,7 @@ void QFileSystemWatcherPrivate::init() void QFileSystemWatcherPrivate::initPollerEngine() { - if(poller) + if (poller) return; Q_Q(QFileSystemWatcher); @@ -379,7 +379,7 @@ QStringList QFileSystemWatcher::addPaths(const QStringList &paths) } #endif // Normal runtime case - search intelligently for best engine - if(d->native) { + if (d->native) { return d->native; } else { d_func()->initPollerEngine(); diff --git a/src/corelib/io/qtemporaryfile.cpp b/src/corelib/io/qtemporaryfile.cpp index fba3def4fa..bdd128a88c 100644 --- a/src/corelib/io/qtemporaryfile.cpp +++ b/src/corelib/io/qtemporaryfile.cpp @@ -797,7 +797,7 @@ QString QTemporaryFile::fileName() const if (tef && tef->isReallyOpen()) const_cast<QTemporaryFilePrivate *>(d)->materializeUnnamedFile(); - if(d->fileName.isEmpty()) + if (d->fileName.isEmpty()) return QString(); return d->engine()->fileName(QAbstractFileEngine::DefaultName); } @@ -887,12 +887,12 @@ bool QTemporaryFile::rename(const QString &newName) QTemporaryFile *QTemporaryFile::createNativeFile(QFile &file) { if (QAbstractFileEngine *engine = file.d_func()->engine()) { - if(engine->fileFlags(QAbstractFileEngine::FlagsMask) & QAbstractFileEngine::LocalDiskFlag) + if (engine->fileFlags(QAbstractFileEngine::FlagsMask) & QAbstractFileEngine::LocalDiskFlag) return nullptr; // native already //cache bool wasOpen = file.isOpen(); qint64 old_off = 0; - if(wasOpen) + if (wasOpen) old_off = file.pos(); else if (!file.open(QIODevice::ReadOnly)) return nullptr; @@ -913,7 +913,7 @@ QTemporaryFile *QTemporaryFile::createNativeFile(QFile &file) ret = nullptr; } //restore - if(wasOpen) + if (wasOpen) file.seek(old_off); else file.close(); diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp index 758e1d3caa..ec8a2dc286 100644 --- a/src/corelib/kernel/qcoreapplication.cpp +++ b/src/corelib/kernel/qcoreapplication.cpp @@ -2297,7 +2297,7 @@ QString QCoreApplication::applicationFilePath() return *QCoreApplicationPrivate::cachedApplicationFilePath; #elif defined(Q_OS_MAC) QString qAppFileName_str = qAppFileName(); - if(!qAppFileName_str.isEmpty()) { + if (!qAppFileName_str.isEmpty()) { QFileInfo fi(qAppFileName_str); if (fi.exists()) { QCoreApplicationPrivate::setApplicationFilePath(fi.canonicalFilePath()); diff --git a/src/corelib/kernel/qeventdispatcher_win.cpp b/src/corelib/kernel/qeventdispatcher_win.cpp index 1336238795..d547642e7d 100644 --- a/src/corelib/kernel/qeventdispatcher_win.cpp +++ b/src/corelib/kernel/qeventdispatcher_win.cpp @@ -510,7 +510,7 @@ bool QEventDispatcherWin32::processEvents(QEventLoop::ProcessEventsFlags flags) if (!(flags & QEventLoop::ExcludeUserInputEvents) && !d->queuedUserInputEvents.isEmpty()) { // process queued user input events msg = d->queuedUserInputEvents.takeFirst(); - } else if(!(flags & QEventLoop::ExcludeSocketNotifiers) && !d->queuedSocketEvents.isEmpty()) { + } else if (!(flags & QEventLoop::ExcludeSocketNotifiers) && !d->queuedSocketEvents.isEmpty()) { // process queued socket events msg = d->queuedSocketEvents.takeFirst(); } else if (PeekMessage(&msg, 0, 0, 0, PM_REMOVE)) { diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp index 28dd89397b..54bed0564f 100644 --- a/src/corelib/kernel/qobject.cpp +++ b/src/corelib/kernel/qobject.cpp @@ -3109,7 +3109,7 @@ bool QObject::disconnect(const QObject *sender, const QMetaMethod &signal, return false; } if (signal.mobj) { - if(signal.methodType() != QMetaMethod::Signal) { + if (signal.methodType() != QMetaMethod::Signal) { qCWarning(lcConnect, "QObject::%s: Attempt to %s non-signal %s::%s", "disconnect","unbind", sender->metaObject()->className(), signal.methodSignature().constData()); diff --git a/src/corelib/plugin/qlibrary.cpp b/src/corelib/plugin/qlibrary.cpp index fcda933fd5..c625269ada 100644 --- a/src/corelib/plugin/qlibrary.cpp +++ b/src/corelib/plugin/qlibrary.cpp @@ -801,7 +801,7 @@ void QLibraryPrivate::updatePluginState() .arg(qt_version&0xff) .arg(debug ? QLatin1String("debug") : QLatin1String("release")); #ifndef QT_NO_DEBUG_PLUGIN_CHECK - } else if(debug != QLIBRARY_AS_DEBUG) { + } else if (debug != QLIBRARY_AS_DEBUG) { //don't issue a qWarning since we will hopefully find a non-debug? --Sam errorString = QLibrary::tr("The plugin '%1' uses incompatible Qt library." " (Cannot mix debug and release libraries.)").arg(fileName); diff --git a/src/corelib/serialization/qxmlstream.cpp b/src/corelib/serialization/qxmlstream.cpp index e15db62aeb..7a4a6ed3e5 100644 --- a/src/corelib/serialization/qxmlstream.cpp +++ b/src/corelib/serialization/qxmlstream.cpp @@ -1572,7 +1572,7 @@ void QXmlStreamReaderPrivate::resolveTag() namespaceDeclaration.prefix.clear(); const XmlStringRef ns(dtdAttribute.defaultValue); - if(ns == QLatin1String("http://www.w3.org/2000/xmlns/") || + if (ns == QLatin1String("http://www.w3.org/2000/xmlns/") || ns == QLatin1String("http://www.w3.org/XML/1998/namespace")) raiseWellFormedError(QXmlStream::tr("Illegal namespace declaration.")); else @@ -1783,7 +1783,7 @@ void QXmlStreamReaderPrivate::startDocument() if (prefix.isEmpty() && key == QLatin1String("encoding")) { documentEncoding = value; - if(hasStandalone) + if (hasStandalone) err = QXmlStream::tr("The standalone pseudo attribute must appear after the encoding."); if (!QXmlUtils::isEncName(value)) err = QXmlStream::tr("%1 is an invalid encoding name.").arg(value); diff --git a/src/corelib/serialization/qxmlstream_p.h b/src/corelib/serialization/qxmlstream_p.h index a601c24bd6..afbd6f22de 100644 --- a/src/corelib/serialization/qxmlstream_p.h +++ b/src/corelib/serialization/qxmlstream_p.h @@ -529,7 +529,7 @@ private: */ inline void setType(const QXmlStreamReader::TokenType t) { - if(type != QXmlStreamReader::Invalid) + if (type != QXmlStreamReader::Invalid) type = t; } }; diff --git a/src/corelib/serialization/qxmlutils.cpp b/src/corelib/serialization/qxmlutils.cpp index 01c84251fd..dccdf85182 100644 --- a/src/corelib/serialization/qxmlutils.cpp +++ b/src/corelib/serialization/qxmlutils.cpp @@ -371,16 +371,16 @@ bool QXmlUtils::isPublicID(QStringView candidate) */ bool QXmlUtils::isNCName(QStringView ncName) { - if(ncName.isEmpty()) + if (ncName.isEmpty()) return false; const QChar first(ncName.at(0)); - if(!QXmlUtils::isLetter(first) && first.unicode() != '_' && first.unicode() != ':') + if (!QXmlUtils::isLetter(first) && first.unicode() != '_' && first.unicode() != ':') return false; for (QChar at : ncName) { - if(!QXmlUtils::isNameChar(at) || at == QLatin1Char(':')) + if (!QXmlUtils::isNameChar(at) || at == QLatin1Char(':')) return false; } diff --git a/src/corelib/text/qbytedata_p.h b/src/corelib/text/qbytedata_p.h index 053e4202d3..77f351cbb4 100644 --- a/src/corelib/text/qbytedata_p.h +++ b/src/corelib/text/qbytedata_p.h @@ -275,7 +275,7 @@ public: inline qint64 sizeNextBlock() const { - if(buffers.isEmpty()) + if (buffers.isEmpty()) return 0; else return buffers.first().size() - firstPos; diff --git a/src/corelib/text/qstring.cpp b/src/corelib/text/qstring.cpp index c955cb8736..499d8dcade 100644 --- a/src/corelib/text/qstring.cpp +++ b/src/corelib/text/qstring.cpp @@ -4475,9 +4475,9 @@ QString QString::section(const QString &sep, qsizetype start, qsizetype end, Sec const QStringView §ion = sections.at(i); const bool empty = section.isEmpty(); if (x >= start) { - if(x == start) + if (x == start) first_i = i; - if(x == end) + if (x == end) last_i = i; if (x > start && i > 0) ret += sep; diff --git a/src/corelib/thread/qthreadstorage.cpp b/src/corelib/thread/qthreadstorage.cpp index 7f78f69bc7..98d8e87459 100644 --- a/src/corelib/thread/qthreadstorage.cpp +++ b/src/corelib/thread/qthreadstorage.cpp @@ -65,7 +65,7 @@ void qtsDebug(const char *fmt, ...) va_end(va); } #else -# define DEBUG_MSG if(false)qDebug +# define DEBUG_MSG if (false)qDebug #endif static QBasicMutex destructorsMutex; diff --git a/src/corelib/tools/qcontiguouscache.h b/src/corelib/tools/qcontiguouscache.h index 5e1eb17658..e4d493cc52 100644 --- a/src/corelib/tools/qcontiguouscache.h +++ b/src/corelib/tools/qcontiguouscache.h @@ -209,13 +209,13 @@ void QContiguousCache<T>::setCapacity(qsizetype asize) x->alloc = asize; x->count = qMin(d->count, asize); x->offset = d->offset + d->count - x->count; - if(asize) + if (asize) x->start = x->offset % x->alloc; else x->start = 0; qsizetype oldcount = x->count; - if(oldcount) + if (oldcount) { T *dest = x->array + (x->start + x->count-1) % x->alloc; T *src = d->array + (d->start + d->count-1) % d->alloc; diff --git a/src/gui/image/qpixmap_blitter.cpp b/src/gui/image/qpixmap_blitter.cpp index aeed1e3b34..510a46e7b1 100644 --- a/src/gui/image/qpixmap_blitter.cpp +++ b/src/gui/image/qpixmap_blitter.cpp @@ -260,7 +260,7 @@ void QBlittablePlatformPixmap::markRasterOverlayImpl(const QRectF &rect) if (!showRasterOverlay) return; QRectF transformationRect = clipAndTransformRect(rect); - if(!transformationRect.isEmpty()) { + if (!transformationRect.isEmpty()) { QPainter p(overlay()); p.setBrush(m_overlayColor); p.setCompositionMode(QPainter::CompositionMode_Source); diff --git a/src/gui/image/qpixmapcache.cpp b/src/gui/image/qpixmapcache.cpp index 2fca322543..26cc80b5b0 100644 --- a/src/gui/image/qpixmapcache.cpp +++ b/src/gui/image/qpixmapcache.cpp @@ -391,7 +391,7 @@ bool QPMCache::replace(const QPixmapCache::Key &key, const QPixmap &pixmap, int bool success = QCache<QPixmapCache::Key, QPixmapCacheEntry>::insert(cacheKey, new QPixmapCacheEntry(cacheKey, pixmap), cost); if (success) { - if(!theid) { + if (!theid) { theid = startTimer(flush_time); t = false; } diff --git a/src/gui/itemmodels/qstandarditemmodel.cpp b/src/gui/itemmodels/qstandarditemmodel.cpp index 1d3dc1303f..234296271b 100644 --- a/src/gui/itemmodels/qstandarditemmodel.cpp +++ b/src/gui/itemmodels/qstandarditemmodel.cpp @@ -3109,7 +3109,7 @@ QStringList QStandardItemModel::mimeTypes() const QMimeData *QStandardItemModel::mimeData(const QModelIndexList &indexes) const { QMimeData *data = QAbstractItemModel::mimeData(indexes); - if(!data) + if (!data) return nullptr; const QString format = qStandardItemModelDataListMimeType(); diff --git a/src/gui/kernel/qaction.cpp b/src/gui/kernel/qaction.cpp index 0da5667c1d..d3a1c069f0 100644 --- a/src/gui/kernel/qaction.cpp +++ b/src/gui/kernel/qaction.cpp @@ -511,13 +511,13 @@ QAction::~QAction() void QAction::setActionGroup(QActionGroup *group) { Q_D(QAction); - if(group == d->group) + if (group == d->group) return; - if(d->group) + if (d->group) d->group->removeAction(this); d->group = group; - if(group) + if (group) group->addAction(this); d->sendDataChanged(); } @@ -652,7 +652,7 @@ QString QAction::text() const { Q_D(const QAction); QString s = d->text; - if(s.isEmpty()) { + if (s.isEmpty()) { s = d->iconText; s.replace(QLatin1Char('&'), QLatin1String("&&")); } @@ -1130,7 +1130,7 @@ void QAction::activate(ActionEvent event) } if (!guard.isNull()) emit triggered(d->checked); - } else if(event == Hover) { + } else if (event == Hover) { emit hovered(); } } diff --git a/src/gui/kernel/qcursor.cpp b/src/gui/kernel/qcursor.cpp index e70f6ac79b..715cc76cc9 100644 --- a/src/gui/kernel/qcursor.cpp +++ b/src/gui/kernel/qcursor.cpp @@ -719,7 +719,7 @@ QCursorData::~QCursorData() /*! \internal */ void QCursorData::cleanup() { - if(!QCursorData::initialized) + if (!QCursorData::initialized) return; for (int shape = 0; shape <= Qt::LastCursor; ++shape) { diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index f7e07092dd..d396f11efb 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -1948,7 +1948,7 @@ bool QGuiApplication::notify(QObject *object, QEvent *event) */ bool QGuiApplication::event(QEvent *e) { - if(e->type() == QEvent::LanguageChange) { + if (e->type() == QEvent::LanguageChange) { setLayoutDirection(qt_detectRTLLanguage()?Qt::RightToLeft:Qt::LeftToRight); for (auto *topLevelWindow : QGuiApplication::topLevelWindows()) { if (topLevelWindow->flags() != Qt::Desktop) diff --git a/src/gui/kernel/qkeysequence.cpp b/src/gui/kernel/qkeysequence.cpp index 5d52ba139d..5d2a95c33f 100644 --- a/src/gui/kernel/qkeysequence.cpp +++ b/src/gui/kernel/qkeysequence.cpp @@ -964,7 +964,7 @@ QKeySequence QKeySequence::mnemonic(const QString &text) { QKeySequence ret; - if(qt_sequence_no_mnemonics) + if (qt_sequence_no_mnemonics) return ret; bool found = false; @@ -1176,7 +1176,7 @@ int QKeySequencePrivate::decodeString(QString accel, QKeySequence::SequenceForma int p = accel.lastIndexOf(QLatin1Char('+'), accel.length() - 2); // -2 so that Ctrl++ works QStringView accelRef(accel); - if(p > 0) + if (p > 0) accelRef = accelRef.mid(p + 1); int fnum = 0; diff --git a/src/gui/kernel/qpalette.cpp b/src/gui/kernel/qpalette.cpp index f5d010aa26..963526c153 100644 --- a/src/gui/kernel/qpalette.cpp +++ b/src/gui/kernel/qpalette.cpp @@ -734,8 +734,8 @@ QPalette::operator QVariant() const const QBrush &QPalette::brush(ColorGroup gr, ColorRole cr) const { Q_ASSERT(cr < NColorRoles); - if(gr >= (int)NColorGroups) { - if(gr == Current) { + if (gr >= (int)NColorGroups) { + if (gr == Current) { gr = currentGroup; } else { qWarning("QPalette::brush: Unknown ColorGroup: %d", (int)gr); @@ -832,7 +832,7 @@ void QPalette::detach() x->br[grp][role] = d->br[grp][role]; } x->resolveMask = d->resolveMask; - if(!d->ref.deref()) + if (!d->ref.deref()) delete d; d = x; } @@ -866,7 +866,7 @@ bool QPalette::operator==(const QPalette &p) const return true; for(int grp = 0; grp < (int)NColorGroups; grp++) { for(int role = 0; role < (int)NColorRoles; role++) { - if(d->br[grp][role] != p.d->br[grp][role]) + if (d->br[grp][role] != p.d->br[grp][role]) return false; } } @@ -881,26 +881,26 @@ bool QPalette::operator==(const QPalette &p) const */ bool QPalette::isEqual(QPalette::ColorGroup group1, QPalette::ColorGroup group2) const { - if(group1 >= (int)NColorGroups) { - if(group1 == Current) { + if (group1 >= (int)NColorGroups) { + if (group1 == Current) { group1 = currentGroup; } else { qWarning("QPalette::brush: Unknown ColorGroup(1): %d", (int)group1); group1 = Active; } } - if(group2 >= (int)NColorGroups) { - if(group2 == Current) { + if (group2 >= (int)NColorGroups) { + if (group2 == Current) { group2 = currentGroup; } else { qWarning("QPalette::brush: Unknown ColorGroup(2): %d", (int)group2); group2 = Active; } } - if(group1 == group2) + if (group1 == group2) return true; for(int role = 0; role < (int)NColorRoles; role++) { - if(d->br[group1][role] != d->br[group2][role]) + if (d->br[group1][role] != d->br[group2][role]) return false; } return true; @@ -1036,7 +1036,7 @@ static void readV1ColorGroup(QDataStream &s, QPalette &pal, QPalette::ColorGroup QDataStream &operator>>(QDataStream &s, QPalette &p) { - if(s.version() == 1) { + if (s.version() == 1) { p = QPalette(); readV1ColorGroup(s, p, QPalette::Active); readV1ColorGroup(s, p, QPalette::Disabled); diff --git a/src/gui/kernel/qwindow.cpp b/src/gui/kernel/qwindow.cpp index e761fe8e4c..546a90b2e9 100644 --- a/src/gui/kernel/qwindow.cpp +++ b/src/gui/kernel/qwindow.cpp @@ -675,7 +675,7 @@ WId QWindow::winId() const { Q_D(const QWindow); - if(!d->platformWindow) + if (!d->platformWindow) const_cast<QWindow *>(this)->create(); return d->platformWindow->winId(); diff --git a/src/gui/painting/qbezier.cpp b/src/gui/painting/qbezier.cpp index 8b1097ac5b..dabf1b0d23 100644 --- a/src/gui/painting/qbezier.cpp +++ b/src/gui/painting/qbezier.cpp @@ -473,7 +473,7 @@ void QBezier::addIfClose(qreal *length, qreal error) const chord = QLineF(QPointF(x1, y1),QPointF(x4, y4)).length(); - if((len-chord) > error) { + if ((len-chord) > error) { const auto halves = split(); /* split in two */ halves.first.addIfClose(length, error); /* try left side */ halves.second.addIfClose(length, error); /* try right side */ diff --git a/src/gui/painting/qblendfunctions.cpp b/src/gui/painting/qblendfunctions.cpp index 348eceb47f..519601a11d 100644 --- a/src/gui/painting/qblendfunctions.cpp +++ b/src/gui/painting/qblendfunctions.cpp @@ -96,7 +96,7 @@ struct Blend_ARGB32_on_RGB16_SourceAlpha { const quint8 alpha = qAlpha(src); if (alpha) { quint16 s = qConvertRgb32To16(src); - if(alpha < 255) + if (alpha < 255) s += BYTE_MUL_RGB16(*dst, 255 - alpha); *dst = s; } @@ -113,9 +113,9 @@ struct Blend_ARGB32_on_RGB16_SourceAndConstAlpha { inline void write(quint16 *dst, quint32 src) { src = BYTE_MUL(src, m_alpha); const quint8 alpha = qAlpha(src); - if(alpha) { + if (alpha) { quint16 s = qConvertRgb32To16(src); - if(alpha < 255) + if (alpha < 255) s += BYTE_MUL_RGB16(*dst, 255 - alpha); *dst = s; } diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp index 44d63d72b8..ca1c4f831e 100644 --- a/src/gui/painting/qpaintengine_raster.cpp +++ b/src/gui/painting/qpaintengine_raster.cpp @@ -708,7 +708,7 @@ void QRasterPaintEngine::updatePen(const QPen &pen) else d->basicStroker.setStrokeWidth(penWidth); - if(pen_style == Qt::SolidLine) { + if (pen_style == Qt::SolidLine) { s->stroker = &d->basicStroker; } else if (pen_style != Qt::NoPen) { if (!d->dashStroker) diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp index 8326b10083..6bc440b5b3 100644 --- a/src/gui/painting/qpainter.cpp +++ b/src/gui/painting/qpainter.cpp @@ -7269,7 +7269,7 @@ start_lengthVariant: qreal lineWidth = 0x01000000; if (wordwrap || (tf & Qt::TextJustificationForced)) lineWidth = qMax<qreal>(0, r.width()); - if(!wordwrap) + if (!wordwrap) tf |= Qt::TextIncludeTrailingSpaces; textLayout.beginLayout(); diff --git a/src/gui/painting/qpainterpath.cpp b/src/gui/painting/qpainterpath.cpp index 09021c119c..797d456ce4 100644 --- a/src/gui/painting/qpainterpath.cpp +++ b/src/gui/painting/qpainterpath.cpp @@ -3295,7 +3295,7 @@ QPainterPath QPainterPath::subtracted(const QPainterPath &p) const */ QPainterPath QPainterPath::simplified() const { - if(isEmpty()) + if (isEmpty()) return *this; QPathClipper clipper(*this, QPainterPath()); return clipper.clip(QPathClipper::Simplify); diff --git a/src/gui/painting/qpathclipper.cpp b/src/gui/painting/qpathclipper.cpp index f2a45025f6..b3521f41ac 100644 --- a/src/gui/painting/qpathclipper.cpp +++ b/src/gui/painting/qpathclipper.cpp @@ -1965,7 +1965,7 @@ void clipLine(const QPointF &a, const QPointF &b, qreal t, QPainterPath &result) if (outA) addLine(result, QLineF(intersectLine<edge>(a, b, t), b)); - else if(outB) + else if (outB) addLine(result, QLineF(a, intersectLine<edge>(a, b, t))); else addLine(result, QLineF(a, b)); diff --git a/src/gui/painting/qpdf.cpp b/src/gui/painting/qpdf.cpp index 626274d856..55a1aa0242 100644 --- a/src/gui/painting/qpdf.cpp +++ b/src/gui/painting/qpdf.cpp @@ -858,12 +858,12 @@ void QPdfEngine::drawRects (const QRectF *rects, int rectCount) if (d->simplePen || !d->hasPen) { // draw strokes natively in this case for better output - if(!d->simplePen && !d->stroker.matrix.isIdentity()) + if (!d->simplePen && !d->stroker.matrix.isIdentity()) *d->currentPage << "q\n" << QPdf::generateMatrix(d->stroker.matrix); for (int i = 0; i < rectCount; ++i) *d->currentPage << rects[i].x() << rects[i].y() << rects[i].width() << rects[i].height() << "re\n"; *d->currentPage << (d->hasPen ? (d->hasBrush ? "B\n" : "S\n") : "f\n"); - if(!d->simplePen && !d->stroker.matrix.isIdentity()) + if (!d->simplePen && !d->stroker.matrix.isIdentity()) *d->currentPage << "Q\n"; } else { QPainterPath p; @@ -1056,7 +1056,7 @@ void QPdfEngine::drawTextItem(const QPointF &p, const QTextItem &textItem) } *d->currentPage << "q\n"; - if(!d->simplePen) + if (!d->simplePen) *d->currentPage << QPdf::generateMatrix(d->stroker.matrix); bool hp = d->hasPen; @@ -2304,7 +2304,7 @@ int QPdfEnginePrivate::writeCompressed(QIODevice *dev) int QPdfEnginePrivate::writeCompressed(const char *src, int len) { #ifndef QT_NO_COMPRESS - if(do_compress) { + if (do_compress) { uLongf destLen = len + len/100 + 13; // zlib requirement Bytef* dest = new Bytef[destLen]; if (Z_OK == ::compress(dest, &destLen, (const Bytef*) src, (uLongf)len)) { @@ -2833,7 +2833,7 @@ int QPdfEnginePrivate::addImage(const QImage &img, bool *bitmap, bool lossless, return -1; int object = imageCache.value(serial_no); - if(object) + if (object) return object; QImage image = img; diff --git a/src/gui/painting/qtransform.cpp b/src/gui/painting/qtransform.cpp index 34dd425fef..8f2dc21a21 100644 --- a/src/gui/painting/qtransform.cpp +++ b/src/gui/painting/qtransform.cpp @@ -2033,7 +2033,7 @@ void QTransform::map(int x, int y, int *tx, int *ty) const */ QTransform::TransformationType QTransform::type() const { - if(m_dirty == TxNone || m_dirty < m_type) + if (m_dirty == TxNone || m_dirty < m_type) return static_cast<TransformationType>(m_type); switch (static_cast<TransformationType>(m_dirty)) { diff --git a/src/gui/text/qcssparser.cpp b/src/gui/text/qcssparser.cpp index 4dc6767cf4..9670568792 100644 --- a/src/gui/text/qcssparser.cpp +++ b/src/gui/text/qcssparser.cpp @@ -857,7 +857,7 @@ static BrushData parseBrushValue(const QCss::Value &v, const QPalette &pal) parser.next(); if (!parser.parseTerm(&color)) return BrushData(); ColorData cd = parseColorValue(color); - if(cd.type == ColorData::Role) + if (cd.type == ColorData::Role) dependsOnThePalette = true; stops.append(QGradientStop(stop.variant.toReal(), colorFromData(cd, pal))); } else { @@ -1467,7 +1467,7 @@ QColor Declaration::colorValue(const QPalette &pal) const } ColorData color = parseColorValue(d->values.at(0)); - if(color.type == ColorData::Role) { + if (color.type == ColorData::Role) { d->parsed = QVariant::fromValue<int>(color.role); return pal.color((QPalette::ColorRole)(color.role)); } else { @@ -1490,7 +1490,7 @@ QBrush Declaration::brushValue(const QPalette &pal) const BrushData data = parseBrushValue(d->values.at(0), pal); - if(data.type == BrushData::Role) { + if (data.type == BrushData::Role) { d->parsed = QVariant::fromValue<int>(data.role); return pal.color((QPalette::ColorRole)(data.role)); } else { @@ -1524,7 +1524,7 @@ void Declaration::brushValues(QBrush *c, const QPalette &pal) const if (!(needParse & (1<<i))) continue; BrushData data = parseBrushValue(d->values.at(i), pal); - if(data.type == BrushData::Role) { + if (data.type == BrushData::Role) { v += QVariant::fromValue<int>(data.role); c[i] = pal.color((QPalette::ColorRole)(data.role)); } else { @@ -1648,7 +1648,7 @@ void Declaration::colorValues(QColor *c, const QPalette &pal) const QList<QVariant> v; for (i = 0; i < qMin(d->values.count(), 4); i++) { ColorData color = parseColorValue(d->values.at(i)); - if(color.type == ColorData::Role) { + if (color.type == ColorData::Role) { v += QVariant::fromValue<int>(color.role); c[i] = pal.color((QPalette::ColorRole)(color.role)); } else { @@ -2104,7 +2104,7 @@ void StyleSelector::matchRule(NodePtr node, const StyleRule &rule, StyleSheetOri + selector.specificity() *0x100 + (uint(origin) + depth)*0x100000; StyleRule newRule = rule; - if(rule.selectors.count() > 1) { + if (rule.selectors.count() > 1) { newRule.selectors.resize(1); newRule.selectors[0] = selector; } diff --git a/src/gui/text/qfontengine.cpp b/src/gui/text/qfontengine.cpp index 6f3734e75c..470a04638e 100644 --- a/src/gui/text/qfontengine.cpp +++ b/src/gui/text/qfontengine.cpp @@ -1027,7 +1027,7 @@ static inline QFixed kerning(int left, int right, const QFontEngine::KernPair *p while (left <= right) { int middle = left + ( ( right - left ) >> 1 ); - if(pairs[middle].left_right == left_right) + if (pairs[middle].left_right == left_right) return pairs[middle].adjust; if (pairs[middle].left_right < left_right) @@ -1041,7 +1041,7 @@ static inline QFixed kerning(int left, int right, const QFontEngine::KernPair *p void QFontEngine::doKerning(QGlyphLayout *glyphs, QFontEngine::ShaperFlags flags) const { int numPairs = kerning_pairs.size(); - if(!numPairs) + if (!numPairs) return; const KernPair *pairs = kerning_pairs.constData(); @@ -1097,7 +1097,7 @@ void QFontEngine::loadKerningPairs(QFixed scalingFactor) goto end; // qDebug("subtable: version=%d, coverage=%x",version, coverage); - if(version == 0 && coverage == 0x0001) { + if (version == 0 && coverage == 0x0001) { if (offset + length > tab.size()) { // qDebug("length ouf ot bounds"); goto end; @@ -1108,7 +1108,7 @@ void QFontEngine::loadKerningPairs(QFixed scalingFactor) if (!qSafeFromBigEndian(data, end, &nPairs)) goto end; - if(nPairs * 6 + 8 > length - 6) { + if (nPairs * 6 + 8 > length - 6) { // qDebug("corrupt table!"); // corrupt table goto end; @@ -1250,7 +1250,7 @@ const uchar *QFontEngine::getCMap(const uchar *table, uint tableSize, bool *isSy break; } } - if(tableToUse < 0) + if (tableToUse < 0) return nullptr; resolveTable: @@ -1339,7 +1339,7 @@ quint32 QFontEngine::getTrueTypeGlyphIndex(const uchar *cmap, int cmapSize, uint Since 0xffff is never a valid Unicode char anyway, we just get rid of the issue by returning 0 for 0xffff */ - if(unicode >= 0xffff) + if (unicode >= 0xffff) return 0; quint16 segCountX2; @@ -1433,7 +1433,7 @@ quint32 QFontEngine::getTrueTypeGlyphIndex(const uchar *cmap, int cmapSize, uint if (!qSafeFromBigEndian(cmap + 12 * middle, end, &startCharCode)) return 0; - if(unicode < startCharCode) + if (unicode < startCharCode) right = middle - 1; else { quint32 endCharCode; diff --git a/src/gui/text/qtextcursor.cpp b/src/gui/text/qtextcursor.cpp index c579eca1ff..a27ef81500 100644 --- a/src/gui/text/qtextcursor.cpp +++ b/src/gui/text/qtextcursor.cpp @@ -2185,7 +2185,7 @@ QTextTable *QTextCursor::insertTable(int rows, int cols) */ QTextTable *QTextCursor::insertTable(int rows, int cols, const QTextTableFormat &format) { - if(!d || !d->priv || rows == 0 || cols == 0) + if (!d || !d->priv || rows == 0 || cols == 0) return nullptr; int pos = d->position; @@ -2205,7 +2205,7 @@ QTextTable *QTextCursor::insertTable(int rows, int cols, const QTextTableFormat */ QTextTable *QTextCursor::currentTable() const { - if(!d || !d->priv) + if (!d || !d->priv) return nullptr; QTextFrame *frame = d->priv->frameAt(d->position); @@ -2242,7 +2242,7 @@ QTextFrame *QTextCursor::insertFrame(const QTextFrameFormat &format) */ QTextFrame *QTextCursor::currentFrame() const { - if(!d || !d->priv) + if (!d || !d->priv) return nullptr; return d->priv->frameAt(d->position); diff --git a/src/gui/text/qtextdocumentfragment.cpp b/src/gui/text/qtextdocumentfragment.cpp index 6e7c5f1ed9..2d1f9ec161 100644 --- a/src/gui/text/qtextdocumentfragment.cpp +++ b/src/gui/text/qtextdocumentfragment.cpp @@ -561,7 +561,7 @@ bool QTextHtmlImporter::appendNodeText() const int initialCursorPosition = cursor.position(); QTextCharFormat format = currentNode->charFormat; - if(wsm == QTextHtmlParserNode::WhiteSpacePre || wsm == QTextHtmlParserNode::WhiteSpacePreWrap) + if (wsm == QTextHtmlParserNode::WhiteSpacePre || wsm == QTextHtmlParserNode::WhiteSpacePreWrap) compressNextWhitespace = PreserveWhiteSpace; QString text = currentNode->text; @@ -581,7 +581,7 @@ bool QTextHtmlImporter::appendNodeText() if (compressNextWhitespace == CollapseWhiteSpace) compressNextWhitespace = RemoveWhiteSpace; // allow this one, and remove the ones coming next. - else if(compressNextWhitespace == RemoveWhiteSpace) + else if (compressNextWhitespace == RemoveWhiteSpace) continue; if (wsm == QTextHtmlParserNode::WhiteSpacePre diff --git a/src/gui/text/qtextdocumentlayout.cpp b/src/gui/text/qtextdocumentlayout.cpp index 8ea3a655b7..7a46ae4ce9 100644 --- a/src/gui/text/qtextdocumentlayout.cpp +++ b/src/gui/text/qtextdocumentlayout.cpp @@ -3719,7 +3719,7 @@ void QTextDocumentLayout::draw(QPainter *painter, const PaintContext &context) QTextFrame *frame = d->document->rootFrame(); QTextFrameData *fd = data(frame); - if(fd->sizeDirty) + if (fd->sizeDirty) return; if (context.clip.isValid()) { @@ -3850,7 +3850,7 @@ QRectF QTextDocumentLayout::doLayout(int from, int oldLength, int length) QRectF updateRect; QTextFrame *root = d->docPrivate->rootFrame(); - if(data(root)->sizeDirty) + if (data(root)->sizeDirty) updateRect = d->layoutFrame(root, from, from + length); data(root)->layoutDirty = false; diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp index 21670b8d4c..d3a28d8d02 100644 --- a/src/gui/text/qtextengine.cpp +++ b/src/gui/text/qtextengine.cpp @@ -86,9 +86,9 @@ public: { if (caps == QFont::SmallCaps) generateScriptItemsSmallCaps(reinterpret_cast<const ushort *>(m_string.unicode()), start, length); - else if(caps == QFont::Capitalize) + else if (caps == QFont::Capitalize) generateScriptItemsCapitalize(start, length); - else if(caps != QFont::MixedCase) { + else if (caps != QFont::MixedCase) { generateScriptItemsAndChangeCase(start, length, caps == QFont::AllLowercase ? QScriptAnalysis::Lowercase : QScriptAnalysis::Uppercase); } @@ -1192,7 +1192,7 @@ void QTextEngine::bidiReorder(int numItems, const quint8 *levels, int *visualOrd // reverse any contiguous sequence of characters that are at that level or higher. // reversing is only done up to the lowest odd level - if(!(levelLow%2)) levelLow++; + if (!(levelLow%2)) levelLow++; BIDI_DEBUG() << "reorderLine: lineLow = " << (uint)levelLow << ", lineHigh = " << (uint)levelHigh; @@ -1208,7 +1208,7 @@ void QTextEngine::bidiReorder(int numItems, const quint8 *levels, int *visualOrd while(i <= count && levels[i] >= levelHigh) i++; int end = i-1; - if(start != end) { + if (start != end) { //qDebug() << "reversing from " << start << " to " << end; for(int j = 0; j < (end-start+1)/2; j++) { int tmp = visualOrder[start+j]; diff --git a/src/gui/text/qtextformat.cpp b/src/gui/text/qtextformat.cpp index 1413b1ab29..e113fad8fa 100644 --- a/src/gui/text/qtextformat.cpp +++ b/src/gui/text/qtextformat.cpp @@ -474,7 +474,7 @@ Q_GUI_EXPORT QDataStream &operator>>(QDataStream &stream, QTextFormat &fmt) // QTextFormat's default constructor doesn't allocate the private structure, so // we have to do this, in case fmt is a default constructed value. - if(!fmt.d) + if (!fmt.d) fmt.d = new QTextFormatPrivate(); for (QMap<qint32, QVariant>::ConstIterator it = properties.constBegin(); @@ -2206,7 +2206,7 @@ void QTextBlockFormat::setTabPositions(const QList<QTextOption::Tab> &tabs) QList<QTextOption::Tab> QTextBlockFormat::tabPositions() const { QVariant variant = property(TabPositions); - if(variant.isNull()) + if (variant.isNull()) return QList<QTextOption::Tab>(); QList<QTextOption::Tab> answer; QList<QVariant> variantsList = qvariant_cast<QList<QVariant> >(variant); diff --git a/src/gui/text/windows/qwindowsfontengine.cpp b/src/gui/text/windows/qwindowsfontengine.cpp index b2855d19dd..a8dba8b1f2 100644 --- a/src/gui/text/windows/qwindowsfontengine.cpp +++ b/src/gui/text/windows/qwindowsfontengine.cpp @@ -105,7 +105,7 @@ static void resolveGetCharWidthI() QFixed QWindowsFontEngine::lineThickness() const { - if(lineWidth > 0) + if (lineWidth > 0) return lineWidth; return QFontEngine::lineThickness(); @@ -160,7 +160,7 @@ void QWindowsFontEngine::getCMap() symbol = symb; designToDevice = 1; _faceId.index = 0; - if(cmap) { + if (cmap) { OUTLINETEXTMETRIC *otm = getOutlineTextMetric(hdc); unitsPerEm = int(otm->otmEMSquare); const QFixed unitsPerEmF(unitsPerEm); @@ -186,7 +186,7 @@ int QWindowsFontEngine::getGlyphIndexes(const QChar *str, int numChars, QGlyphLa while (it.hasNext()) { const uint uc = it.next(); glyphs->glyphs[glyph_pos] = getTrueTypeGlyphIndex(cmap, cmapSize, uc); - if(!glyphs->glyphs[glyph_pos] && uc < 0x100) + if (!glyphs->glyphs[glyph_pos] && uc < 0x100) glyphs->glyphs[glyph_pos] = getTrueTypeGlyphIndex(cmap, cmapSize, uc + 0xf000); ++glyph_pos; } @@ -337,7 +337,7 @@ void QWindowsFontEngine::recalcAdvances(QGlyphLayout *glyphs, QFontEngine::Shape if (ttf && (flags & DesignMetrics)) { for(int i = 0; i < glyphs->numGlyphs; i++) { unsigned int glyph = glyphs->glyphs[i]; - if(int(glyph) >= designAdvancesSize) { + if (int(glyph) >= designAdvancesSize) { const int newSize = int(glyph + 256) >> 8 << 8; designAdvances = reinterpret_cast<QFixed *>(realloc(designAdvances, size_t(newSize) * sizeof(QFixed))); Q_CHECK_PTR(designAdvances); @@ -355,7 +355,7 @@ void QWindowsFontEngine::recalcAdvances(QGlyphLayout *glyphs, QFontEngine::Shape } glyphs->advances[i] = designAdvances[glyph]; } - if(oldFont) + if (oldFont) DeleteObject(SelectObject(hdc, oldFont)); } else { for(int i = 0; i < glyphs->numGlyphs; i++) { @@ -546,7 +546,7 @@ QFixed QWindowsFontEngine::capHeight() const QFixed QWindowsFontEngine::xHeight() const { - if(x_height >= 0) + if (x_height >= 0) return x_height; return QFontEngine::xHeight(); } @@ -837,7 +837,7 @@ void QWindowsFontEngine::addGlyphsToPath(glyph_t *glyphs, QFixedPoint *positions void QWindowsFontEngine::addOutlineToPath(qreal x, qreal y, const QGlyphLayout &glyphs, QPainterPath *path, QTextItem::RenderFlags flags) { - if(tm.tmPitchAndFamily & (TMPF_TRUETYPE | TMPF_VECTOR)) { + if (tm.tmPitchAndFamily & (TMPF_TRUETYPE | TMPF_VECTOR)) { hasOutline = true; QFontEngine::addOutlineToPath(x, y, glyphs, path, flags); if (hasOutline) { @@ -861,9 +861,9 @@ QT_END_INCLUDE_NAMESPACE int QWindowsFontEngine::synthesized() const { - if(synthesized_flags == -1) { + if (synthesized_flags == -1) { synthesized_flags = 0; - if(ttf) { + if (ttf) { const DWORD HEAD = MAKE_LITTLE_ENDIAN_TAG('h', 'e', 'a', 'd'); HDC hdc = m_fontEngineData->hdc; SelectObject(hdc, hfont); @@ -920,7 +920,7 @@ void QWindowsFontEngine::getUnscaledGlyph(glyph_t glyph, QPainterPath *path, gly LOGFONT lf = m_logfont; lf.lfHeight = -unitsPerEm; int flags = synthesized(); - if(flags & SynthesizedItalic) + if (flags & SynthesizedItalic) lf.lfItalic = false; lf.lfWidth = 0; HFONT hf = CreateFontIndirect(&lf); diff --git a/src/network/kernel/qauthenticator.cpp b/src/network/kernel/qauthenticator.cpp index 86242b011f..c433b700ea 100644 --- a/src/network/kernel/qauthenticator.cpp +++ b/src/network/kernel/qauthenticator.cpp @@ -1228,7 +1228,7 @@ QByteArray qEncodeHmacMd5(QByteArray &key, const QByteArray &message) hash.reset(); // Adjust the key length to blockSize - if(blockSize < key.length()) { + if (blockSize < key.length()) { hash.addData(key); key = hash.result(); //MD5 will always return 16 bytes length output } @@ -1280,7 +1280,7 @@ static QByteArray qCreatev2Hash(const QAuthenticatorPrivate *ctx, Q_ASSERT(phase3 != nullptr); // since v2 Hash is need for both NTLMv2 and LMv2 it is calculated // only once and stored and reused - if(phase3->v2Hash.size() == 0) { + if (phase3->v2Hash.size() == 0) { QCryptographicHash md4(QCryptographicHash::Md4); QByteArray passUnicode = qStringAsUcs2Le(ctx->password); md4.addData(passUnicode.data(), passUnicode.size()); @@ -1317,7 +1317,7 @@ static QByteArray qExtractServerTime(const QByteArray& targetInfoBuff) ds >> avId; ds >> avLen; while(avId != 0) { - if(avId == AVTIMESTAMP) { + if (avId == AVTIMESTAMP) { timeArray.resize(avLen); //avLen size of QByteArray is allocated ds.readRawData(timeArray.data(), avLen); @@ -1352,13 +1352,13 @@ static QByteArray qEncodeNtlmv2Response(const QAuthenticatorPrivate *ctx, quint64 time = 0; QByteArray timeArray; - if(ch.targetInfo.len) + if (ch.targetInfo.len) { timeArray = qExtractServerTime(ch.targetInfoBuff); } //if server sends time, use it instead of current time - if(timeArray.size()) { + if (timeArray.size()) { ds.writeRawData(timeArray.constData(), timeArray.size()); } else { // number of seconds between 1601 and the epoch (1970) diff --git a/src/network/socket/qlocalserver_unix.cpp b/src/network/socket/qlocalserver_unix.cpp index c4085b440e..ea7e8e1e0e 100644 --- a/src/network/socket/qlocalserver_unix.cpp +++ b/src/network/socket/qlocalserver_unix.cpp @@ -135,10 +135,10 @@ bool QLocalServerPrivate::listen(const QString &requestedServerName) } // bind - if(-1 == QT_SOCKET_BIND(listenSocket, (sockaddr *)&addr, sizeof(sockaddr_un))) { + if (-1 == QT_SOCKET_BIND(listenSocket, (sockaddr *)&addr, sizeof(sockaddr_un))) { setError(QLatin1String("QLocalServer::listen")); // if address is in use already, just close the socket, but do not delete the file - if(errno == EADDRINUSE) + if (errno == EADDRINUSE) QT_CLOSE(listenSocket); // otherwise, close the socket and delete the file else @@ -269,7 +269,7 @@ void QLocalServerPrivate::_q_onNewConnection() ::sockaddr_un addr; QT_SOCKLEN_T length = sizeof(sockaddr_un); int connectedSocket = qt_safe_accept(listenSocket, (sockaddr *)&addr, &length); - if(-1 == connectedSocket) { + if (-1 == connectedSocket) { setError(QLatin1String("QLocalSocket::activated")); closeServer(); } else { diff --git a/src/network/socket/qnativesocketengine.cpp b/src/network/socket/qnativesocketengine.cpp index 6667a6b097..302b714cb4 100644 --- a/src/network/socket/qnativesocketengine.cpp +++ b/src/network/socket/qnativesocketengine.cpp @@ -972,7 +972,7 @@ void QNativeSocketEngine::close() if (d->exceptNotifier) d->exceptNotifier->setEnabled(false); - if(d->socketDescriptor != -1) { + if (d->socketDescriptor != -1) { d->nativeClose(); d->socketDescriptor = -1; } diff --git a/src/plugins/imageformats/jpeg/qjpeghandler.cpp b/src/plugins/imageformats/jpeg/qjpeghandler.cpp index 29bf5ab589..beef18f260 100644 --- a/src/plugins/imageformats/jpeg/qjpeghandler.cpp +++ b/src/plugins/imageformats/jpeg/qjpeghandler.cpp @@ -334,7 +334,7 @@ static bool read_jpeg_image(QImage *outImage, } // If high quality not required, use fast decompression - if( quality < HIGH_QUALITY_THRESHOLD ) { + if ( quality < HIGH_QUALITY_THRESHOLD ) { info->dct_method = JDCT_IFAST; info->do_fancy_upsampling = FALSE; } @@ -758,7 +758,7 @@ public: ~QJpegHandlerPrivate() { - if(iod_src) + if (iod_src) { jpeg_destroy_decompress(&info); delete iod_src; @@ -926,7 +926,7 @@ static QImageIOHandler::Transformations exif2Qt(int exifOrientation) */ bool QJpegHandlerPrivate::readJpegHeader(QIODevice *device) { - if(state == Ready) + if (state == Ready) { state = Error; iod_src = new my_jpeg_source_mgr(device); @@ -998,17 +998,17 @@ bool QJpegHandlerPrivate::readJpegHeader(QIODevice *device) return false; } } - else if(state == Error) + else if (state == Error) return false; return true; } bool QJpegHandlerPrivate::read(QImage *image) { - if(state == Ready) + if (state == Ready) readJpegHeader(q->device()); - if(state == ReadHeader) + if (state == ReadHeader) { bool success = read_jpeg_image(image, scaledSize, scaledClipRect, clipRect, quality, rgb888ToRgb32ConverterPtr, &info, &err); if (success) { @@ -1061,7 +1061,7 @@ QJpegHandler::~QJpegHandler() bool QJpegHandler::canRead() const { - if(d->state == QJpegHandlerPrivate::Ready && !canRead(device())) + if (d->state == QJpegHandlerPrivate::Ready && !canRead(device())) return false; if (d->state != QJpegHandlerPrivate::Error && d->state != QJpegHandlerPrivate::ReadingEnd) { diff --git a/src/plugins/platforminputcontexts/ibus/qibusplatforminputcontext.cpp b/src/plugins/platforminputcontexts/ibus/qibusplatforminputcontext.cpp index c50f03de05..7f8a0ea47b 100644 --- a/src/plugins/platforminputcontexts/ibus/qibusplatforminputcontext.cpp +++ b/src/plugins/platforminputcontexts/ibus/qibusplatforminputcontext.cpp @@ -248,7 +248,7 @@ void QIBusPlatformInputContext::cursorRectChanged() return; QRect r = qApp->inputMethod()->cursorRectangle().toRect(); - if(!r.isValid()) + if (!r.isValid()) return; QWindow *inputWindow = qApp->focusWindow(); diff --git a/src/plugins/platforms/windows/qwindowsmime.cpp b/src/plugins/platforms/windows/qwindowsmime.cpp index 49bbe88d34..95c9a890ef 100644 --- a/src/plugins/platforms/windows/qwindowsmime.cpp +++ b/src/plugins/platforms/windows/qwindowsmime.cpp @@ -1444,7 +1444,7 @@ QString QLastResortMimes::mimeForFormat(const FORMATETC &formatetc) const #if QT_CONFIG(draganddrop) if (QInternalMimeData::canReadData(clipFormat)) format = clipFormat; - else if((formatetc.cfFormat >= 0xC000)){ + else if ((formatetc.cfFormat >= 0xC000)){ //create the mime as custom. not registered. if (!excludeList.contains(clipFormat, Qt::CaseInsensitive)) { //check if this is a mime type diff --git a/src/plugins/sqldrivers/db2/qsql_db2.cpp b/src/plugins/sqldrivers/db2/qsql_db2.cpp index 0e1ff6f2fc..e819d0ea86 100644 --- a/src/plugins/sqldrivers/db2/qsql_db2.cpp +++ b/src/plugins/sqldrivers/db2/qsql_db2.cpp @@ -992,7 +992,7 @@ bool QDB2Result::fetchFirst() SQL_FETCH_FIRST, 0); if (r != SQL_SUCCESS && r != SQL_SUCCESS_WITH_INFO) { - if(r!= SQL_NO_DATA) + if (r!= SQL_NO_DATA) setLastError(qMakeError(QCoreApplication::translate("QDB2Result", "Unable to fetch first"), QSqlError::StatementError, d)); return false; @@ -1735,7 +1735,7 @@ QVariant QDB2Driver::handle() const QString QDB2Driver::escapeIdentifier(const QString &identifier, IdentifierType) const { QString res = identifier; - if(!identifier.isEmpty() && !identifier.startsWith(QLatin1Char('"')) && !identifier.endsWith(QLatin1Char('"')) ) { + if (!identifier.isEmpty() && !identifier.startsWith(QLatin1Char('"')) && !identifier.endsWith(QLatin1Char('"')) ) { res.replace(QLatin1Char('"'), QLatin1String("\"\"")); res.prepend(QLatin1Char('"')).append(QLatin1Char('"')); res.replace(QLatin1Char('.'), QLatin1String("\".\"")); diff --git a/src/plugins/sqldrivers/ibase/qsql_ibase.cpp b/src/plugins/sqldrivers/ibase/qsql_ibase.cpp index b61c41735b..82ea0919a5 100644 --- a/src/plugins/sqldrivers/ibase/qsql_ibase.cpp +++ b/src/plugins/sqldrivers/ibase/qsql_ibase.cpp @@ -80,7 +80,7 @@ static bool getIBaseError(QString& msg, const ISC_STATUS* status, ISC_LONG &sqlc sqlcode = isc_sqlcode(status); char buf[512]; while(fb_interpret(buf, 512, &status)) { - if(!msg.isEmpty()) + if (!msg.isEmpty()) msg += QLatin1String(" - "); msg += QString::fromUtf8(buf); } @@ -1358,7 +1358,7 @@ QSqlRecord QIBaseResult::record() const f.setLength(v.sqllen); f.setPrecision(qAbs(v.sqlscale)); f.setRequiredStatus((v.sqltype & 1) == 0 ? QSqlField::Required : QSqlField::Optional); - if(v.sqlscale < 0) { + if (v.sqlscale < 0) { QSqlQuery q(driver()->createResult()); q.setForwardOnly(true); q.exec(QLatin1String("select b.RDB$FIELD_PRECISION, b.RDB$FIELD_SCALE, b.RDB$FIELD_LENGTH, a.RDB$NULL_FLAG " @@ -1366,8 +1366,8 @@ QSqlRecord QIBaseResult::record() const "WHERE b.RDB$FIELD_NAME = a.RDB$FIELD_SOURCE " "AND a.RDB$RELATION_NAME = '") + QString::fromLatin1(v.relname, v.relname_length) + QLatin1String("' " "AND a.RDB$FIELD_NAME = '") + QString::fromLatin1(v.sqlname, v.sqlname_length) + QLatin1String("' ")); - if(q.first()) { - if(v.sqlscale < 0) { + if (q.first()) { + if (v.sqlscale < 0) { f.setLength(q.value(0).toInt()); f.setPrecision(qAbs(q.value(1).toInt())); } else { @@ -1642,7 +1642,7 @@ QSqlRecord QIBaseDriver::record(const QString& tablename) const int type = q.value(1).toInt(); bool hasScale = q.value(3).toInt() < 0; QSqlField f(q.value(0).toString().simplified(), qIBaseTypeName(type, hasScale), tablename); - if(hasScale) { + if (hasScale) { f.setLength(q.value(4).toInt()); f.setPrecision(qAbs(q.value(3).toInt())); } else { @@ -1883,7 +1883,7 @@ void QIBaseDriver::qHandleEventNotification(void *updatedResultBuffer) QString QIBaseDriver::escapeIdentifier(const QString &identifier, IdentifierType) const { QString res = identifier; - if(!identifier.isEmpty() && !identifier.startsWith(QLatin1Char('"')) && !identifier.endsWith(QLatin1Char('"')) ) { + if (!identifier.isEmpty() && !identifier.startsWith(QLatin1Char('"')) && !identifier.endsWith(QLatin1Char('"')) ) { res.replace(QLatin1Char('"'), QLatin1String("\"\"")); res.prepend(QLatin1Char('"')).append(QLatin1Char('"')); res.replace(QLatin1Char('.'), QLatin1String("\".\"")); diff --git a/src/plugins/sqldrivers/mysql/qsql_mysql.cpp b/src/plugins/sqldrivers/mysql/qsql_mysql.cpp index 733e949a98..04a2df9ac5 100644 --- a/src/plugins/sqldrivers/mysql/qsql_mysql.cpp +++ b/src/plugins/sqldrivers/mysql/qsql_mysql.cpp @@ -379,7 +379,7 @@ QMYSQLResult::~QMYSQLResult() QVariant QMYSQLResult::handle() const { Q_D(const QMYSQLResult); - if(d->preparedQuery) + if (d->preparedQuery) return d->meta ? QVariant::fromValue(d->meta) : QVariant::fromValue(d->stmt); else return QVariant::fromValue(d->result); @@ -600,7 +600,7 @@ QVariant QMYSQLResult::data(int field) ok = true; break; } - if(ok) + if (ok) return v; return QVariant(); } @@ -1371,7 +1371,7 @@ QSqlRecord QMYSQLDriver::record(const QString& tablename) const { Q_D(const QMYSQLDriver); QString table=tablename; - if(isIdentifierEscaped(table, QSqlDriver::TableName)) + if (isIdentifierEscaped(table, QSqlDriver::TableName)) table = stripDelimiters(table, QSqlDriver::TableName); QSqlRecord info; @@ -1481,7 +1481,7 @@ QString QMYSQLDriver::formatValue(const QSqlField &field, bool trimStrings) cons QString QMYSQLDriver::escapeIdentifier(const QString &identifier, IdentifierType) const { QString res = identifier; - if(!identifier.isEmpty() && !identifier.startsWith(QLatin1Char('`')) && !identifier.endsWith(QLatin1Char('`')) ) { + if (!identifier.isEmpty() && !identifier.startsWith(QLatin1Char('`')) && !identifier.endsWith(QLatin1Char('`')) ) { res.prepend(QLatin1Char('`')).append(QLatin1Char('`')); res.replace(QLatin1Char('.'), QLatin1String("`.`")); } diff --git a/src/plugins/sqldrivers/oci/qsql_oci.cpp b/src/plugins/sqldrivers/oci/qsql_oci.cpp index 28b419e6a1..9659427c7c 100644 --- a/src/plugins/sqldrivers/oci/qsql_oci.cpp +++ b/src/plugins/sqldrivers/oci/qsql_oci.cpp @@ -1432,7 +1432,7 @@ bool QOCICols::execBatch(QOCIResultPrivate *d, QVariantList &boundValues, bool a col.bindAs = SQLT_STR; for (uint j = 0; j < col.recordCount; ++j) { uint len; - if(d->isOutValue(i)) + if (d->isOutValue(i)) len = boundValues.at(i).toList().at(j).toString().capacity() + 1; else len = boundValues.at(i).toList().at(j).toString().length() + 1; @@ -1807,7 +1807,7 @@ void QOCICols::getValues(QVariantList &v, int index) qint64 qll = 0; int r = OCINumberToInt(d->err, reinterpret_cast<OCINumber *>(fld.data), sizeof(qint64), OCI_NUMBER_SIGNED, &qll); - if(r == OCI_SUCCESS) + if (r == OCI_SUCCESS) v[index + i] = qll; else v[index + i] = QVariant(); @@ -2762,7 +2762,7 @@ QVariant QOCIDriver::handle() const QString QOCIDriver::escapeIdentifier(const QString &identifier, IdentifierType type) const { QString res = identifier; - if(!identifier.isEmpty() && !isIdentifierEscaped(identifier, type)) { + if (!identifier.isEmpty() && !isIdentifierEscaped(identifier, type)) { res.replace(QLatin1Char('"'), QLatin1String("\"\"")); res.prepend(QLatin1Char('"')).append(QLatin1Char('"')); res.replace(QLatin1Char('.'), QLatin1String("\".\"")); diff --git a/src/plugins/sqldrivers/odbc/qsql_odbc.cpp b/src/plugins/sqldrivers/odbc/qsql_odbc.cpp index 27766c6a95..dd6eaab9cf 100644 --- a/src/plugins/sqldrivers/odbc/qsql_odbc.cpp +++ b/src/plugins/sqldrivers/odbc/qsql_odbc.cpp @@ -74,7 +74,7 @@ inline static QString fromSQLTCHAR(const QVarLengthArray<SQLTCHAR>& input, qsize // Remove any trailing \0 as some drivers misguidedly append one int realsize = qMin(size, input.size()); - if(realsize > 0 && input[realsize-1] == 0) + if (realsize > 0 && input[realsize-1] == 0) realsize--; switch(sizeof(SQLTCHAR)) { case 1: @@ -261,8 +261,8 @@ static QString qWarnODBCHandle(int handleType, SQLHANDLE handle, int *nativeCode if (nativeCode) *nativeCode = nativeCode_; const QString tmpstore = fromSQLTCHAR(description_, msgLen); - if(result != tmpstore) { - if(!result.isEmpty()) + if (result != tmpstore) { + if (!result.isEmpty()) result += QLatin1Char(' '); result += tmpstore; } @@ -414,7 +414,7 @@ static QString qGetStringData(SQLHANDLE hStmt, int column, int colSize, bool uni } else { colSize++; // make sure there is room for more than the 0 termination } - if(unicode) { + if (unicode) { r = SQLGetData(hStmt, column+1, SQL_C_TCHAR, @@ -603,7 +603,7 @@ static QVariant qGetDoubleData(SQLHANDLE hStmt, int column) if (r != SQL_SUCCESS && r != SQL_SUCCESS_WITH_INFO) { return QVariant(); } - if(lengthIndicator == SQL_NULL_DATA) + if (lengthIndicator == SQL_NULL_DATA) return QVariant(QMetaType::fromType<double>()); return (double) dblbuf; @@ -1033,7 +1033,7 @@ bool QODBCResult::reset (const QString& query) SQLULEN isScrollable = 0; r = SQLGetStmtAttr(d->hStmt, SQL_ATTR_CURSOR_SCROLLABLE, &isScrollable, SQL_IS_INTEGER, 0); - if(r == SQL_SUCCESS || r == SQL_SUCCESS_WITH_INFO) + if (r == SQL_SUCCESS || r == SQL_SUCCESS_WITH_INFO) setForwardOnly(isScrollable == SQL_NONSCROLLABLE); SQLSMALLINT count = 0; @@ -1667,7 +1667,7 @@ bool QODBCResult::exec() SQLULEN isScrollable = 0; r = SQLGetStmtAttr(d->hStmt, SQL_ATTR_CURSOR_SCROLLABLE, &isScrollable, SQL_IS_INTEGER, 0); - if(r == SQL_SUCCESS || r == SQL_SUCCESS_WITH_INFO) + if (r == SQL_SUCCESS || r == SQL_SUCCESS_WITH_INFO) setForwardOnly(isScrollable == SQL_NONSCROLLABLE); SQLSMALLINT count = 0; @@ -2017,7 +2017,7 @@ void QODBCDriver::cleanup() Q_D(QODBCDriver); SQLRETURN r; - if(d->hDbc) { + if (d->hDbc) { // Open statements/descriptors handles are automatically cleaned up by SQLDisconnect if (isOpen()) { r = SQLDisconnect(d->hDbc); @@ -2084,12 +2084,12 @@ void QODBCDriverPrivate::checkUnicode() &hStmt); r = SQLExecDirect(hStmt, toSQLTCHAR(QLatin1String("select 'test'")).data(), SQL_NTS); - if(r == SQL_SUCCESS) { + if (r == SQL_SUCCESS) { r = SQLFetch(hStmt); - if(r == SQL_SUCCESS) { + if (r == SQL_SUCCESS) { QVarLengthArray<SQLWCHAR> buffer(10); r = SQLGetData(hStmt, 1, SQL_C_WCHAR, buffer.data(), buffer.size() * sizeof(SQLWCHAR), NULL); - if(r == SQL_SUCCESS && fromSQLTCHAR(buffer) == QLatin1String("test")) { + if (r == SQL_SUCCESS && fromSQLTCHAR(buffer) == QLatin1String("test")) { unicode = true; } } @@ -2626,7 +2626,7 @@ QString QODBCDriver::escapeIdentifier(const QString &identifier, IdentifierType) Q_D(const QODBCDriver); QChar quote = const_cast<QODBCDriverPrivate*>(d)->quoteChar(); QString res = identifier; - if(!identifier.isEmpty() && !identifier.startsWith(quote) && !identifier.endsWith(quote) ) { + if (!identifier.isEmpty() && !identifier.startsWith(quote) && !identifier.endsWith(quote) ) { res.replace(quote, QString(quote)+QString(quote)); res.prepend(quote).append(quote); res.replace(QLatin1Char('.'), QString(quote)+QLatin1Char('.')+QString(quote)); diff --git a/src/plugins/sqldrivers/sqlite/qsql_sqlite.cpp b/src/plugins/sqldrivers/sqlite/qsql_sqlite.cpp index d6a0f319f9..4f70728d73 100644 --- a/src/plugins/sqldrivers/sqlite/qsql_sqlite.cpp +++ b/src/plugins/sqldrivers/sqlite/qsql_sqlite.cpp @@ -262,7 +262,7 @@ bool QSQLiteResultPrivate::fetchNext(QSqlCachedResult::ValueCache &values, int i } skipRow = initialFetch; - if(initialFetch) { + if (initialFetch) { firstRow.clear(); firstRow.resize(sqlite3_column_count(stmt)); } diff --git a/src/plugins/styles/mac/qmacstyle_mac.mm b/src/plugins/styles/mac/qmacstyle_mac.mm index 8c3c6f4413..cc8ecef1fa 100644 --- a/src/plugins/styles/mac/qmacstyle_mac.mm +++ b/src/plugins/styles/mac/qmacstyle_mac.mm @@ -976,7 +976,7 @@ static QSize qt_aqua_get_known_size(QStyle::ContentsType ct, const QStyleOption #if QT_CONFIG(toolbutton) const QStyleOptionToolButton *bt = qstyleoption_cast<const QStyleOptionToolButton *>(opt); // If this conversion fails then the widget was not what it claimed to be. - if(bt) { + if (bt) { if (!bt->icon.isNull()) { QSize iconSize = bt->iconSize; QSize pmSize = bt->icon.actualSize(QSize(32, 32), QIcon::Normal); @@ -1014,7 +1014,7 @@ static QSize qt_aqua_get_known_size(QStyle::ContentsType ct, const QStyleOption int w = -1; const QStyleOptionSlider *sld = qstyleoption_cast<const QStyleOptionSlider *>(opt); // If this conversion fails then the widget was not what it claimed to be. - if(sld) { + if (sld) { if (sz == QStyleHelper::SizeLarge) { if (sld->orientation == Qt::Horizontal) { w = qt_mac_aqua_get_metric(HSliderHeight); @@ -2708,7 +2708,7 @@ int QMacStyle::styleHint(StyleHint sh, const QStyleOption *opt, const QWidget *w break; case SH_FocusFrame_Mask: { ret = true; - if(QStyleHintReturnMask *mask = qstyleoption_cast<QStyleHintReturnMask*>(hret)) { + if (QStyleHintReturnMask *mask = qstyleoption_cast<QStyleHintReturnMask*>(hret)) { const uchar fillR = 192, fillG = 191, fillB = 190; QImage img; @@ -6508,7 +6508,7 @@ QSize QMacStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt, void QMacStyle::drawItemText(QPainter *p, const QRect &r, int flags, const QPalette &pal, bool enabled, const QString &text, QPalette::ColorRole textRole) const { - if(flags & Qt::TextShowMnemonic) + if (flags & Qt::TextShowMnemonic) flags |= Qt::TextHideMnemonic; QCommonStyle::drawItemText(p, r, flags, pal, enabled, text, textRole); } @@ -6516,7 +6516,7 @@ void QMacStyle::drawItemText(QPainter *p, const QRect &r, int flags, const QPale bool QMacStyle::event(QEvent *e) { Q_D(QMacStyle); - if(e->type() == QEvent::FocusIn) { + if (e->type() == QEvent::FocusIn) { QWidget *f = nullptr; QWidget *focusWidget = QApplication::focusWidget(); #if QT_CONFIG(graphicsview) @@ -6539,14 +6539,14 @@ bool QMacStyle::event(QEvent *e) f = focusWidget; } if (f) { - if(!d->focusWidget) + if (!d->focusWidget) d->focusWidget = new QFocusFrame(f); d->focusWidget->setWidget(f); - } else if(d->focusWidget) { + } else if (d->focusWidget) { d->focusWidget->setWidget(0); } - } else if(e->type() == QEvent::FocusOut) { - if(d->focusWidget) + } else if (e->type() == QEvent::FocusOut) { + if (d->focusWidget) d->focusWidget->setWidget(0); } return false; diff --git a/src/plugins/styles/windowsvista/qwindowsvistastyle.cpp b/src/plugins/styles/windowsvista/qwindowsvistastyle.cpp index 906e654e6d..af1c17fa9b 100644 --- a/src/plugins/styles/windowsvista/qwindowsvistastyle.cpp +++ b/src/plugins/styles/windowsvista/qwindowsvistastyle.cpp @@ -542,7 +542,7 @@ void QWindowsVistaStyle::drawPrimitive(PrimitiveElement element, const QStyleOpt } int bgType; GetThemeEnumValue(theme.handle(), partId, stateId, TMT_BGTYPE, &bgType); - if( bgType == BT_IMAGEFILE ) { + if ( bgType == BT_IMAGEFILE ) { d->drawBackground(theme); } else { QBrush fillColor = option->palette.brush(QPalette::Base); diff --git a/src/plugins/styles/windowsvista/qwindowsxpstyle.cpp b/src/plugins/styles/windowsvista/qwindowsxpstyle.cpp index 67d3e1053f..a7aab71cee 100644 --- a/src/plugins/styles/windowsvista/qwindowsxpstyle.cpp +++ b/src/plugins/styles/windowsvista/qwindowsxpstyle.cpp @@ -247,14 +247,14 @@ void QWindowsXPStylePrivate::init(bool force) */ void QWindowsXPStylePrivate::cleanup(bool force) { - if(bufferBitmap) { + if (bufferBitmap) { if (bufferDC && nullBitmap) SelectObject(bufferDC, nullBitmap); DeleteObject(bufferBitmap); bufferBitmap = nullptr; } - if(bufferDC) + if (bufferDC) DeleteDC(bufferDC); bufferDC = nullptr; @@ -1618,7 +1618,7 @@ case PE_Frame: p->drawLine(option->rect.x()+2, option->rect.y()+2, option->rect.x()+6, option->rect.y()+2); p->drawLine(option->rect.x()+3, option->rect.y()+3, option->rect.x()+5, option->rect.y()+3); p->drawPoint(option->rect.x()+4, option->rect.y()+4); - } else if(header->sortIndicator & QStyleOptionHeader::SortDown) { + } else if (header->sortIndicator & QStyleOptionHeader::SortDown) { p->drawLine(option->rect.x(), option->rect.y()+4, option->rect.x()+8, option->rect.y()+4); p->drawLine(option->rect.x()+1, option->rect.y()+3, option->rect.x()+7, option->rect.y()+3); p->drawLine(option->rect.x()+2, option->rect.y()+2, option->rect.x()+6, option->rect.y()+2); diff --git a/src/printsupport/platform/windows/qprintengine_win.cpp b/src/printsupport/platform/windows/qprintengine_win.cpp index fea8c12e65..3d4a0cfd7a 100644 --- a/src/printsupport/platform/windows/qprintengine_win.cpp +++ b/src/printsupport/platform/windows/qprintengine_win.cpp @@ -376,9 +376,9 @@ int QWin32PrintEngine::metric(QPaintDevice::PaintDeviceMetric m) const case QPaintDevice::PdmNumColors: { int bpp = GetDeviceCaps(d->hdc, BITSPIXEL); - if(bpp==32) + if (bpp==32) val = INT_MAX; - else if(bpp<=8) + else if (bpp<=8) val = GetDeviceCaps(d->hdc, NUMCOLORS); else val = 1 << (bpp * GetDeviceCaps(d->hdc, PLANES)); diff --git a/src/sql/kernel/qsqlcachedresult.cpp b/src/sql/kernel/qsqlcachedresult.cpp index 8f387c6083..c7f2820520 100644 --- a/src/sql/kernel/qsqlcachedresult.cpp +++ b/src/sql/kernel/qsqlcachedresult.cpp @@ -257,7 +257,7 @@ bool QSqlCachedResult::cacheNext() if (d->atEnd) return false; - if(isForwardOnly()) { + if (isForwardOnly()) { d->cache.resize(d->colCount); } diff --git a/src/sql/kernel/qsqldatabase.cpp b/src/sql/kernel/qsqldatabase.cpp index 7d74ba8ac5..42dc61ac68 100644 --- a/src/sql/kernel/qsqldatabase.cpp +++ b/src/sql/kernel/qsqldatabase.cpp @@ -1446,7 +1446,7 @@ QString QSqlDatabase::connectionName() const */ void QSqlDatabase::setNumericalPrecisionPolicy(QSql::NumericalPrecisionPolicy precisionPolicy) { - if(driver()) + if (driver()) driver()->setNumericalPrecisionPolicy(precisionPolicy); d->precisionPolicy = precisionPolicy; } @@ -1461,7 +1461,7 @@ void QSqlDatabase::setNumericalPrecisionPolicy(QSql::NumericalPrecisionPolicy pr */ QSql::NumericalPrecisionPolicy QSqlDatabase::numericalPrecisionPolicy() const { - if(driver()) + if (driver()) return driver()->numericalPrecisionPolicy(); else return d->precisionPolicy; diff --git a/src/tools/moc/moc.cpp b/src/tools/moc/moc.cpp index 494adbda00..a66eda6f86 100644 --- a/src/tools/moc/moc.cpp +++ b/src/tools/moc/moc.cpp @@ -1281,7 +1281,7 @@ void Moc::parsePropertyAttributes(PropertyDef &propDef) if (l[0] == 'C' && l == "CONSTANT") { propDef.constant = true; continue; - } else if(l[0] == 'F' && l == "FINAL") { + } else if (l[0] == 'F' && l == "FINAL") { propDef.final = true; continue; } else if (l[0] == 'N' && l == "NAME") { @@ -1752,7 +1752,7 @@ bool Moc::until(Token target) { } } - if(target == COMMA && angleCount != 0 && possible != -1) { + if (target == COMMA && angleCount != 0 && possible != -1) { index = possible; return true; } @@ -1868,11 +1868,11 @@ void Moc::checkProperties(ClassDef *cdef) p.gspec = spec; break; } - if(!p.notify.isEmpty()) { + if (!p.notify.isEmpty()) { int notifyId = -1; for (int j = 0; j < cdef->signalList.count(); ++j) { const FunctionDef &f = cdef->signalList.at(j); - if(f.name != p.notify) { + if (f.name != p.notify) { continue; } else { notifyId = j /* Signal indexes start from 0 */; diff --git a/src/widgets/accessible/qaccessiblemenu.cpp b/src/widgets/accessible/qaccessiblemenu.cpp index b9c3dbe912..962a56170a 100644 --- a/src/widgets/accessible/qaccessiblemenu.cpp +++ b/src/widgets/accessible/qaccessiblemenu.cpp @@ -86,7 +86,7 @@ int QAccessibleMenu::childCount() const QAccessibleInterface *QAccessibleMenu::childAt(int x, int y) const { QAction *act = menu()->actionAt(menu()->mapFromGlobal(QPoint(x,y))); - if(act && act->isSeparator()) + if (act && act->isSeparator()) act = nullptr; return act ? getOrCreateMenu(menu(), act) : nullptr; } diff --git a/src/widgets/dialogs/qcolordialog.cpp b/src/widgets/dialogs/qcolordialog.cpp index 30c81f8c0e..9db8d5687c 100644 --- a/src/widgets/dialogs/qcolordialog.cpp +++ b/src/widgets/dialogs/qcolordialog.cpp @@ -460,19 +460,19 @@ void QWellArray::keyPressEvent(QKeyEvent* e) { switch(e->key()) { // Look at the key code case Qt::Key_Left: // If 'left arrow'-key, - if(curCol > 0) // and cr't not in leftmost col + if (curCol > 0) // and cr't not in leftmost col setCurrent(curRow, curCol - 1); // set cr't to next left column break; case Qt::Key_Right: // Correspondingly... - if(curCol < numCols()-1) + if (curCol < numCols()-1) setCurrent(curRow, curCol + 1); break; case Qt::Key_Up: - if(curRow > 0) + if (curRow > 0) setCurrent(curRow - 1, curCol); break; case Qt::Key_Down: - if(curRow < numRows()-1) + if (curRow < numRows()-1) setCurrent(curRow + 1, curCol); break; #if 0 @@ -1762,7 +1762,7 @@ void QColorDialogPrivate::initWidgets() QSize screenSize = QGuiApplication::screenAt(QCursor::pos())->availableGeometry().size(); pWidth = pHeight = qMin(screenSize.width(), screenSize.height()); pHeight -= 20; - if(screenSize.height() > screenSize.width()) + if (screenSize.height() > screenSize.width()) pWidth -= 20; #else pWidth = 150; diff --git a/src/widgets/dialogs/qfontdialog.cpp b/src/widgets/dialogs/qfontdialog.cpp index 05ad24a287..34308573f3 100644 --- a/src/widgets/dialogs/qfontdialog.cpp +++ b/src/widgets/dialogs/qfontdialog.cpp @@ -1007,7 +1007,7 @@ void QFontDialog::done(int result) if (result == Accepted) { // We check if this is the same font we had before, if so we emit currentFontChanged QFont selectedFont = currentFont(); - if(selectedFont != d->selectedFont) + if (selectedFont != d->selectedFont) emit(currentFontChanged(selectedFont)); d->selectedFont = selectedFont; emit fontSelected(d->selectedFont); diff --git a/src/widgets/dialogs/qwizard.cpp b/src/widgets/dialogs/qwizard.cpp index 5d267491fb..6c57a9a4af 100644 --- a/src/widgets/dialogs/qwizard.cpp +++ b/src/widgets/dialogs/qwizard.cpp @@ -2712,7 +2712,7 @@ QString QWizard::buttonText(WizardButton which) const return d->buttonCustomTexts.value(which); const QString defText = buttonDefaultText(d->wizStyle, which, d); - if(!defText.isNull()) + if (!defText.isNull()) return defText; return d->btns[which]->text(); diff --git a/src/widgets/doc/snippets/filedialogurls/filedialogurls.cpp b/src/widgets/doc/snippets/filedialogurls/filedialogurls.cpp index f269ad3f20..00830feb8a 100644 --- a/src/widgets/doc/snippets/filedialogurls/filedialogurls.cpp +++ b/src/widgets/doc/snippets/filedialogurls/filedialogurls.cpp @@ -61,7 +61,7 @@ int loadFileDialog() QFileDialog dialog; dialog.setSidebarUrls(urls); dialog.setFileMode(QFileDialog::AnyFile); - if(dialog.exec()) { + if (dialog.exec()) { // ... } //![0] diff --git a/src/widgets/effects/qpixmapfilter.cpp b/src/widgets/effects/qpixmapfilter.cpp index 2c8900327e..c23cfd7e44 100644 --- a/src/widgets/effects/qpixmapfilter.cpp +++ b/src/widgets/effects/qpixmapfilter.cpp @@ -353,17 +353,17 @@ static void convolute( int kernely = -kernelHeight/2; int starty = 0; int endy = kernelHeight; - if(yk+kernely+endy >= srcImage.height()) + if (yk+kernely+endy >= srcImage.height()) endy = kernelHeight-((yk+kernely+endy)-srcImage.height())-1; - if(yk+kernely < 0) + if (yk+kernely < 0) starty = -(yk+kernely); int kernelx = -kernelWidth/2; int startx = 0; int endx = kernelWidth; - if(xk+kernelx+endx >= srcImage.width()) + if (xk+kernelx+endx >= srcImage.width()) endx = kernelWidth-((xk+kernelx+endx)-srcImage.width())-1; - if(xk+kernelx < 0) + if (xk+kernelx < 0) startx = -(xk+kernelx); for (int ys = starty; ys < endy; ys ++) { @@ -385,7 +385,7 @@ static void convolute( b = qBound((int)0, b >> 16, (int)255); a = qBound((int)0, a >> 16, (int)255); // composition mode checking could be moved outside of loop - if(mode == QPainter::CompositionMode_Source) { + if (mode == QPainter::CompositionMode_Source) { uint color = (a<<24)+(r<<16)+(g<<8)+b; *output++ = color; } else { @@ -416,7 +416,7 @@ void QPixmapConvolutionFilter::draw(QPainter *painter, const QPointF &p, const Q if (!painter->isActive()) return; - if(d->kernelWidth<=0 || d->kernelHeight <= 0) + if (d->kernelWidth<=0 || d->kernelHeight <= 0) return; if (src.isNull()) diff --git a/src/widgets/graphicsview/qgraphicslayout_p.h b/src/widgets/graphicsview/qgraphicslayout_p.h index fa47eecf79..d6edfec751 100644 --- a/src/widgets/graphicsview/qgraphicslayout_p.h +++ b/src/widgets/graphicsview/qgraphicslayout_p.h @@ -70,7 +70,7 @@ class QGraphicsWidget; inline bool qt_graphicsLayoutDebug() { static int checked_env = -1; - if(checked_env == -1) + if (checked_env == -1) checked_env = !!qEnvironmentVariableIntValue("QT_GRAPHICSLAYOUT_DEBUG"); return checked_env; } diff --git a/src/widgets/graphicsview/qgraphicsview.cpp b/src/widgets/graphicsview/qgraphicsview.cpp index 74a7755ccf..7c7c094962 100644 --- a/src/widgets/graphicsview/qgraphicsview.cpp +++ b/src/widgets/graphicsview/qgraphicsview.cpp @@ -1754,7 +1754,7 @@ void QGraphicsView::setScene(QGraphicsScene *scene) QEvent windowDeactivate(QEvent::WindowDeactivate); QCoreApplication::sendEvent(d->scene, &windowDeactivate); } - if(hasFocus()) + if (hasFocus()) d->scene->clearFocus(); } diff --git a/src/widgets/itemviews/qabstractitemview.cpp b/src/widgets/itemviews/qabstractitemview.cpp index fbc616cc97..38fd4f1fcc 100644 --- a/src/widgets/itemviews/qabstractitemview.cpp +++ b/src/widgets/itemviews/qabstractitemview.cpp @@ -2727,7 +2727,7 @@ void QAbstractItemView::updateEditorData() void QAbstractItemView::updateEditorGeometries() { Q_D(QAbstractItemView); - if(d->editorIndexHash.isEmpty()) + if (d->editorIndexHash.isEmpty()) return; if (d->delayedPendingLayout) { // doItemsLayout() will end up calling this function again diff --git a/src/widgets/itemviews/qtableview.cpp b/src/widgets/itemviews/qtableview.cpp index c02e5bd626..91afd3c7ed 100644 --- a/src/widgets/itemviews/qtableview.cpp +++ b/src/widgets/itemviews/qtableview.cpp @@ -79,7 +79,7 @@ void QSpanCollection::addSpan(QSpanCollection::Span *span) const SubIndex previousList = it_y.value(); for (Span *s : previousList) { //If a subspans intersect the row, we need to split it into subspans - if(s->bottom() >= span->top()) + if (s->bottom() >= span->top()) sub_index.insert(-s->left(), s); } } @@ -90,7 +90,7 @@ void QSpanCollection::addSpan(QSpanCollection::Span *span) //insert the span as supspan in all the lists that intesects the span while(-it_y.key() <= span->bottom()) { (*it_y).insert(-span->left(), span); - if(it_y == index.begin()) + if (it_y == index.begin()) break; --it_y; } @@ -112,7 +112,7 @@ void QSpanCollection::updateSpan(QSpanCollection::Span *span, int old_height) Q_ASSERT(it_y != index.end()); //it_y must exist since the span is in the list while (-it_y.key() <= span->bottom()) { (*it_y).insert(-span->left(), span); - if(it_y == index.begin()) + if (it_y == index.begin()) break; --it_y; } @@ -129,7 +129,7 @@ void QSpanCollection::updateSpan(QSpanCollection::Span *span, int old_height) it_y = index.erase(it_y); } } - if(it_y == index.begin()) + if (it_y == index.begin()) break; --it_y; } @@ -177,7 +177,7 @@ QSet<QSpanCollection::Span *> QSpanCollection::spansInRect(int x, int y, int w, { QSet<Span *> list; Index::const_iterator it_y = index.lowerBound(-y); - if(it_y == index.end()) + if (it_y == index.end()) --it_y; while(-it_y.key() <= y + h) { SubIndex::const_iterator it_x = (*it_y).lowerBound(-x); @@ -191,7 +191,7 @@ QSet<QSpanCollection::Span *> QSpanCollection::spansInRect(int x, int y, int w, break; --it_x; } - if(it_y == index.begin()) + if (it_y == index.begin()) break; --it_y; } diff --git a/src/widgets/itemviews/qtreeview.cpp b/src/widgets/itemviews/qtreeview.cpp index 502d64eaf6..c0b0ee4f2d 100644 --- a/src/widgets/itemviews/qtreeview.cpp +++ b/src/widgets/itemviews/qtreeview.cpp @@ -616,7 +616,7 @@ void QTreeView::setRowHidden(int row, const QModelIndex &parent, bool hide) if (hide) { d->hiddenIndexes.insert(index); - } else if(d->isPersistent(index)) { //if the index is not persistent, it cannot be in the set + } else if (d->isPersistent(index)) { //if the index is not persistent, it cannot be in the set d->hiddenIndexes.remove(index); } diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp index d4f6672eba..97753b6af4 100644 --- a/src/widgets/kernel/qapplication.cpp +++ b/src/widgets/kernel/qapplication.cpp @@ -421,7 +421,7 @@ void QApplicationPrivate::process_cmdline() } } - if(j < argc) { + if (j < argc) { argv[j] = nullptr; argc = j; } @@ -1512,7 +1512,7 @@ void QApplicationPrivate::setFocusWidget(QWidget *focus, Qt::FocusReason reason) QWidget *prev = focus_widget; focus_widget = focus; - if(focus_widget) + if (focus_widget) focus_widget->d_func()->setFocus_sys(); if (reason != Qt::NoFocusReason) { @@ -1531,7 +1531,7 @@ void QApplicationPrivate::setFocusWidget(QWidget *focus, Qt::FocusReason reason) if (that) QCoreApplication::sendEvent(that->style(), &out); } - if(focus && QApplicationPrivate::focus_widget == focus) { + if (focus && QApplicationPrivate::focus_widget == focus) { QFocusEvent in(QEvent::FocusIn, reason); QPointer<QWidget> that = focus; QCoreApplication::sendEvent(focus, &in); diff --git a/src/widgets/kernel/qgesturemanager.cpp b/src/widgets/kernel/qgesturemanager.cpp index 5137b7ef07..b725485948 100644 --- a/src/widgets/kernel/qgesturemanager.cpp +++ b/src/widgets/kernel/qgesturemanager.cpp @@ -481,7 +481,7 @@ void QGestureManager::cancelGesturesForChildren(QGesture *original) void QGestureManager::cleanupGesturesForRemovedRecognizer(QGesture *gesture) { QGestureRecognizer *recognizer = m_deletedRecognizers.value(gesture); - if(!recognizer) //The Gesture is removed while in the even loop, so the recognizers for this gestures was removed + if (!recognizer) //The Gesture is removed while in the even loop, so the recognizers for this gestures was removed return; m_deletedRecognizers.remove(gesture); if (m_deletedRecognizers.keys(recognizer).isEmpty()) { diff --git a/src/widgets/kernel/qlayout.cpp b/src/widgets/kernel/qlayout.cpp index 6dce2da969..db7aa1aaeb 100644 --- a/src/widgets/kernel/qlayout.cpp +++ b/src/widgets/kernel/qlayout.cpp @@ -744,7 +744,7 @@ bool QLayout::adoptLayout(QLayout *layout) static bool layoutDebug() { static int checked_env = -1; - if(checked_env == -1) + if (checked_env == -1) checked_env = !!qEnvironmentVariableIntValue("QT_LAYOUT_DEBUG"); return checked_env; diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp index 4cc24499fc..e0afbb938a 100644 --- a/src/widgets/kernel/qwidget.cpp +++ b/src/widgets/kernel/qwidget.cpp @@ -1559,7 +1559,7 @@ void QWidgetPrivate::setWinId(WId id) // set widget identifier mapper->insert(data.winid, q); } - if(oldWinId != id) { + if (oldWinId != id) { QEvent e(QEvent::WinIdChange); QCoreApplication::sendEvent(q, &e); } @@ -1906,8 +1906,8 @@ QRegion QWidgetPrivate::clipRegion() const while(w->d_func()->children.at(i++) != static_cast<const QObject *>(ignoreUpTo)) ; for ( ; i < w->d_func()->children.size(); ++i) { - if(QWidget *sibling = qobject_cast<QWidget *>(w->d_func()->children.at(i))) { - if(sibling->isVisible() && !sibling->isWindow()) { + if (QWidget *sibling = qobject_cast<QWidget *>(w->d_func()->children.at(i))) { + if (sibling->isVisible() && !sibling->isWindow()) { QRect siblingRect(ox+sibling->x(), oy+sibling->y(), sibling->width(), sibling->height()); if (qRectIntersects(siblingRect, q->rect())) @@ -3119,7 +3119,7 @@ void QWidget::insertAction(QAction *before, QAction *action) } Q_D(QWidget); - if(d->actions.contains(action)) + if (d->actions.contains(action)) removeAction(action); int pos = d->actions.indexOf(before); @@ -6680,7 +6680,7 @@ QWidget *QWidget::previousInFocusChain() const bool QWidget::isActiveWindow() const { QWidget *tlw = window(); - if(tlw == QApplication::activeWindow() || (isVisible() && (tlw->windowType() == Qt::Popup))) + if (tlw == QApplication::activeWindow() || (isVisible() && (tlw->windowType() == Qt::Popup))) return true; #if QT_CONFIG(graphicsview) @@ -6691,7 +6691,7 @@ bool QWidget::isActiveWindow() const #endif if (style()->styleHint(QStyle::SH_Widget_ShareActivation, nullptr, this)) { - if(tlw->windowType() == Qt::Tool && + if (tlw->windowType() == Qt::Tool && !tlw->isModal() && (!tlw->parentWidget() || tlw->parentWidget()->isActiveWindow())) return true; @@ -6699,7 +6699,7 @@ bool QWidget::isActiveWindow() const while(w && tlw->windowType() == Qt::Tool && !w->isModal() && w->parentWidget()) { w = w->parentWidget()->window(); - if(w == tlw) + if (w == tlw) return true; } } @@ -6842,7 +6842,7 @@ void QWidgetPrivate::reparentFocusWidgets(QWidget * oldtlw) if (oldtlw == q->window()) return; // nothing to do - if(focus_child) + if (focus_child) focus_child->clearFocus(); // separate the focus chain into new (children of myself) and old (the rest) @@ -9879,7 +9879,7 @@ void QWidget::ensurePolished() const QList<QObject*> children = d->children; for (int i = 0; i < children.size(); ++i) { QObject *o = children.at(i); - if(!o->isWidgetType()) + if (!o->isWidgetType()) continue; if (QWidget *w = qobject_cast<QWidget *>(o)) w->ensurePolished(); diff --git a/src/widgets/kernel/qwidgetwindow.cpp b/src/widgets/kernel/qwidgetwindow.cpp index 9f5ba27e9e..c88d63686c 100644 --- a/src/widgets/kernel/qwidgetwindow.cpp +++ b/src/widgets/kernel/qwidgetwindow.cpp @@ -626,7 +626,7 @@ void QWidgetWindow::handleMouseEvent(QMouseEvent *event) QWidget *receiver = activePopupWidget; if (qt_button_down) receiver = qt_button_down; - else if(popupChild) + else if (popupChild) receiver = popupChild; QContextMenuEvent e(QContextMenuEvent::Mouse, mapped, event->globalPosition().toPoint(), event->modifiers()); QApplication::forwardEvent(receiver, &e, event); diff --git a/src/widgets/styles/qcommonstyle.cpp b/src/widgets/styles/qcommonstyle.cpp index bcddd452cd..fad02d5ae9 100644 --- a/src/widgets/styles/qcommonstyle.cpp +++ b/src/widgets/styles/qcommonstyle.cpp @@ -1824,22 +1824,22 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt, switch (tab->shape) { case QTabBar::TriangularNorth: rect.adjust(0, 0, 0, -tabOverlap); - if(!selected) + if (!selected) rect.adjust(1, 1, -1, 0); break; case QTabBar::TriangularSouth: rect.adjust(0, tabOverlap, 0, 0); - if(!selected) + if (!selected) rect.adjust(1, 0, -1, -1); break; case QTabBar::TriangularEast: rect.adjust(tabOverlap, 0, 0, 0); - if(!selected) + if (!selected) rect.adjust(0, 1, -1, -1); break; case QTabBar::TriangularWest: rect.adjust(0, 0, -tabOverlap, 0); - if(!selected) + if (!selected) rect.adjust(1, 1, 0, -1); break; default: @@ -4699,7 +4699,7 @@ int QCommonStyle::pixelMetric(PixelMetric m, const QStyleOption *opt, const QWid || tb->shape == QTabBar::RoundedWest || tb->shape == QTabBar::RoundedEast)) ret = 8; else - if(tb && (tb->shape == QTabBar::TriangularWest || tb->shape == QTabBar::TriangularEast)) + if (tb && (tb->shape == QTabBar::TriangularWest || tb->shape == QTabBar::TriangularEast)) ret = 3; else ret = 2; @@ -5191,7 +5191,7 @@ int QCommonStyle::styleHint(StyleHint sh, const QStyleOption *opt, const QWidget case SH_FocusFrame_Mask: ret = 1; if (widget) { - if(QStyleHintReturnMask *mask = qstyleoption_cast<QStyleHintReturnMask*>(hret)) { + if (QStyleHintReturnMask *mask = qstyleoption_cast<QStyleHintReturnMask*>(hret)) { mask->region = widget->rect(); const int vmargin = proxy()->pixelMetric(QStyle::PM_FocusFrameVMargin, opt); const int hmargin = proxy()->pixelMetric(QStyle::PM_FocusFrameHMargin, opt); @@ -5205,7 +5205,7 @@ int QCommonStyle::styleHint(StyleHint sh, const QStyleOption *opt, const QWidget ret = 0; if (rbOpt->shape == QRubberBand::Rectangle) { ret = true; - if(QStyleHintReturnMask *mask = qstyleoption_cast<QStyleHintReturnMask*>(hret)) { + if (QStyleHintReturnMask *mask = qstyleoption_cast<QStyleHintReturnMask*>(hret)) { mask->region = opt->rect; const int margin = proxy()->pixelMetric(PM_DefaultFrameWidth, opt) * 2; mask->region -= opt->rect.adjusted(margin, margin, -margin, -margin); diff --git a/src/widgets/styles/qstylefactory.cpp b/src/widgets/styles/qstylefactory.cpp index 54a399ed39..87a8000ce0 100644 --- a/src/widgets/styles/qstylefactory.cpp +++ b/src/widgets/styles/qstylefactory.cpp @@ -109,7 +109,7 @@ QStyle *QStyleFactory::create(const QString& key) { } // Keep these here - they make the #ifdefery above work if (!ret) ret = qLoadPlugin<QStyle, QStylePlugin>(loader(), style); - if(ret) + if (ret) ret->setObjectName(style); return ret; } diff --git a/src/widgets/styles/qstylehelper.cpp b/src/widgets/styles/qstylehelper.cpp index 5b771c6fba..d8e0495b37 100644 --- a/src/widgets/styles/qstylehelper.cpp +++ b/src/widgets/styles/qstylehelper.cpp @@ -385,7 +385,7 @@ void drawBorderPixmap(const QPixmap &pixmap, QPainter *painter, const QRect &rec QRect(left, 0, size.width() -right - left, top)); //top-left - if(left > 0) + if (left > 0) painter->drawPixmap(QRect(rect.left(), rect.top(), left, top), pixmap, QRect(0, 0, left, top)); diff --git a/src/widgets/styles/qstylesheetstyle.cpp b/src/widgets/styles/qstylesheetstyle.cpp index 407134298b..a4d41566ee 100644 --- a/src/widgets/styles/qstylesheetstyle.cpp +++ b/src/widgets/styles/qstylesheetstyle.cpp @@ -3922,7 +3922,7 @@ void QStyleSheetStyle::drawControl(ControlElement ce, const QStyleOption *opt, Q ParentStyle::drawControl(ce, opt, p, w); return; } - if(hasStyleRule(w, PseudoElement_HeaderViewSection)) { + if (hasStyleRule(w, PseudoElement_HeaderViewSection)) { QRenderRule subRule = renderRule(w, opt, PseudoElement_HeaderViewSection); if (!subRule.hasNativeBorder() || !subRule.baseStyleCanDraw() || subRule.hasBackground() || subRule.hasPalette() || subRule.hasFont || subRule.hasBorder()) { @@ -4490,7 +4490,7 @@ void QStyleSheetStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *op Q_FALLTHROUGH(); case PE_PanelMenu: case PE_PanelStatusBar: - if(rule.hasDrawable()) { + if (rule.hasDrawable()) { rule.drawRule(p, opt->rect); return; } @@ -4891,7 +4891,7 @@ int QStyleSheetStyle::pixelMetric(PixelMetric m, const QStyleOption *opt, const break; case PM_ScrollView_ScrollBarSpacing: - if(!rule.hasNativeBorder() || rule.hasBox()) + if (!rule.hasNativeBorder() || rule.hasBox()) return 0; break; #endif // QT_CONFIG(scrollbar) @@ -5058,7 +5058,7 @@ QSize QStyleSheetStyle::sizeFromContents(ContentsType ct, const QStyleOption *op case CT_ComboBox: case CT_PushButton: if (rule.hasBox() || !rule.hasNativeBorder()) { - if(ct == CT_ComboBox) { + if (ct == CT_ComboBox) { //add some space for the drop down. QRenderRule subRule = renderRule(w, opt, PseudoElement_ComboBoxDropDown); QRect comboRect = positionRect(w, rule, subRule, PseudoElement_ComboBoxDropDown, opt->rect, opt->direction); diff --git a/src/widgets/styles/qwindowsstyle.cpp b/src/widgets/styles/qwindowsstyle.cpp index 02188c5b29..ec252d9293 100644 --- a/src/widgets/styles/qwindowsstyle.cpp +++ b/src/widgets/styles/qwindowsstyle.cpp @@ -267,7 +267,7 @@ void QWindowsStyle::polish(QApplication *app) d->inactiveCaptionText = palette.window().color(); #if defined(Q_OS_WIN) //fetch native title bar colors - if(app->desktopSettingsAware()){ + if (app->desktopSettingsAware()){ DWORD activeCaption = GetSysColor(COLOR_ACTIVECAPTION); DWORD gradientActiveCaption = GetSysColor(COLOR_GRADIENTACTIVECAPTION); DWORD inactiveCaption = GetSysColor(COLOR_INACTIVECAPTION); @@ -630,7 +630,7 @@ int QWindowsStyle::styleHint(StyleHint hint, const QStyleOption *opt, const QWid ret = 0; if (rbOpt->shape == QRubberBand::Rectangle) { ret = true; - if(QStyleHintReturnMask *mask = qstyleoption_cast<QStyleHintReturnMask*>(returnData)) { + if (QStyleHintReturnMask *mask = qstyleoption_cast<QStyleHintReturnMask*>(returnData)) { mask->region = opt->rect; int size = 1; if (widget && widget->isWindow()) @@ -673,7 +673,7 @@ void QWindowsStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QRect rect = opt->rect; const int margin = 2; QPen oldPen = p->pen(); - if(opt->state & State_Horizontal){ + if (opt->state & State_Horizontal){ const int offset = rect.width()/2; p->setPen(QPen(opt->palette.dark().color())); p->drawLine(rect.bottomLeft().x() + offset, @@ -758,7 +758,7 @@ void QWindowsStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, if (opt->state & (State_Raised | State_Sunken | State_On)) { if (opt->state & State_AutoRaise) { - if(opt->state & (State_Enabled | State_Sunken | State_On)){ + if (opt->state & (State_Enabled | State_Sunken | State_On)){ if (panel) qDrawShadePanel(p, opt->rect, opt->palette, opt->state & (State_Sunken | State_On), 1, &fill); @@ -1618,7 +1618,7 @@ void QWindowsStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPai default: break; } - if(opt->direction == Qt::RightToLeft){ //reverse layout changes the order of Beginning/end + if (opt->direction == Qt::RightToLeft){ //reverse layout changes the order of Beginning/end bool tmp = paintLeftBorder; paintRightBorder=paintLeftBorder; paintLeftBorder=tmp; @@ -1733,7 +1733,7 @@ void QWindowsStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPai int myHeight = pbBits.rect.height(); int chunksToDraw = chunksInRow; - if(step > chunkCount - 5)chunksToDraw = (chunkCount - step); + if (step > chunkCount - 5)chunksToDraw = (chunkCount - step); p->save(); p->setClipRect(m.mapRect(QRectF(rect)).toRect()); @@ -1747,7 +1747,7 @@ void QWindowsStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPai x += reverse ? -unit_width : unit_width; } //Draw wrap-around chunks - if( step > chunkCount-5){ + if ( step > chunkCount-5){ x0 = reverse ? rect.left() + rect.width() - unit_width : rect.left() ; x = 0; int chunksToDraw = step - (chunkCount - chunksInRow); diff --git a/src/widgets/util/qsystemtrayicon.cpp b/src/widgets/util/qsystemtrayicon.cpp index abd49237a6..c9fcd587cd 100644 --- a/src/widgets/util/qsystemtrayicon.cpp +++ b/src/widgets/util/qsystemtrayicon.cpp @@ -690,7 +690,7 @@ void QBalloonTip::balloon(const QPoint& pos, int msecs, bool showArrow) void QBalloonTip::mousePressEvent(QMouseEvent *e) { close(); - if(e->button() == Qt::LeftButton) + if (e->button() == Qt::LeftButton) emit trayIcon->messageClicked(); } diff --git a/src/widgets/widgets/qabstractspinbox.cpp b/src/widgets/widgets/qabstractspinbox.cpp index 2d92270eb7..fc01354046 100644 --- a/src/widgets/widgets/qabstractspinbox.cpp +++ b/src/widgets/widgets/qabstractspinbox.cpp @@ -1048,8 +1048,8 @@ void QAbstractSpinBox::keyPressEvent(QKeyEvent *event) } if (d->spinClickTimerId == -1) stepBy(steps); - if(event->isAutoRepeat() && !isPgUpOrDown) { - if(d->spinClickThresholdTimerId == -1 && d->spinClickTimerId == -1) { + if (event->isAutoRepeat() && !isPgUpOrDown) { + if (d->spinClickThresholdTimerId == -1 && d->spinClickTimerId == -1) { d->updateState(up, true); } } diff --git a/src/widgets/widgets/qcalendarwidget.cpp b/src/widgets/widgets/qcalendarwidget.cpp index 6a4abc2113..e9774aa556 100644 --- a/src/widgets/widgets/qcalendarwidget.cpp +++ b/src/widgets/widgets/qcalendarwidget.cpp @@ -1142,7 +1142,7 @@ QTextCharFormat QCalendarModel::formatForCell(int row, int col) const if (!header) { QDate date = dateForCell(row, col); format.merge(m_dateFormats.value(date)); - if(date < m_minimumDate || date > m_maximumDate) + if (date < m_minimumDate || date > m_maximumDate) format.setBackground(pal.brush(cg, QPalette::Window)); if (m_shownMonth != date.month(m_calendar)) format.setForeground(pal.brush(QPalette::Disabled, QPalette::Text)); @@ -1158,7 +1158,7 @@ QVariant QCalendarModel::data(const QModelIndex &index, int role) const int row = index.row(); int column = index.column(); - if(role == Qt::DisplayRole) { + if (role == Qt::DisplayRole) { if (m_weekNumbersShown && column == HeaderColumn && row >= m_firstRow && row < m_firstRow + RowCount) { QDate date = dateForCell(row, columnForDayOfWeek(Qt::Monday)); @@ -3165,7 +3165,7 @@ void QCalendarWidget::resizeEvent(QResizeEvent * event) // XXX Should really use a QWidgetStack for yearEdit and yearButton, // XXX here we hide the year edit when the layout is likely to break // XXX the manual positioning of the yearEdit over the yearButton. - if(d->yearEdit->isVisible() && event->size().width() != event->oldSize().width()) + if (d->yearEdit->isVisible() && event->size().width() != event->oldSize().width()) d->_q_yearEditingFinished(); QWidget::resizeEvent(event); diff --git a/src/widgets/widgets/qfocusframe.cpp b/src/widgets/widgets/qfocusframe.cpp index aa9de7c35f..47ac8a5568 100644 --- a/src/widgets/widgets/qfocusframe.cpp +++ b/src/widgets/widgets/qfocusframe.cpp @@ -95,7 +95,7 @@ void QFocusFramePrivate::updateSize() pos = widget->parentWidget()->mapTo(q->parentWidget(), pos); QRect geom(pos.x()-hmargin, pos.y()-vmargin, widget->width()+(hmargin*2), widget->height()+(vmargin*2)); - if(q->geometry() == geom) + if (q->geometry() == geom) return; q->setGeometry(geom); @@ -279,7 +279,7 @@ bool QFocusFrame::eventFilter(QObject *o, QEvent *e) { Q_D(QFocusFrame); - if(o == d->widget) { + if (o == d->widget) { switch(e->type()) { case QEvent::Move: case QEvent::Resize: diff --git a/src/widgets/widgets/qlabel.cpp b/src/widgets/widgets/qlabel.cpp index b03235bbef..e124022e52 100644 --- a/src/widgets/widgets/qlabel.cpp +++ b/src/widgets/widgets/qlabel.cpp @@ -591,7 +591,7 @@ void QLabel::setMargin(int margin) QSize QLabelPrivate::sizeForWidth(int w) const { Q_Q(const QLabel); - if(q->minimumWidth() > 0) + if (q->minimumWidth() > 0) w = qMax(w, q->minimumWidth()); QSize contentsMargin(leftmargin + rightmargin, topmargin + bottommargin); @@ -1429,7 +1429,7 @@ void QLabel::setTextFormat(Qt::TextFormat format) void QLabel::changeEvent(QEvent *ev) { Q_D(QLabel); - if(ev->type() == QEvent::FontChange || ev->type() == QEvent::ApplicationFontChange) { + if (ev->type() == QEvent::FontChange || ev->type() == QEvent::ApplicationFontChange) { if (d->isTextLabel) { if (d->control) d->control->document()->setDefaultFont(font()); diff --git a/src/widgets/widgets/qlineedit.cpp b/src/widgets/widgets/qlineedit.cpp index 9f1f00ced7..4a877c7596 100644 --- a/src/widgets/widgets/qlineedit.cpp +++ b/src/widgets/widgets/qlineedit.cpp @@ -1901,7 +1901,7 @@ void QLineEdit::focusInEvent(QFocusEvent *e) d->control->setBlinkingCursorEnabled(true); QStyleOptionFrame opt; initStyleOption(&opt); - if((!hasSelectedText() && d->control->preeditAreaText().isEmpty()) + if ((!hasSelectedText() && d->control->preeditAreaText().isEmpty()) || style()->styleHint(QStyle::SH_BlinkCursorWhenTextSelected, &opt, this)) d->setCursorVisible(true); #ifdef QT_KEYPAD_NAVIGATION diff --git a/src/widgets/widgets/qmainwindow.cpp b/src/widgets/widgets/qmainwindow.cpp index 8aa2c24592..982638fa38 100644 --- a/src/widgets/widgets/qmainwindow.cpp +++ b/src/widgets/widgets/qmainwindow.cpp @@ -761,7 +761,7 @@ void QMainWindow::addToolBar(Qt::ToolBarArea area, QToolBar *toolbar) disconnect(this, SIGNAL(toolButtonStyleChanged(Qt::ToolButtonStyle)), toolbar, SLOT(_q_updateToolButtonStyle(Qt::ToolButtonStyle))); - if(toolbar->d_func()->state && toolbar->d_func()->state->dragging) { + if (toolbar->d_func()->state && toolbar->d_func()->state->dragging) { //removing a toolbar which is dragging will cause crash #if QT_CONFIG(dockwidget) bool animated = isAnimated(); diff --git a/src/widgets/widgets/qmdiarea.cpp b/src/widgets/widgets/qmdiarea.cpp index 782c20660a..95988d2bfa 100644 --- a/src/widgets/widgets/qmdiarea.cpp +++ b/src/widgets/widgets/qmdiarea.cpp @@ -723,7 +723,7 @@ void QMdiAreaPrivate::_q_deactivateAllWindows(QMdiSubWindow *aboutToActivate) continue; // We don't want to handle signals caused by child->showNormal(). ignoreWindowStateChange = true; - if(!(options & QMdiArea::DontMaximizeSubWindowOnActivation) && !showActiveWindowMaximized) + if (!(options & QMdiArea::DontMaximizeSubWindowOnActivation) && !showActiveWindowMaximized) showActiveWindowMaximized = child->isMaximized() && child->isVisible(); if (showActiveWindowMaximized && child->isMaximized()) { if (q->updatesEnabled()) { diff --git a/src/widgets/widgets/qmenu.cpp b/src/widgets/widgets/qmenu.cpp index aa04873f63..4a6c51383d 100644 --- a/src/widgets/widgets/qmenu.cpp +++ b/src/widgets/widgets/qmenu.cpp @@ -154,7 +154,7 @@ public: void syncWithMenu(QMenu *menu, QActionEvent *act) { Q_D(QTornOffMenu); - if(menu != d->causedMenu) + if (menu != d->causedMenu) return; auto action = static_cast<QAction *>(act->action()); if (act->type() == QEvent::ActionAdded) { @@ -648,7 +648,7 @@ void QMenuPrivate::setSyncAction() { Q_Q(QMenu); QAction *current = currentAction; - if(current && (!current->isEnabled() || current->menu() || current->isSeparator())) + if (current && (!current->isEnabled() || current->menu() || current->isSeparator())) current = nullptr; for(QWidget *caused = q; caused;) { if (QMenu *m = qobject_cast<QMenu*>(caused)) { @@ -1122,7 +1122,7 @@ void QMenuPrivate::scrollMenu(QAction *action, QMenuScroller::ScrollLocation loc break; } } - if(newOffset) + if (newOffset) newOffset -= fw * 2; } @@ -1158,9 +1158,9 @@ void QMenuPrivate::scrollMenu(QAction *action, QMenuScroller::ScrollLocation loc QRect geom = q->geometry(); if (newOffset > scroll->scrollOffset && (scroll->scrollFlags & newScrollFlags & QMenuScroller::ScrollUp)) { //scroll up const int newHeight = geom.height()-(newOffset-scroll->scrollOffset); - if(newHeight > geom.height()) + if (newHeight > geom.height()) geom.setHeight(newHeight); - } else if(scroll->scrollFlags & newScrollFlags & QMenuScroller::ScrollDown) { + } else if (scroll->scrollFlags & newScrollFlags & QMenuScroller::ScrollDown) { int newTop = geom.top() + (newOffset-scroll->scrollOffset); if (newTop < desktopFrame+screen.top()) newTop = desktopFrame+screen.top(); @@ -1209,7 +1209,7 @@ void QMenuPrivate::scrollMenu(QMenuScroller::ScrollLocation location, bool activ { Q_Q(QMenu); updateActionRects(); - if(location == QMenuScroller::ScrollBottom) { + if (location == QMenuScroller::ScrollBottom) { for(int i = actions.size()-1; i >= 0; --i) { QAction *act = actions.at(i); if (actionRects.at(i).isNull()) @@ -1217,14 +1217,14 @@ void QMenuPrivate::scrollMenu(QMenuScroller::ScrollLocation location, bool activ if (!act->isSeparator() && (q->style()->styleHint(QStyle::SH_Menu_AllowActiveAndDisabled, nullptr, q) || act->isEnabled())) { - if(scroll->scrollFlags & QMenuPrivate::QMenuScroller::ScrollDown) + if (scroll->scrollFlags & QMenuPrivate::QMenuScroller::ScrollDown) scrollMenu(act, QMenuPrivate::QMenuScroller::ScrollBottom, active); - else if(active) + else if (active) setCurrentAction(act, /*popup*/-1, QMenuPrivate::SelectedFromKeyboard); break; } } - } else if(location == QMenuScroller::ScrollTop) { + } else if (location == QMenuScroller::ScrollTop) { for(int i = 0; i < actions.size(); ++i) { QAction *act = actions.at(i); if (actionRects.at(i).isNull()) @@ -1232,9 +1232,9 @@ void QMenuPrivate::scrollMenu(QMenuScroller::ScrollLocation location, bool activ if (!act->isSeparator() && (q->style()->styleHint(QStyle::SH_Menu_AllowActiveAndDisabled, nullptr, q) || act->isEnabled())) { - if(scroll->scrollFlags & QMenuPrivate::QMenuScroller::ScrollUp) + if (scroll->scrollFlags & QMenuPrivate::QMenuScroller::ScrollUp) scrollMenu(act, QMenuPrivate::QMenuScroller::ScrollTop, active); - else if(active) + else if (active) setCurrentAction(act, /*popup*/-1, QMenuPrivate::SelectedFromKeyboard); break; } @@ -1281,7 +1281,7 @@ void QMenuPrivate::scrollMenu(QMenuScroller::ScrollDirection direction, bool pag break; } } - if(!scrolled) { + if (!scrolled) { scroll->scrollFlags &= ~QMenuScroller::ScrollDown; q->update(); } @@ -1382,7 +1382,7 @@ void QMenuPrivate::activateCausedStack(const QList<QPointer<QWidget>> &causedSta QAction::ActionEvent action_e, bool self) { QBoolBlocker guard(activationRecursionGuard); - if(self) + if (self) action->activate(action_e); for(int i = 0; i < causedStack.size(); ++i) { @@ -1439,7 +1439,7 @@ void QMenuPrivate::activateAction(QAction *action, QAction::ActionEvent action_e } else { for(QWidget *widget = QApplication::activePopupWidget(); widget; ) { if (QMenu *qmenu = qobject_cast<QMenu*>(widget)) { - if(qmenu == q) + if (qmenu == q) hideUpToMenuBar(); widget = qmenu->d_func()->causedPopup.widget; } else { @@ -2518,7 +2518,7 @@ void QMenuPrivate::popup(const QPoint &p, QAction *atAction, PositionFunction po pos.setX(screen.left() + desktopFrame); } if (pos.y() + size.height() - 1 > screen.bottom() - desktopFrame) { - if(snapToMouse) + if (snapToMouse) pos.setY(qMin(mouse.y() - (size.height() + desktopFrame), screen.bottom()-desktopFrame-size.height()+1)); else pos.setY(qMax(p.y() - (size.height() + desktopFrame), screen.bottom()-desktopFrame-size.height()+1)); @@ -3133,7 +3133,7 @@ void QMenu::keyPressEvent(QKeyEvent *e) case Qt::Key_PageUp: key_consumed = true; if (d->currentAction && d->scroll) { - if(d->scroll->scrollFlags & QMenuPrivate::QMenuScroller::ScrollUp) + if (d->scroll->scrollFlags & QMenuPrivate::QMenuScroller::ScrollUp) d->scrollMenu(QMenuPrivate::QMenuScroller::ScrollUp, true, true); else d->scrollMenu(QMenuPrivate::QMenuScroller::ScrollTop, true); @@ -3142,7 +3142,7 @@ void QMenu::keyPressEvent(QKeyEvent *e) case Qt::Key_PageDown: key_consumed = true; if (d->currentAction && d->scroll) { - if(d->scroll->scrollFlags & QMenuPrivate::QMenuScroller::ScrollDown) + if (d->scroll->scrollFlags & QMenuPrivate::QMenuScroller::ScrollDown) d->scrollMenu(QMenuPrivate::QMenuScroller::ScrollDown, true, true); else d->scrollMenu(QMenuPrivate::QMenuScroller::ScrollBottom, true); @@ -3154,7 +3154,7 @@ void QMenu::keyPressEvent(QKeyEvent *e) QAction *nextAction = nullptr; QMenuPrivate::QMenuScroller::ScrollLocation scroll_loc = QMenuPrivate::QMenuScroller::ScrollStay; if (!d->currentAction) { - if(key == Qt::Key_Down) { + if (key == Qt::Key_Down) { for(int i = 0; i < d->actions.count(); ++i) { QAction *act = d->actions.at(i); if (d->actionRects.at(i).isNull()) @@ -3387,10 +3387,10 @@ void QMenu::keyPressEvent(QKeyEvent *e) QAction *act = d->actions.at(i); const QString act_text = act->text(); for(int c = 0; c < d->searchBuffer.size(); ++c) { - if(act_text.indexOf(d->searchBuffer.at(c), 0, Qt::CaseInsensitive) != -1) + if (act_text.indexOf(d->searchBuffer.at(c), 0, Qt::CaseInsensitive) != -1) ++match_count; } - if(match_count > best_match_count) { + if (match_count > best_match_count) { best_match_count = match_count; nextAction = act; } @@ -3429,7 +3429,7 @@ void QMenu::keyPressEvent(QKeyEvent *e) #endif if (nextAction) { key_consumed = true; - if(d->scroll) + if (d->scroll) d->scrollMenu(nextAction, QMenuPrivate::QMenuScroller::ScrollCenter, false); d->setCurrentAction(nextAction, 0, QMenuPrivate::SelectedFromElsewhere, true); if (!nextAction->menu() && activateAction) { @@ -3540,7 +3540,7 @@ QMenu::timerEvent(QTimerEvent *e) internalDelayedPopup(); } else if (d->sloppyState.isTimerId(e->timerId())) { d->sloppyState.timeout(); - } else if(d->searchBufferTimer.timerId() == e->timerId()) { + } else if (d->searchBufferTimer.timerId() == e->timerId()) { d->searchBuffer.clear(); } } diff --git a/src/widgets/widgets/qmenubar.cpp b/src/widgets/widgets/qmenubar.cpp index 5fd84f7f3b..f92a975455 100644 --- a/src/widgets/widgets/qmenubar.cpp +++ b/src/widgets/widgets/qmenubar.cpp @@ -115,7 +115,7 @@ QSize QMenuBarExtension::sizeHint() const QAction *QMenuBarPrivate::actionAt(QPoint p) const { for(int i = 0; i < actions.size(); ++i) { - if(actionRect(actions.at(i)).contains(p)) + if (actionRect(actions.at(i)).contains(p)) return actions.at(i); } return nullptr; @@ -163,11 +163,11 @@ bool QMenuBarPrivate::isVisible(QAction *action) void QMenuBarPrivate::updateGeometries() { Q_Q(QMenuBar); - if(!itemsDirty) + if (!itemsDirty) return; int q_width = q->width()-(q->style()->pixelMetric(QStyle::PM_MenuBarPanelWidth, nullptr, q)*2); int q_start = -1; - if(leftWidget || rightWidget) { + if (leftWidget || rightWidget) { int vmargin = q->style()->pixelMetric(QStyle::PM_MenuBarVMargin, nullptr, q) + q->style()->pixelMetric(QStyle::PM_MenuBarPanelWidth, nullptr, q); int hmargin = q->style()->pixelMetric(QStyle::PM_MenuBarHMargin, nullptr, q) @@ -190,7 +190,7 @@ void QMenuBarPrivate::updateGeometries() } #ifdef Q_OS_MAC - if(q->isNativeMenuBar()) {//nothing to see here folks, move along.. + if (q->isNativeMenuBar()) {//nothing to see here folks, move along.. itemsDirty = false; return; } @@ -198,7 +198,7 @@ void QMenuBarPrivate::updateGeometries() calcActionRects(q_width, q_start); currentAction = nullptr; #ifndef QT_NO_SHORTCUT - if(itemsDirty) { + if (itemsDirty) { for(int j = 0; j < shortcutIndexMap.size(); ++j) q->releaseShortcut(shortcutIndexMap.value(j)); shortcutIndexMap.clear(); @@ -271,7 +271,7 @@ QRect QMenuBarPrivate::actionRect(QAction *act) const void QMenuBarPrivate::focusFirstAction() { - if(!currentAction) { + if (!currentAction) { updateGeometries(); int index = 0; while (index < actions.count() && actionRects.at(index).isNull()) ++index; @@ -288,16 +288,16 @@ void QMenuBarPrivate::setKeyboardMode(bool b) return; } keyboardState = b; - if(b) { + if (b) { QWidget *fw = QApplication::focusWidget(); if (fw && fw != q && fw->window() != QApplication::activePopupWidget()) keyboardFocusWidget = fw; focusFirstAction(); q->setFocus(Qt::MenuBarFocusReason); } else { - if(!popupState) + if (!popupState) setCurrentAction(nullptr); - if(keyboardFocusWidget) { + if (keyboardFocusWidget) { if (QApplication::focusWidget() == q) keyboardFocusWidget->setFocus(Qt::MenuBarFocusReason); keyboardFocusWidget = nullptr; @@ -309,7 +309,7 @@ void QMenuBarPrivate::setKeyboardMode(bool b) void QMenuBarPrivate::popupAction(QAction *action, bool activateFirst) { Q_Q(QMenuBar); - if(!action || !action->menu() || closePopupMode) + if (!action || !action->menu() || closePopupMode) return; popupState = true; if (action->isEnabled() && action->menu()->isEnabled()) { @@ -351,11 +351,11 @@ void QMenuBarPrivate::popupAction(QAction *action, bool activateFirst) pos.rx() += actionWidth; } - if(!defaultPopDown || (fitUp && !fitDown)) + if (!defaultPopDown || (fitUp && !fitDown)) pos.setY(qMax(screenRect.y(), q->mapToGlobal(QPoint(0, adjustedActionRect.top()-popup_size.height())).y())); QMenuPrivate::get(activeMenu)->topData()->initialScreen = popupScreen; activeMenu->popup(pos); - if(activateFirst) + if (activateFirst) activeMenu->d_func()->setFirstActionActive(); } q->update(actionRect(action)); @@ -363,7 +363,7 @@ void QMenuBarPrivate::popupAction(QAction *action, bool activateFirst) void QMenuBarPrivate::setCurrentAction(QAction *action, bool popup, bool activateFirst) { - if(currentAction == action && popup == popupState) + if (currentAction == action && popup == popupState) return; autoReleaseTimer.stop(); @@ -371,7 +371,7 @@ void QMenuBarPrivate::setCurrentAction(QAction *action, bool popup, bool activat doChildEffects = (popup && !activeMenu); Q_Q(QMenuBar); QWidget *fw = nullptr; - if(QMenu *menu = activeMenu) { + if (QMenu *menu = activeMenu) { activeMenu = nullptr; if (popup) { fw = q->window()->focusWidget(); @@ -380,7 +380,7 @@ void QMenuBarPrivate::setCurrentAction(QAction *action, bool popup, bool activat menu->hide(); } - if(currentAction) + if (currentAction) q->update(actionRect(currentAction)); popupState = popup; @@ -390,7 +390,7 @@ void QMenuBarPrivate::setCurrentAction(QAction *action, bool popup, bool activat currentAction = action; if (action && action->isEnabled()) { activateAction(action, QAction::Hover); - if(popup) + if (popup) popupAction(action, activateFirst); q->update(actionRect(action)); #if QT_CONFIG(statustip) @@ -408,7 +408,7 @@ void QMenuBarPrivate::calcActionRects(int max_width, int start) const { Q_Q(const QMenuBar); - if(!itemsDirty) + if (!itemsDirty) return; //let's reinitialize the buffer @@ -427,13 +427,13 @@ void QMenuBarPrivate::calcActionRects(int max_width, int start) const icone = style->pixelMetric(QStyle::PM_SmallIconSize, nullptr, q); for(int i = 0; i < actions.count(); i++) { QAction *action = actions.at(i); - if(!action->isVisible()) + if (!action->isVisible()) continue; QSize sz; //calc what I think the size is.. - if(action->isSeparator()) { + if (action->isSeparator()) { if (style->styleHint(QStyle::SH_DrawMenuBarSeparator, nullptr, q)) separator = i; continue; //we don't really position these! @@ -452,10 +452,10 @@ void QMenuBarPrivate::calcActionRects(int max_width, int start) const q->initStyleOption(&opt, action); sz = q->style()->sizeFromContents(QStyle::CT_MenuBarItem, &opt, sz, q); - if(!sz.isEmpty()) { + if (!sz.isEmpty()) { { //update the separator state int iWidth = sz.width() + itemSpacing; - if(separator == -1) + if (separator == -1) separator_start += iWidth; else separator_len += iWidth; @@ -480,9 +480,9 @@ void QMenuBarPrivate::calcActionRects(int max_width, int start) const rect.setHeight(max_item_height); //move - if(separator != -1 && i >= separator) { //after the separator + if (separator != -1 && i >= separator) { //after the separator int left = (max_width - separator_len - hmargin - itemSpacing) + (x - separator_start - hmargin); - if(left < separator_start) { //wrap + if (left < separator_start) { //wrap separator_start = x = hmargin; y += max_item_height; } @@ -509,9 +509,9 @@ void QMenuBarPrivate::activateAction(QAction *action, QAction::ActionEvent actio if (action_e == QAction::Hover) action->showStatusText(q); -// if(action_e == QAction::Trigger) +// if (action_e == QAction::Trigger) // emit q->activated(action); -// else if(action_e == QAction::Hover) +// else if (action_e == QAction::Hover) // emit q->highlighted(action); } @@ -989,7 +989,7 @@ void QMenuBar::paintEvent(QPaintEvent *e) QRect adjustedActionRect = d->actionRect(action); if (adjustedActionRect.isEmpty() || !d->isVisible(action)) continue; - if(!e->rect().intersects(adjustedActionRect)) + if (!e->rect().intersects(adjustedActionRect)) continue; emptyArea -= adjustedActionRect; @@ -1046,7 +1046,7 @@ void QMenuBar::setVisible(bool visible) void QMenuBar::mousePressEvent(QMouseEvent *e) { Q_D(QMenuBar); - if(e->button() != Qt::LeftButton) + if (e->button() != Qt::LeftButton) return; d->mouseDown = true; @@ -1061,8 +1061,8 @@ void QMenuBar::mousePressEvent(QMouseEvent *e) return; } - if(d->currentAction == action && d->popupState) { - if(QMenu *menu = d->activeMenu) { + if (d->currentAction == action && d->popupState) { + if (QMenu *menu = d->activeMenu) { d->activeMenu = nullptr; menu->setAttribute(Qt::WA_NoMouseReplay); menu->hide(); @@ -1078,7 +1078,7 @@ void QMenuBar::mousePressEvent(QMouseEvent *e) void QMenuBar::mouseReleaseEvent(QMouseEvent *e) { Q_D(QMenuBar); - if(e->button() != Qt::LeftButton || !d->mouseDown) + if (e->button() != Qt::LeftButton || !d->mouseDown) return; d->mouseDown = false; @@ -1087,11 +1087,11 @@ void QMenuBar::mouseReleaseEvent(QMouseEvent *e) // do noting if the action is hidden if (!d->isVisible(action)) return; - if((d->closePopupMode && action == d->currentAction) || !action || !action->menu()) { + if ((d->closePopupMode && action == d->currentAction) || !action || !action->menu()) { //we set the current action before activating //so that we let the leave event set the current back to 0 d->setCurrentAction(action, false); - if(action) + if (action) d->activateAction(action, QAction::Trigger); } d->closePopupMode = 0; @@ -1105,15 +1105,15 @@ void QMenuBar::keyPressEvent(QKeyEvent *e) Q_D(QMenuBar); d->updateGeometries(); int key = e->key(); - if(isRightToLeft()) { // in reverse mode open/close key for submenues are reversed - if(key == Qt::Key_Left) + if (isRightToLeft()) { // in reverse mode open/close key for submenues are reversed + if (key == Qt::Key_Left) key = Qt::Key_Right; - else if(key == Qt::Key_Right) + else if (key == Qt::Key_Right) key = Qt::Key_Left; } - if(key == Qt::Key_Tab) //means right + if (key == Qt::Key_Tab) //means right key = Qt::Key_Right; - else if(key == Qt::Key_Backtab) //means left + else if (key == Qt::Key_Backtab) //means left key = Qt::Key_Left; bool key_consumed = false; @@ -1125,9 +1125,9 @@ void QMenuBar::keyPressEvent(QKeyEvent *e) case Qt::Key_Return: { if (!style()->styleHint(QStyle::SH_MenuBar_AltKeyNavigation, nullptr, this) || !d->currentAction) break; - if(d->currentAction->menu()) { + if (d->currentAction->menu()) { d->popupAction(d->currentAction, true); - } else if(key == Qt::Key_Enter || key == Qt::Key_Return || key == Qt::Key_Space) { + } else if (key == Qt::Key_Enter || key == Qt::Key_Return || key == Qt::Key_Space) { d->activateAction(d->currentAction, QAction::Trigger); d->setCurrentAction(d->currentAction, false); d->setKeyboardMode(false); @@ -1137,7 +1137,7 @@ void QMenuBar::keyPressEvent(QKeyEvent *e) case Qt::Key_Right: case Qt::Key_Left: { - if(d->currentAction) { + if (d->currentAction) { int index = d->actions.indexOf(d->currentAction); if (QAction *nextAction = d->getNextAction(index, key == Qt::Key_Left ? -1 : +1)) { d->setCurrentAction(nextAction, d->popupState, true); @@ -1158,7 +1158,7 @@ void QMenuBar::keyPressEvent(QKeyEvent *e) } #endif - if(!key_consumed && + if (!key_consumed && (!e->modifiers() || (e->modifiers()&(Qt::MetaModifier|Qt::AltModifier))) && e->text().length()==1 && !d->popupState) { int clashCount = 0; @@ -1170,14 +1170,14 @@ void QMenuBar::keyPressEvent(QKeyEvent *e) continue; QAction *act = d->actions.at(i); QString s = act->text(); - if(!s.isEmpty()) { + if (!s.isEmpty()) { int ampersand = s.indexOf(QLatin1Char('&')); - if(ampersand >= 0) { - if(s[ampersand+1].toUpper() == c) { + if (ampersand >= 0) { + if (s[ampersand+1].toUpper() == c) { clashCount++; - if(!first) + if (!first) first = act; - if(act == d->currentAction) + if (act == d->currentAction) currentSelected = act; else if (!firstAfterCurrent && currentSelected) firstAfterCurrent = act; @@ -1187,18 +1187,18 @@ void QMenuBar::keyPressEvent(QKeyEvent *e) } } QAction *next_action = nullptr; - if(clashCount >= 1) { - if(clashCount == 1 || !d->currentAction || (currentSelected && !firstAfterCurrent)) + if (clashCount >= 1) { + if (clashCount == 1 || !d->currentAction || (currentSelected && !firstAfterCurrent)) next_action = first; else next_action = firstAfterCurrent; } - if(next_action) { + if (next_action) { key_consumed = true; d->setCurrentAction(next_action, true, true); } } - if(key_consumed) + if (key_consumed) e->accept(); else e->ignore(); @@ -1231,7 +1231,7 @@ void QMenuBar::mouseMoveEvent(QMouseEvent *e) void QMenuBar::leaveEvent(QEvent *) { Q_D(QMenuBar); - if((!hasFocus() && !d->popupState) || + if ((!hasFocus() && !d->popupState) || (d->currentAction && d->currentAction->menu() == nullptr)) d->setCurrentAction(nullptr); } @@ -1322,10 +1322,10 @@ void QMenuBar::actionEvent(QActionEvent *e) } } - if(e->type() == QEvent::ActionAdded) { + if (e->type() == QEvent::ActionAdded) { connect(e->action(), SIGNAL(triggered()), this, SLOT(_q_actionTriggered())); connect(e->action(), SIGNAL(hovered()), this, SLOT(_q_actionHovered())); - } else if(e->type() == QEvent::ActionRemoved) { + } else if (e->type() == QEvent::ActionRemoved) { e->action()->disconnect(this); } // updateGeometries() is also needed for native menu bars because @@ -1342,7 +1342,7 @@ void QMenuBar::actionEvent(QActionEvent *e) void QMenuBar::focusInEvent(QFocusEvent *) { Q_D(QMenuBar); - if(d->keyboardState) + if (d->keyboardState) d->focusFirstAction(); } @@ -1352,7 +1352,7 @@ void QMenuBar::focusInEvent(QFocusEvent *) void QMenuBar::focusOutEvent(QFocusEvent *) { Q_D(QMenuBar); - if(!d->popupState) { + if (!d->popupState) { d->setCurrentAction(nullptr); d->setKeyboardMode(false); } @@ -1431,10 +1431,10 @@ void QMenuBarPrivate::handleReparent() void QMenuBar::changeEvent(QEvent *e) { Q_D(QMenuBar); - if(e->type() == QEvent::StyleChange) { + if (e->type() == QEvent::StyleChange) { d->itemsDirty = true; setMouseTracking(style()->styleHint(QStyle::SH_MenuBar_MouseTracking, nullptr, this)); - if(parentWidget()) + if (parentWidget()) resize(parentWidget()->width(), heightForWidth(parentWidget()->width())); d->updateGeometries(); } else if (e->type() == QEvent::ParentChange) { @@ -1458,12 +1458,12 @@ bool QMenuBar::event(QEvent *e) case QEvent::KeyPress: { QKeyEvent *ke = (QKeyEvent*)e; #if 0 - if(!d->keyboardState) { //all keypresses.. + if (!d->keyboardState) { //all keypresses.. d->setCurrentAction(0); return ; } #endif - if(ke->key() == Qt::Key_Tab || ke->key() == Qt::Key_Backtab) { + if (ke->key() == Qt::Key_Tab || ke->key() == Qt::Key_Backtab) { keyPressEvent(ke); return true; } @@ -1622,7 +1622,7 @@ QSize QMenuBar::minimumSizeHint() const const int vmargin = style()->pixelMetric(QStyle::PM_MenuBarVMargin, nullptr, this); int fw = style()->pixelMetric(QStyle::PM_MenuBarPanelWidth, nullptr, this); int spaceBelowMenuBar = style()->styleHint(QStyle::SH_MainWindow_SpaceBelowMenuBar, nullptr, this); - if(as_gui_menubar) { + if (as_gui_menubar) { int w = parentWidget() ? parentWidget()->width() : QGuiApplication::primaryScreen()->virtualGeometry().width(); d->calcActionRects(w - (2 * fw), 0); for (int i = 0; ret.isNull() && i < d->actions.count(); ++i) @@ -1632,19 +1632,19 @@ QSize QMenuBar::minimumSizeHint() const ret += QSize(2*fw + hmargin, 2*fw + vmargin); } int margin = 2*vmargin + 2*fw + spaceBelowMenuBar; - if(d->leftWidget) { + if (d->leftWidget) { QSize sz = d->leftWidget->minimumSizeHint(); ret.setWidth(ret.width() + sz.width()); - if(sz.height() + margin > ret.height()) + if (sz.height() + margin > ret.height()) ret.setHeight(sz.height() + margin); } - if(d->rightWidget) { + if (d->rightWidget) { QSize sz = d->rightWidget->minimumSizeHint(); ret.setWidth(ret.width() + sz.width()); - if(sz.height() + margin > ret.height()) + if (sz.height() + margin > ret.height()) ret.setHeight(sz.height() + margin); } - if(as_gui_menubar) { + if (as_gui_menubar) { QStyleOptionMenuItem opt; opt.rect = rect(); opt.menuRect = rect(); @@ -1672,7 +1672,7 @@ QSize QMenuBar::sizeHint() const const int vmargin = style()->pixelMetric(QStyle::PM_MenuBarVMargin, nullptr, this); int fw = style()->pixelMetric(QStyle::PM_MenuBarPanelWidth, nullptr, this); int spaceBelowMenuBar = style()->styleHint(QStyle::SH_MainWindow_SpaceBelowMenuBar, nullptr, this); - if(as_gui_menubar) { + if (as_gui_menubar) { const int w = parentWidget() ? parentWidget()->width() : QGuiApplication::primaryScreen()->virtualGeometry().width(); d->calcActionRects(w - (2 * fw), 0); for (int i = 0; i < d->actionRects.count(); ++i) { @@ -1684,18 +1684,18 @@ QSize QMenuBar::sizeHint() const ret += QSize(fw + hmargin, fw + vmargin); } int margin = 2*vmargin + 2*fw + spaceBelowMenuBar; - if(d->leftWidget) { + if (d->leftWidget) { QSize sz = d->leftWidget->sizeHint(); sz.rheight() += margin; ret = ret.expandedTo(sz); } - if(d->rightWidget) { + if (d->rightWidget) { QSize sz = d->rightWidget->sizeHint(); ret.setWidth(ret.width() + sz.width()); - if(sz.height() + margin > ret.height()) + if (sz.height() + margin > ret.height()) ret.setHeight(sz.height() + margin); } - if(as_gui_menubar) { + if (as_gui_menubar) { QStyleOptionMenuItem opt; opt.rect = rect(); opt.menuRect = rect(); @@ -1721,7 +1721,7 @@ int QMenuBar::heightForWidth(int) const const int vmargin = style()->pixelMetric(QStyle::PM_MenuBarVMargin, nullptr, this); int fw = style()->pixelMetric(QStyle::PM_MenuBarPanelWidth, nullptr, this); int spaceBelowMenuBar = style()->styleHint(QStyle::SH_MainWindow_SpaceBelowMenuBar, nullptr, this); - if(as_gui_menubar) { + if (as_gui_menubar) { for (int i = 0; i < d->actionRects.count(); ++i) height = qMax(height, d->actionRects.at(i).height()); if (height) //there is at least one non-null item @@ -1730,11 +1730,11 @@ int QMenuBar::heightForWidth(int) const height += 2*vmargin; } int margin = 2*vmargin + 2*fw + spaceBelowMenuBar; - if(d->leftWidget) + if (d->leftWidget) height = qMax(d->leftWidget->sizeHint().height() + margin, height); - if(d->rightWidget) + if (d->rightWidget) height = qMax(d->rightWidget->sizeHint().height() + margin, height); - if(as_gui_menubar) { + if (as_gui_menubar) { QStyleOptionMenuItem opt; opt.initFrom(this); opt.menuRect = rect(); diff --git a/src/widgets/widgets/qplaintextedit.cpp b/src/widgets/widgets/qplaintextedit.cpp index 2b91ca2ecb..ed2370f65a 100644 --- a/src/widgets/widgets/qplaintextedit.cpp +++ b/src/widgets/widgets/qplaintextedit.cpp @@ -2317,7 +2317,7 @@ void QPlainTextEdit::changeEvent(QEvent *e) if (e->type() == QEvent::ApplicationFontChange || e->type() == QEvent::FontChange) { d->control->document()->setDefaultFont(font()); - } else if(e->type() == QEvent::ActivationChange) { + } else if (e->type() == QEvent::ActivationChange) { if (!isActiveWindow()) d->autoScrollTimer.stop(); } else if (e->type() == QEvent::EnabledChange) { diff --git a/src/widgets/widgets/qpushbutton.cpp b/src/widgets/widgets/qpushbutton.cpp index 65c0966092..0ae74cb85b 100644 --- a/src/widgets/widgets/qpushbutton.cpp +++ b/src/widgets/widgets/qpushbutton.cpp @@ -352,7 +352,7 @@ void QPushButton::setAutoDefault(bool enable) bool QPushButton::autoDefault() const { Q_D(const QPushButton); - if(d->autoDefault == QPushButtonPrivate::Auto) + if (d->autoDefault == QPushButtonPrivate::Auto) return ( d->dialogParent() != nullptr ); return d->autoDefault; } @@ -418,9 +418,9 @@ QSize QPushButton::sizeHint() const s = QStringLiteral("XXXX"); QFontMetrics fm = fontMetrics(); QSize sz = fm.size(Qt::TextShowMnemonic, s); - if(!empty || !w) + if (!empty || !w) w += sz.width(); - if(!empty || !h) + if (!empty || !h) h = qMax(h, sz.height()); opt.rect.setSize(QSize(w, h)); // PM_MenuButtonIndicator depends on the height #if QT_CONFIG(menu) diff --git a/src/widgets/widgets/qsplitter.cpp b/src/widgets/widgets/qsplitter.cpp index 46d49391ba..619b3788c8 100644 --- a/src/widgets/widgets/qsplitter.cpp +++ b/src/widgets/widgets/qsplitter.cpp @@ -1652,7 +1652,7 @@ void QSplitter::setHandleWidth(int width) void QSplitter::changeEvent(QEvent *ev) { Q_D(QSplitter); - if(ev->type() == QEvent::StyleChange) + if (ev->type() == QEvent::StyleChange) d->updateHandles(); QFrame::changeEvent(ev); } diff --git a/src/widgets/widgets/qtabbar.cpp b/src/widgets/widgets/qtabbar.cpp index 2c65240434..b21e038843 100644 --- a/src/widgets/widgets/qtabbar.cpp +++ b/src/widgets/widgets/qtabbar.cpp @@ -2274,7 +2274,7 @@ void QTabBarPrivate::moveTabFinished(int index) } #endif // animation if (allAnimationsFinished && cleanup) { - if(movingTab) + if (movingTab) movingTab->setVisible(false); // We might not get a mouse release for (auto tab : qAsConst(tabList)) { tab->dragOffset = 0; diff --git a/src/widgets/widgets/qtabwidget.cpp b/src/widgets/widgets/qtabwidget.cpp index 3c2bc4f66b..34f9384cdf 100644 --- a/src/widgets/widgets/qtabwidget.cpp +++ b/src/widgets/widgets/qtabwidget.cpp @@ -469,7 +469,7 @@ int QTabWidget::insertTab(int index, QWidget *w, const QString &label) int QTabWidget::insertTab(int index, QWidget *w, const QIcon& icon, const QString &label) { Q_D(QTabWidget); - if(!w) + if (!w) return -1; index = d->stack->insertWidget(index, w); d->tabs->insertTab(index, icon, label); @@ -878,7 +878,7 @@ QSize QTabWidget::sizeHint() const if (d->leftCornerWidget) lc = d->leftCornerWidget->sizeHint(); - if(d->rightCornerWidget) + if (d->rightCornerWidget) rc = d->rightCornerWidget->sizeHint(); if (!d->dirty) { QTabWidget *that = const_cast<QTabWidget*>(this); @@ -916,9 +916,9 @@ QSize QTabWidget::minimumSizeHint() const Q_D(const QTabWidget); QSize lc(0, 0), rc(0, 0); - if(d->leftCornerWidget) + if (d->leftCornerWidget) lc = d->leftCornerWidget->minimumSizeHint(); - if(d->rightCornerWidget) + if (d->rightCornerWidget) rc = d->rightCornerWidget->minimumSizeHint(); if (!d->dirty) { QTabWidget *that = const_cast<QTabWidget*>(this); @@ -954,7 +954,7 @@ int QTabWidget::heightForWidth(int width) const QSize lc(0, 0), rc(0, 0); if (d->leftCornerWidget) lc = d->leftCornerWidget->sizeHint(); - if(d->rightCornerWidget) + if (d->rightCornerWidget) rc = d->rightCornerWidget->sizeHint(); if (!d->dirty) { QTabWidget *that = const_cast<QTabWidget*>(this); diff --git a/src/widgets/widgets/qtextbrowser.cpp b/src/widgets/widgets/qtextbrowser.cpp index 05f73dd5df..753655909c 100644 --- a/src/widgets/widgets/qtextbrowser.cpp +++ b/src/widgets/widgets/qtextbrowser.cpp @@ -502,7 +502,7 @@ void QTextBrowserPrivate::keypadMove(bool next) // up e.g. 110% // Obviously if a link is entirely visible, we still // focus it. - if(bothViewRects.contains(desiredRect) + if (bothViewRects.contains(desiredRect) || bothViewRects.adjusted(0, visibleLinkAmount, 0, -visibleLinkAmount).intersects(desiredRect)) { focusIt = true; @@ -531,7 +531,7 @@ void QTextBrowserPrivate::keypadMove(bool next) if (!focusIt && prevFocus.hasSelection()) { QRectF desiredRect = control->selectionRect(prevFocus); // XXX this may be better off also using the visibleLinkAmount value - if(newViewRect.intersects(desiredRect)) { + if (newViewRect.intersects(desiredRect)) { focusedPos = scrollYOffset; focusIt = true; anchorToFocus = prevFocus; diff --git a/src/widgets/widgets/qtextedit.cpp b/src/widgets/widgets/qtextedit.cpp index f7483b02de..ad307606d1 100644 --- a/src/widgets/widgets/qtextedit.cpp +++ b/src/widgets/widgets/qtextedit.cpp @@ -1915,7 +1915,7 @@ void QTextEdit::changeEvent(QEvent *e) if (e->type() == QEvent::ApplicationFontChange || e->type() == QEvent::FontChange) { d->control->document()->setDefaultFont(font()); - } else if(e->type() == QEvent::ActivationChange) { + } else if (e->type() == QEvent::ActivationChange) { if (!isActiveWindow()) d->autoScrollTimer.stop(); } else if (e->type() == QEvent::EnabledChange) { diff --git a/src/widgets/widgets/qtoolbarlayout.cpp b/src/widgets/widgets/qtoolbarlayout.cpp index 3d1ed5dedf..c5af8697dc 100644 --- a/src/widgets/widgets/qtoolbarlayout.cpp +++ b/src/widgets/widgets/qtoolbarlayout.cpp @@ -460,7 +460,7 @@ bool QToolBarLayout::layoutActions(const QSize &size) if (space <= 0) return false; // nothing to do. - if(popupMenu) + if (popupMenu) popupMenu->clear(); bool ranOutOfSpace = false; diff --git a/src/widgets/widgets/qtoolbox.cpp b/src/widgets/widgets/qtoolbox.cpp index acd306b7f6..cbb25ec159 100644 --- a/src/widgets/widgets/qtoolbox.cpp +++ b/src/widgets/widgets/qtoolbox.cpp @@ -713,7 +713,7 @@ void QToolBox::showEvent(QShowEvent *e) void QToolBox::changeEvent(QEvent *ev) { Q_D(QToolBox); - if(ev->type() == QEvent::StyleChange) + if (ev->type() == QEvent::StyleChange) d->updateTabs(); QFrame::changeEvent(ev); } diff --git a/src/widgets/widgets/qtoolbutton.cpp b/src/widgets/widgets/qtoolbutton.cpp index 30ac2f219c..1b04f3df72 100644 --- a/src/widgets/widgets/qtoolbutton.cpp +++ b/src/widgets/widgets/qtoolbutton.cpp @@ -628,7 +628,7 @@ void QToolButton::mouseReleaseEvent(QMouseEvent *e) bool QToolButton::hitButton(const QPoint &pos) const { Q_D(const QToolButton); - if(QAbstractButton::hitButton(pos)) + if (QAbstractButton::hitButton(pos)) return (d->buttonPressed != QToolButtonPrivate::MenuButtonPressed); return false; } diff --git a/src/widgets/widgets/qwidgetlinecontrol.cpp b/src/widgets/widgets/qwidgetlinecontrol.cpp index 08f3133b96..29ac32cadc 100644 --- a/src/widgets/widgets/qwidgetlinecontrol.cpp +++ b/src/widgets/widgets/qwidgetlinecontrol.cpp @@ -669,7 +669,7 @@ void QWidgetLineControl::draw(QPainter *painter, const QPoint &offset, const QRe void QWidgetLineControl::selectWordAtPos(int cursor) { int next = cursor + 1; - if(next > end()) + if (next > end()) --next; int c = textLayout()->previousCursorPosition(next, QTextLayout::SkipWords); moveCursor(c, false); diff --git a/src/xml/dom/qdom.cpp b/src/xml/dom/qdom.cpp index 5f8a93e290..585e6875e2 100644 --- a/src/xml/dom/qdom.cpp +++ b/src/xml/dom/qdom.cpp @@ -301,7 +301,7 @@ static QString fixedPubidLiteral(const QString &data, bool *ok) QString result; - if(QXmlUtils::isPublicID(data)) + if (QXmlUtils::isPublicID(data)) result = data; else if (QDomImplementationPrivate::invalidDataPolicy == QDomImplementation::ReturnNullNode) { *ok = false; @@ -1031,7 +1031,7 @@ QDomNodePrivate* QDomNodePrivate::insertBefore(QDomNodePrivate* newChild, QDomNo // "mark lists as dirty" QDomDocumentPrivate *const doc = ownerDocument(); - if(doc) + if (doc) doc->nodeListTime++; // Special handling for inserting a fragment. We just insert @@ -1126,7 +1126,7 @@ QDomNodePrivate* QDomNodePrivate::insertAfter(QDomNodePrivate* newChild, QDomNod // "mark lists as dirty" QDomDocumentPrivate *const doc = ownerDocument(); - if(doc) + if (doc) doc->nodeListTime++; // Special handling for inserting a fragment. We just insert @@ -1217,7 +1217,7 @@ QDomNodePrivate* QDomNodePrivate::replaceChild(QDomNodePrivate* newChild, QDomNo // mark lists as dirty QDomDocumentPrivate *const doc = ownerDocument(); - if(doc) + if (doc) doc->nodeListTime++; // Special handling for inserting a fragment. We just insert @@ -1308,7 +1308,7 @@ QDomNodePrivate* QDomNodePrivate::removeChild(QDomNodePrivate* oldChild) // "mark lists as dirty" QDomDocumentPrivate *const doc = ownerDocument(); - if(doc) + if (doc) doc->nodeListTime++; // Perhaps oldChild was just created with "createElement" or that. In this case @@ -2186,7 +2186,7 @@ void QDomNode::save(QTextStream& stream, int indent, EncodingPolicy encodingPoli if (!impl) return; - if(isDocument()) + if (isDocument()) static_cast<const QDomDocumentPrivate *>(impl)->saveDocument(stream, indent, encodingPolicy); else IMPL->save(stream, 1, indent); @@ -2216,7 +2216,7 @@ QTextStream& operator<<(QTextStream& str, const QDomNode& node) */ bool QDomNode::isAttr() const { - if(impl) + if (impl) return impl->isAttr(); return false; } @@ -2233,7 +2233,7 @@ bool QDomNode::isAttr() const */ bool QDomNode::isCDATASection() const { - if(impl) + if (impl) return impl->isCDATASection(); return false; } @@ -2250,7 +2250,7 @@ bool QDomNode::isCDATASection() const */ bool QDomNode::isDocumentFragment() const { - if(impl) + if (impl) return impl->isDocumentFragment(); return false; } @@ -2265,7 +2265,7 @@ bool QDomNode::isDocumentFragment() const */ bool QDomNode::isDocument() const { - if(impl) + if (impl) return impl->isDocument(); return false; } @@ -2282,7 +2282,7 @@ bool QDomNode::isDocument() const */ bool QDomNode::isDocumentType() const { - if(impl) + if (impl) return impl->isDocumentType(); return false; } @@ -2297,7 +2297,7 @@ bool QDomNode::isDocumentType() const */ bool QDomNode::isElement() const { - if(impl) + if (impl) return impl->isElement(); return false; } @@ -2314,7 +2314,7 @@ bool QDomNode::isElement() const */ bool QDomNode::isEntityReference() const { - if(impl) + if (impl) return impl->isEntityReference(); return false; } @@ -2329,7 +2329,7 @@ bool QDomNode::isEntityReference() const */ bool QDomNode::isText() const { - if(impl) + if (impl) return impl->isText(); return false; } @@ -2344,7 +2344,7 @@ bool QDomNode::isText() const */ bool QDomNode::isEntity() const { - if(impl) + if (impl) return impl->isEntity(); return false; } @@ -2359,7 +2359,7 @@ bool QDomNode::isEntity() const */ bool QDomNode::isNotation() const { - if(impl) + if (impl) return impl->isNotation(); return false; } @@ -2376,7 +2376,7 @@ bool QDomNode::isNotation() const */ bool QDomNode::isProcessingInstruction() const { - if(impl) + if (impl) return impl->isProcessingInstruction(); return false; } @@ -3720,7 +3720,7 @@ void QDomAttrPrivate::save(QTextStream& s, int, int) const * a different namespace. However, this can only occur by the user modifying the element, * and we don't do fixups by that anyway, and hence it's the user responsibility to not * arrive in those situations. */ - if(!ownerNode || + if (!ownerNode || ownerNode->prefix != prefix) { s << " xmlns:" << prefix << "=\"" << encodeText(namespaceURI, true, true) << '\"'; } @@ -4097,7 +4097,7 @@ void QDomElementPrivate::save(QTextStream& s, int depth, int indent) const * a different namespace. However, this can only occur by the user modifying the element, * and we don't do fixups by that anyway, and hence it's the user responsibility to not * arrive in those situations. */ - if((!it.value()->ownerNode || + if ((!it.value()->ownerNode || it.value()->ownerNode->prefix != it.value()->prefix) && !outputtedPrefixes.hasSeen(it.value()->prefix)) { s << " xmlns:" << it.value()->prefix << "=\"" << encodeText(it.value()->namespaceURI, true, true) << '\"'; @@ -5898,7 +5898,7 @@ void QDomDocumentPrivate::saveDocument(QTextStream& s, const int indent, QDomNod { const QDomNodePrivate* n = first; - if(encUsed == QDomNode::EncodingFromDocument) { + if (encUsed == QDomNode::EncodingFromDocument) { #if QT_CONFIG(regularexpression) const QDomNodePrivate* n = first; @@ -5945,7 +5945,7 @@ void QDomDocumentPrivate::saveDocument(QTextStream& s, const int indent, QDomNod // First, we try to find the PI and sets the startNode to the one appearing after it. while (n) { - if(n->isProcessingInstruction() && n->nodeName() == QLatin1String("xml")) { + if (n->isProcessingInstruction() && n->nodeName() == QLatin1String("xml")) { startNode = n->next; break; } |