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>
This commit is contained in:
parent
802e5a45ba
commit
e13173c112
@ -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();
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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();
|
||||
|
@ -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();
|
||||
|
@ -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());
|
||||
|
@ -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)) {
|
||||
|
@ -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());
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -529,7 +529,7 @@ private:
|
||||
*/
|
||||
inline void setType(const QXmlStreamReader::TokenType t)
|
||||
{
|
||||
if(type != QXmlStreamReader::Invalid)
|
||||
if (type != QXmlStreamReader::Invalid)
|
||||
type = t;
|
||||
}
|
||||
};
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -275,7 +275,7 @@ public:
|
||||
|
||||
inline qint64 sizeNextBlock() const
|
||||
{
|
||||
if(buffers.isEmpty())
|
||||
if (buffers.isEmpty())
|
||||
return 0;
|
||||
else
|
||||
return buffers.first().size() - firstPos;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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();
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
@ -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) {
|
||||
|
@ -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)
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
@ -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();
|
||||
|
@ -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 */
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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)
|
||||
|
@ -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();
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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));
|
||||
|
@ -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;
|
||||
|
@ -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)) {
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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];
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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)
|
||||
|
@ -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 {
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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) {
|
||||
|
@ -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();
|
||||
|
@ -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
|
||||
|
@ -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("\".\""));
|
||||
|
@ -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("\".\""));
|
||||
|
@ -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("`.`"));
|
||||
}
|
||||
|
@ -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("\".\""));
|
||||
|
@ -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));
|
||||
|
@ -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));
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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));
|
||||
|
@ -257,7 +257,7 @@ bool QSqlCachedResult::cacheNext()
|
||||
if (d->atEnd)
|
||||
return false;
|
||||
|
||||
if(isForwardOnly()) {
|
||||
if (isForwardOnly()) {
|
||||
d->cache.resize(d->colCount);
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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 */;
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
@ -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();
|
||||
|
@ -61,7 +61,7 @@ int loadFileDialog()
|
||||
QFileDialog dialog;
|
||||
dialog.setSidebarUrls(urls);
|
||||
dialog.setFileMode(QFileDialog::AnyFile);
|
||||
if(dialog.exec()) {
|
||||
if (dialog.exec()) {
|
||||
// ...
|
||||
}
|
||||
//![0]
|
||||
|
@ -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())
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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()) {
|
||||
|
@ -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;
|
||||
|
@ -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();
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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));
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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:
|
||||
|
@ -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());
|
||||
|
@ -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
|
||||
|
@ -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();
|
||||
|
@ -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()) {
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
@ -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();
|
||||
|
@ -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) {
|
||||
|
@ -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)
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
@ -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) {
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user