Whitespace cleanup in corelib/kernel

Change-Id: If061ef0af5ced4384e20a82afcea3712fa7e45d7
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
This commit is contained in:
Allan Sandfeld Jensen 2020-10-20 10:13:49 +02:00
parent c4245e7b8c
commit c2cf5f824a
37 changed files with 359 additions and 344 deletions

View File

@ -263,7 +263,9 @@ public:
Q_DISABLE_COPY(QAppleLogActivity)
QAppleLogActivity(QAppleLogActivity &&other)
: activity(qExchange(other.activity, nullptr)), state(other.state) {}
: activity(qExchange(other.activity, nullptr)), state(other.state)
{
}
QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_MOVE_AND_SWAP(QAppleLogActivity)
@ -274,7 +276,8 @@ public:
return std::move(*this);
}
void leave() {
void leave()
{
if (activity)
os_activity_scope_leave(&state);
}
@ -334,7 +337,10 @@ public:
#endif
QMacNotificationObserver(const QMacNotificationObserver &other) = delete;
QMacNotificationObserver(QMacNotificationObserver&& other) : observer(qExchange(other.observer, nullptr)) {}
QMacNotificationObserver(QMacNotificationObserver &&other)
: observer(qExchange(other.observer, nullptr))
{
}
QMacNotificationObserver &operator=(const QMacNotificationObserver &other) = delete;
QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_MOVE_AND_SWAP(QMacNotificationObserver)
@ -378,7 +384,8 @@ public:
~QMacKeyValueObserver() { removeObserver(); }
QMacKeyValueObserver &operator=(const QMacKeyValueObserver &other) {
QMacKeyValueObserver &operator=(const QMacKeyValueObserver &other)
{
QMacKeyValueObserver tmp(other);
swap(tmp);
return *this;

View File

@ -60,5 +60,4 @@ QString qAppFileName()
return appFileName;
}
QT_END_NAMESPACE

View File

@ -350,6 +350,7 @@ public:
explicit QTimerEvent(int timerId);
~QTimerEvent();
int timerId() const { return id; }
protected:
int id;
};
@ -365,6 +366,7 @@ public:
bool added() const { return type() == ChildAdded; }
bool polished() const { return type() == ChildPolished; }
bool removed() const { return type() == ChildRemoved; }
protected:
QObject *c;
};
@ -387,6 +389,7 @@ public:
explicit QDeferredDeleteEvent();
~QDeferredDeleteEvent();
int loopLevel() const { return level; }
private:
int level;
friend class QCoreApplication;

View File

@ -61,7 +61,8 @@
QT_BEGIN_NAMESPACE
struct QCoreGlobalData {
struct QCoreGlobalData
{
QCoreGlobalData();
~QCoreGlobalData();
@ -71,7 +72,5 @@ struct QCoreGlobalData {
static QCoreGlobalData *instance();
};
QT_END_NAMESPACE
#endif // QCOREGLOBALDATA_P_H

View File

@ -212,7 +212,6 @@ QT_BEGIN_NAMESPACE
\sa isValid(), start()
*/
/*!
\fn bool QElapsedTimer::operator ==(const QElapsedTimer &other) const

View File

@ -44,7 +44,6 @@
QT_BEGIN_NAMESPACE
class QEventLoopPrivate;
class Q_CORE_EXPORT QEventLoop : public QObject
@ -84,7 +83,6 @@ public Q_SLOTS:
Q_DECLARE_OPERATORS_FOR_FLAGS(QEventLoop::ProcessEventsFlags)
class QEventLoopLockerPrivate;
class Q_CORE_EXPORT QEventLoopLocker

View File

@ -43,7 +43,6 @@
static const char logTag[] = "QtCore";
Q_CORE_EXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void *reserved)
{
Q_UNUSED(reserved);
@ -63,16 +62,14 @@ Q_CORE_EXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void *reserved)
_JNIEnv uenv;
uenv.venv = nullptr;
if (vm->GetEnv(&uenv.venv, JNI_VERSION_1_6) != JNI_OK)
{
if (vm->GetEnv(&uenv.venv, JNI_VERSION_1_6) != JNI_OK) {
__android_log_print(ANDROID_LOG_FATAL, logTag, "GetEnv failed");
return JNI_ERR;
}
JNIEnv *env = uenv.nenv;
const jint ret = QT_PREPEND_NAMESPACE(QtAndroidPrivate::initJNI(vm, env));
if (ret != 0)
{
if (ret != 0) {
__android_log_print(ANDROID_LOG_FATAL, logTag, "initJNI failed");
return ret;
}

View File

@ -268,7 +268,8 @@ constexpr inline long double qRadiansToDegrees(long double radians)
// using integral datatypes...
namespace QtPrivate {
constexpr inline quint32 qConstexprNextPowerOfTwo(quint32 v) {
constexpr inline quint32 qConstexprNextPowerOfTwo(quint32 v)
{
v |= v >> 1;
v |= v >> 2;
v |= v >> 4;
@ -278,7 +279,8 @@ constexpr inline quint32 qConstexprNextPowerOfTwo(quint32 v) {
return v;
}
constexpr inline quint64 qConstexprNextPowerOfTwo(quint64 v) {
constexpr inline quint64 qConstexprNextPowerOfTwo(quint64 v)
{
v |= v >> 1;
v |= v >> 2;
v |= v >> 4;

View File

@ -2666,7 +2666,6 @@ int QMetaEnum::value(int index) const
return -1;
}
/*!
Returns \c true if this enumerator is used as a flag; otherwise returns
false.
@ -2861,7 +2860,6 @@ QMetaEnum::QMetaEnum(const QMetaObject *mobj, int index)
The enum needs to be declared with Q_ENUM.
*/
/*!
\class QMetaProperty
\inmodule QtCore
@ -3416,7 +3414,6 @@ bool QMetaProperty::isWritable() const
return data.flags() & Writable;
}
/*!
Returns \c false if the \c{Q_PROPERTY()}'s \c DESIGNABLE attribute
is false; otherwise returns \c true.
@ -3554,7 +3551,6 @@ bool QMetaProperty::isBindable() const
\sa QMetaObject
*/
/*!
\fn QMetaClassInfo::QMetaClassInfo()
\internal
@ -3603,7 +3599,6 @@ const char* QMetaClassInfo::value() const
our state machine and dbus.
*/
/*!
\macro QGenericArgument Q_ARG(Type, const Type &value)
\relates QMetaObject

View File

@ -243,7 +243,9 @@ public:
inline bool isValid() const { return name() != nullptr; }
template<typename T> static QMetaEnum fromType() {
template<typename T>
static QMetaEnum fromType()
{
static_assert(QtPrivate::IsQEnumHelper<T>::Value,
"QMetaEnum::fromType only works with enums declared as "
"Q_ENUM, Q_ENUM_NS, Q_FLAG or Q_FLAG_NS");
@ -363,6 +365,7 @@ public:
const char *name() const;
const char *value() const;
inline const QMetaObject *enclosingMetaObject() const { return mobj; }
private:
struct Data {
enum { Size = 2 };

View File

@ -210,7 +210,8 @@ struct QMetaObjectPrivate
static int indexOfConstructor(const QMetaObject *m, const QByteArray &name,
int argc, const QArgumentType *types);
Q_CORE_EXPORT static QMetaMethod signal(const QMetaObject *m, int signal_index);
static inline int signalOffset(const QMetaObject *m) {
static inline int signalOffset(const QMetaObject *m)
{
Q_ASSERT(m != nullptr);
int offset = 0;
for (m = m->d.superdata; m; m = m->d.superdata)

View File

@ -253,8 +253,8 @@ QMetaObjectBuilder::QMetaObjectBuilder()
\sa addMetaObject()
*/
QMetaObjectBuilder::QMetaObjectBuilder
(const QMetaObject *prototype, QMetaObjectBuilder::AddMembers members)
QMetaObjectBuilder::QMetaObjectBuilder(const QMetaObject *prototype,
QMetaObjectBuilder::AddMembers members)
{
d = new QMetaObjectBuilderPrivate();
addMetaObject(prototype, members);
@ -434,12 +434,11 @@ QMetaMethodBuilder QMetaObjectBuilder::addMethod(const QByteArray& signature)
\sa method(), methodCount(), removeMethod(), indexOfMethod()
*/
QMetaMethodBuilder QMetaObjectBuilder::addMethod
(const QByteArray& signature, const QByteArray& returnType)
QMetaMethodBuilder QMetaObjectBuilder::addMethod(const QByteArray &signature,
const QByteArray &returnType)
{
int index = int(d->methods.size());
d->methods.push_back(QMetaMethodBuilderPrivate
(QMetaMethod::Method, signature, returnType));
d->methods.push_back(QMetaMethodBuilderPrivate(QMetaMethod::Method, signature, returnType));
return QMetaMethodBuilder(this, index);
}
@ -500,8 +499,8 @@ QMetaMethodBuilder QMetaObjectBuilder::addSlot(const QByteArray& signature)
QMetaMethodBuilder QMetaObjectBuilder::addSignal(const QByteArray &signature)
{
int index = int(d->methods.size());
d->methods.push_back(QMetaMethodBuilderPrivate
(QMetaMethod::Signal, signature, QByteArray("void"), QMetaMethod::Public));
d->methods.push_back(QMetaMethodBuilderPrivate(QMetaMethod::Signal, signature,
QByteArray("void"), QMetaMethod::Public));
return QMetaMethodBuilder(this, index);
}
@ -554,8 +553,8 @@ QMetaMethodBuilder QMetaObjectBuilder::addConstructor(const QMetaMethod& prototy
\sa property(), propertyCount(), removeProperty(), indexOfProperty()
*/
QMetaPropertyBuilder QMetaObjectBuilder::addProperty
(const QByteArray& name, const QByteArray& type, int notifierId)
QMetaPropertyBuilder QMetaObjectBuilder::addProperty(const QByteArray &name, const QByteArray &type,
int notifierId)
{
int index = int(d->properties.size());
d->properties.push_back(QMetaPropertyBuilderPrivate(name, type, notifierId));
@ -673,8 +672,8 @@ int QMetaObjectBuilder::addRelatedMetaObject(const QMetaObject *meta)
The \a members parameter indicates which members of \a prototype
should be added. The default is AllMembers.
*/
void QMetaObjectBuilder::addMetaObject
(const QMetaObject *prototype, QMetaObjectBuilder::AddMembers members)
void QMetaObjectBuilder::addMetaObject(const QMetaObject *prototype,
QMetaObjectBuilder::AddMembers members)
{
Q_ASSERT(prototype);
int index;
@ -1507,7 +1506,8 @@ QByteArray QMetaObjectBuilder::toRelocatableData(bool *ok) const
{
int size = buildMetaObject(d, nullptr, 0, true);
if (size == -1) {
if (ok) *ok = false;
if (ok)
*ok = false;
return QByteArray();
}
@ -1516,7 +1516,8 @@ QByteArray QMetaObjectBuilder::toRelocatableData(bool *ok) const
char *buf = data.data();
memset(buf, 0, size);
buildMetaObject(d, buf, size, true);
if (ok) *ok = true;
if (ok)
*ok = true;
return data;
}
@ -1662,8 +1663,7 @@ void QMetaObjectBuilder::serialize(QDataStream& stream) const
}
// Resolve a class name using the name reference map.
static const QMetaObject *resolveClassName
(const QMap<QByteArray, const QMetaObject *>& references,
static const QMetaObject *resolveClassName(const QMap<QByteArray, const QMetaObject *> &references,
const QByteArray &name)
{
if (name == QByteArray("QObject"))
@ -2070,7 +2070,6 @@ int QMetaMethodBuilder::revision() const
if (d)
return d->revision;
return 0;
}
/*!
@ -2557,7 +2556,6 @@ int QMetaPropertyBuilder::revision() const
if (d)
return d->revision;
return 0;
}
/*!
@ -2572,7 +2570,6 @@ void QMetaPropertyBuilder::setRevision(int revision)
d->revision = revision;
}
/*!
\class QMetaEnumBuilder
\inmodule QtCore

View File

@ -1491,7 +1491,6 @@ Q_DECLARE_METATYPE_TEMPLATE_2ARG(std::pair)
#define Q_DECLARE_METATYPE_TEMPLATE_SMART_POINTER_ITER(TEMPLATENAME) \
Q_DECLARE_SMART_POINTER_METATYPE(TEMPLATENAME)
QT_FOR_EACH_AUTOMATIC_TEMPLATE_SMART_POINTER(Q_DECLARE_METATYPE_TEMPLATE_SMART_POINTER_ITER)
QT_BEGIN_NAMESPACE
@ -1500,7 +1499,6 @@ QT_BEGIN_NAMESPACE
QT_END_NAMESPACE
QT_FOR_EACH_STATIC_TYPE(Q_DECLARE_BUILTIN_METATYPE)
Q_DECLARE_METATYPE(QtMetaTypePrivate::QPairVariantInterfaceImpl)
@ -2219,7 +2217,9 @@ public:
static constexpr QMetaTypeInterface::DtorFn getDtor()
{
if constexpr (std::is_destructible_v<S>)
return [](const QMetaTypeInterface *, void *addr) { reinterpret_cast<S *>(addr)->~S(); };
return [](const QMetaTypeInterface *, void *addr) {
reinterpret_cast<S *>(addr)->~S();
};
else
return nullptr;
}
@ -2340,16 +2340,15 @@ constexpr const QMetaTypeInterface *qMetaTypeInterfaceForType()
}
namespace detail {
template<typename T, typename ODR_VIOLATION_PREVENTER>
struct is_complete_helper {
struct is_complete_helper
{
template<typename U>
static auto check(U *) -> std::integral_constant<bool, sizeof(U) != 0>;
static auto check(...) -> std::false_type;
using type = decltype(check(static_cast<T *>(nullptr)));
};
}
} // namespace detail
template <typename T, typename ODR_VIOLATION_PREVENTER>
struct is_complete : detail::is_complete_helper<T, ODR_VIOLATION_PREVENTER>::type {};

View File

@ -161,10 +161,10 @@ public:
extern Q_CORE_EXPORT const QMetaTypeModuleHelper *qMetaTypeGuiHelper;
extern Q_CORE_EXPORT const QMetaTypeModuleHelper *qMetaTypeWidgetsHelper;
namespace QtMetaTypePrivate {
template<typename T>
struct TypeDefinition {
struct TypeDefinition
{
static const bool IsAvailable = true;
};

View File

@ -45,7 +45,6 @@
QT_BEGIN_NAMESPACE
class QUrl;
class QMimeDataPrivate;
@ -84,8 +83,10 @@ public:
virtual QStringList formats() const;
void clear();
protected:
virtual QVariant retrieveData(const QString &mimetype, QMetaType preferredType) const;
private:
Q_DISABLE_COPY(QMimeData)
Q_DECLARE_PRIVATE(QMimeData)

View File

@ -109,7 +109,8 @@ static int *queuedConnectionTypes(const QMetaMethod& method)
typeIds[i] = metaType.id();
if (!typeIds[i]) {
const QByteArray typeName = method.parameterTypeName(i);
qCWarning(lcConnect, "QObject::connect: Cannot queue arguments of type '%s'\n"
qCWarning(lcConnect,
"QObject::connect: Cannot queue arguments of type '%s'\n"
"(Make sure '%s' is registered using qRegisterMetaType().)",
typeName.constData(), typeName.constData());
delete[] typeIds;
@ -134,7 +135,8 @@ static int *queuedConnectionTypes(const QArgumentType *argumentTypes, int argc)
types[i] = QMetaType::fromName(type.name()).id();
if (!types[i]) {
qCWarning(lcConnect, "QObject::connect: Cannot queue arguments of type '%s'\n"
qCWarning(lcConnect,
"QObject::connect: Cannot queue arguments of type '%s'\n"
"(Make sure '%s' is registered using qRegisterMetaType().)",
type.name().constData(), type.name().constData());
return nullptr;
@ -227,7 +229,8 @@ QObjectPrivate::~QObjectPrivate()
thisThreadData->deref();
if (metaObject) metaObject->objectDestroyed(q_ptr);
if (metaObject)
metaObject->objectDestroyed(q_ptr);
delete extraData;
}
@ -2197,7 +2200,6 @@ void QObject::removeEventFilter(QObject *obj)
}
}
/*!
\fn void QObject::destroyed(QObject *obj)
@ -2284,7 +2286,6 @@ void QObject::deleteLater()
Signals and slots
*****************************************************************************/
const char *qFlagLocation(const char *method)
{
QThreadData *currentThreadData = QThreadData::current(false);
@ -2316,22 +2317,23 @@ static bool check_signal_macro(const QObject *sender, const char *signal,
int sigcode = extract_code(signal);
if (sigcode != QSIGNAL_CODE) {
if (sigcode == QSLOT_CODE)
qCWarning(lcConnect, "QObject::%s: Attempt to %s non-signal %s::%s",
func, op, sender->metaObject()->className(), signal+1);
qCWarning(lcConnect, "QObject::%s: Attempt to %s non-signal %s::%s", func, op,
sender->metaObject()->className(), signal + 1);
else
qCWarning(lcConnect, "QObject::%s: Use the SIGNAL macro to %s %s::%s",
func, op, sender->metaObject()->className(), signal);
qCWarning(lcConnect, "QObject::%s: Use the SIGNAL macro to %s %s::%s", func, op,
sender->metaObject()->className(), signal);
return false;
}
return true;
}
static bool check_method_code(int code, const QObject *object,
const char *method, const char *func)
static bool check_method_code(int code, const QObject *object, const char *method, const char *func)
{
if (code != QSLOT_CODE && code != QSIGNAL_CODE) {
qCWarning(lcConnect, "QObject::%s: Use the SLOT or SIGNAL macro to "
"%s %s::%s", func, func, object->metaObject()->className(), method);
qCWarning(lcConnect,
"QObject::%s: Use the SLOT or SIGNAL macro to "
"%s %s::%s",
func, func, object->metaObject()->className(), method);
return false;
}
return true;
@ -2347,20 +2349,14 @@ static void err_method_notfound(const QObject *object,
}
const char *loc = extract_location(method);
if (strchr(method, ')') == nullptr) // common typing mistake
qCWarning(lcConnect, "QObject::%s: Parentheses expected, %s %s::%s%s%s",
func, type, object->metaObject()->className(), method+1,
loc ? " in ": "", loc ? loc : "");
qCWarning(lcConnect, "QObject::%s: Parentheses expected, %s %s::%s%s%s", func, type,
object->metaObject()->className(), method + 1, loc ? " in " : "", loc ? loc : "");
else
qCWarning(lcConnect, "QObject::%s: No such %s %s::%s%s%s",
func, type, object->metaObject()->className(), method+1,
loc ? " in ": "", loc ? loc : "");
qCWarning(lcConnect, "QObject::%s: No such %s %s::%s%s%s", func, type,
object->metaObject()->className(), method + 1, loc ? " in " : "", loc ? loc : "");
}
static void err_info_about_objects(const char * func,
const QObject * sender,
const QObject * receiver)
static void err_info_about_objects(const char *func, const QObject *sender, const QObject *receiver)
{
QString a = sender ? sender->objectName() : QString();
QString b = receiver ? receiver->objectName() : QString();
@ -2612,11 +2608,11 @@ static inline void check_and_warn_compat(const QMetaObject *sender, const QMetaM
if (!(method.attributes() & QMetaMethod::Compatibility))
qCWarning(lcConnect, "QObject::connect: Connecting from COMPAT signal (%s::%s)",
sender->className(), signal.methodSignature().constData());
} else if ((method.attributes() & QMetaMethod::Compatibility) &&
method.methodType() == QMetaMethod::Signal) {
} else if ((method.attributes() & QMetaMethod::Compatibility)
&& method.methodType() == QMetaMethod::Signal) {
qCWarning(lcConnect, "QObject::connect: Connecting from %s::%s to COMPAT slot (%s::%s)",
sender->className(), signal.methodSignature().constData(),
receiver->className(), method.methodSignature().constData());
sender->className(), signal.methodSignature().constData(), receiver->className(),
method.methodSignature().constData());
}
}
#endif
@ -2787,10 +2783,11 @@ QMetaObject::Connection QObject::connect(const QObject *sender, const char *sign
if (!QMetaObjectPrivate::checkConnectArgs(signalTypes.size(), signalTypes.constData(),
methodTypes.size(), methodTypes.constData())) {
qCWarning(lcConnect, "QObject::connect: Incompatible sender/receiver arguments"
qCWarning(lcConnect,
"QObject::connect: Incompatible sender/receiver arguments"
"\n %s::%s --> %s::%s",
sender->metaObject()->className(), signal,
receiver->metaObject()->className(), method);
sender->metaObject()->className(), signal, receiver->metaObject()->className(),
method);
return QMetaObject::Connection(nullptr);
}
@ -2867,17 +2864,18 @@ QMetaObject::Connection QObject::connect(const QObject *sender, const QMetaMetho
return QMetaObject::Connection(nullptr);
}
if (!QMetaObject::checkConnectArgs(signal.methodSignature().constData(), method.methodSignature().constData())) {
qCWarning(lcConnect, "QObject::connect: Incompatible sender/receiver arguments"
if (!QMetaObject::checkConnectArgs(signal.methodSignature().constData(),
method.methodSignature().constData())) {
qCWarning(lcConnect,
"QObject::connect: Incompatible sender/receiver arguments"
"\n %s::%s --> %s::%s",
smeta->className(), signal.methodSignature().constData(),
rmeta->className(), method.methodSignature().constData());
smeta->className(), signal.methodSignature().constData(), rmeta->className(),
method.methodSignature().constData());
return QMetaObject::Connection(nullptr);
}
int *types = nullptr;
if ((type == Qt::QueuedConnection)
&& !(types = queuedConnectionTypes(signal)))
if ((type == Qt::QueuedConnection) && !(types = queuedConnectionTypes(signal)))
return QMetaObject::Connection(nullptr);
#ifndef QT_NO_DEBUG
@ -3284,7 +3282,8 @@ static int methodIndexToSignalIndex(const QMetaObject **base, int signal_index)
from the sender to the receiver's slot
*/
QMetaObject::Connection QMetaObject::connect(const QObject *sender, int signal_index,
const QObject *receiver, int method_index, int type, int *types)
const QObject *receiver, int method_index, int type,
int *types)
{
const QMetaObject *smeta = sender->metaObject();
signal_index = methodIndexToSignalIndex(&smeta, signal_index);
@ -3613,7 +3612,8 @@ void QMetaObject::connectSlotsByName(QObject *o)
int iParen = slotSignature.indexOf('(');
int iLastUnderscore = slotSignature.lastIndexOf('_', iParen - 1);
if (iLastUnderscore > 3)
qCWarning(lcConnectSlotsByName, "QMetaObject::connectSlotsByName: No matching signal for %s", slot);
qCWarning(lcConnectSlotsByName,
"QMetaObject::connectSlotsByName: No matching signal for %s", slot);
}
}
}

View File

@ -86,7 +86,8 @@ Q_CORE_EXPORT void qt_qFindChildren_helper(const QObject *parent, const QRegular
const QMetaObject &mo, QList<void *> *list, Qt::FindChildOptions options);
Q_CORE_EXPORT QObject *qt_qFindChild_helper(const QObject *parent, const QString &name, const QMetaObject &mo, Qt::FindChildOptions options);
class Q_CORE_EXPORT QObjectData {
class Q_CORE_EXPORT QObjectData
{
Q_DISABLE_COPY(QObjectData)
public:
QObjectData() = default;
@ -113,7 +114,6 @@ public:
#endif
};
class Q_CORE_EXPORT QObject
{
Q_OBJECT
@ -384,7 +384,9 @@ public:
inline QObject *parent() const { return d_ptr->parent; }
inline bool inherits(const char *classname) const
{ return const_cast<QObject *>(this)->qt_metacast(classname) != nullptr; }
{
return const_cast<QObject *>(this)->qt_metacast(classname) != nullptr;
}
public Q_SLOTS:
void deleteLater();
@ -497,6 +499,7 @@ public:
inline void reblock() noexcept;
inline void unblock() noexcept;
private:
Q_DISABLE_COPY(QSignalBlocker)
QObject *m_o;
@ -548,13 +551,15 @@ QSignalBlocker::~QSignalBlocker()
void QSignalBlocker::reblock() noexcept
{
if (m_o) m_o->blockSignals(true);
if (m_o)
m_o->blockSignals(true);
m_inhibited = false;
}
void QSignalBlocker::unblock() noexcept
{
if (m_o) m_o->blockSignals(m_blocked);
if (m_o)
m_o->blockSignals(m_blocked);
m_inhibited = true;
}

View File

@ -123,7 +123,8 @@ public:
Connection *next;
};
static SignalVector *asSignalVector(ConnectionOrSignalVector *c) {
static SignalVector *asSignalVector(ConnectionOrSignalVector *c)
{
if (reinterpret_cast<quintptr>(c) & 1)
return reinterpret_cast<SignalVector *>(reinterpret_cast<quintptr>(c) & ~quintptr(1u));
return nullptr;
@ -171,7 +172,8 @@ public:
isSlotObject = false;
}
}
void deref() {
void deref()
{
if (!ref_.deref()) {
Q_ASSERT(!receiver.loadRelaxed());
Q_ASSERT(!isSlotObject);
@ -229,8 +231,6 @@ public:
int count() const { return static_cast<int>(allocated); }
};
/*
This contains the all connections from and to an object.
@ -278,7 +278,8 @@ public:
return signalVector.loadRelaxed()->at(signal);
}
void resizeSignalVector(uint size) {
void resizeSignalVector(uint size)
{
SignalVector *vector = this->signalVector.loadRelaxed();
if (vector && vector->allocated > size)
return;
@ -300,7 +301,8 @@ public:
orphaned.storeRelaxed(ConnectionOrSignalVector::fromSignalVector(vector));
}
}
int signalVectorCount() const {
int signalVectorCount() const
{
return signalVector.loadAcquire() ? signalVector.loadRelaxed()->count() : -1;
}
@ -324,9 +326,7 @@ public:
void addConnection(int signal, Connection *c);
static QObjectPrivate *get(QObject *o) {
return o->d_func();
}
static QObjectPrivate *get(QObject *o) { return o->d_func(); }
static const QObjectPrivate *get(const QObject *o) { return o->d_func(); }
int signalIndex(const char *signalName, const QMetaObject **meta = nullptr) const;
@ -578,6 +578,7 @@ class QBoolBlocker
public:
explicit inline QBoolBlocker(bool &b, bool value = true) : block(b), reset(b) { block = value; }
inline ~QBoolBlocker() { block = reset; }
private:
bool &block;
bool reset;

View File

@ -44,7 +44,6 @@
QT_BEGIN_NAMESPACE
class Q_CORE_EXPORT QObjectCleanupHandler : public QObject
{
Q_OBJECT

View File

@ -848,7 +848,8 @@ public:
explicit QObjectBindableProperty(Functor &&f);
#endif
parameter_type value() const {
parameter_type value() const
{
qGetBindingStorage(owner())->maybeUpdateBindingAndRegister(this);
return this->val;
}
@ -875,7 +876,8 @@ public:
return value();
}
void setValue(parameter_type t) {
void setValue(parameter_type t)
{
auto *bd = qGetBindingStorage(owner())->bindingData(this);
if (bd)
bd->removeBinding();
@ -885,7 +887,8 @@ public:
notify(bd);
}
void setValue(rvalue_ref t) {
void setValue(rvalue_ref t)
{
auto *bd = qGetBindingStorage(owner())->bindingData(this);
if (bd)
bd->removeBinding();
@ -936,7 +939,8 @@ public:
QPropertyBinding<T> setBinding(Functor f);
#endif
bool hasBinding() const {
bool hasBinding() const
{
auto *bd = qGetBindingStorage(owner())->bindingData(this);
return bd && bd->binding() != nullptr;
}
@ -1003,13 +1007,15 @@ class QObjectComputedProperty : public QUntypedPropertyData
char *that = const_cast<char *>(reinterpret_cast<const char *>(this));
return reinterpret_cast<Class *>(that - QtPrivate::detail::getOffset(Offset));
}
public:
using value_type = T;
using parameter_type = T;
QObjectComputedProperty() = default;
parameter_type value() const {
parameter_type value() const
{
qGetBindingStorage(owner())->maybeUpdateBindingAndRegister(this);
return (owner()->*Getter)();
}
@ -1055,6 +1061,7 @@ public:
auto *storage = const_cast<QBindingStorage *>(qGetBindingStorage(owner()));
return *storage->bindingData(const_cast<QObjectComputedProperty *>(this), true);
}
private:
};

View File

@ -226,7 +226,8 @@ public:
staticObserverCallback = nullptr;
}
}
void prependObserver(QPropertyObserverPointer observer) {
void prependObserver(QPropertyObserverPointer observer)
{
observer.ptr->prev = const_cast<QPropertyObserver **>(&firstObserver.ptr);
firstObserver = observer;
}
@ -254,7 +255,8 @@ public:
heapObservers->clear();
dependencyObserverCount = 0;
}
QPropertyObserverPointer allocateDependencyObserver() {
QPropertyObserverPointer allocateDependencyObserver()
{
if (dependencyObserverCount < inlineDependencyObservers.size()) {
++dependencyObserverCount;
return {&inlineDependencyObservers[dependencyObserverCount - 1]};
@ -280,7 +282,8 @@ public:
void setError(QPropertyBindingError &&e)
{ error = std::move(e); }
void detachFromProperty() {
void detachFromProperty()
{
hasStaticObserver = false;
hasBindingWrapper = false;
propertyDataPtr = nullptr;
@ -316,10 +319,10 @@ inline QPropertyObserverPointer QPropertyBindingDataPointer::firstObserver() con
{
if (auto *binding = bindingPtr())
return binding->firstObserver;
return {reinterpret_cast<QPropertyObserver*>(ptr->d_ptr & ~QtPrivate::QPropertyBindingData::FlagMask)};
return { reinterpret_cast<QPropertyObserver *>(ptr->d_ptr
& ~QtPrivate::QPropertyBindingData::FlagMask) };
}
template<typename Class, typename T, auto Offset, auto Setter>
class QObjectCompatProperty : public QPropertyData<T>
{
@ -363,7 +366,8 @@ public:
explicit QObjectCompatProperty(const T &initialValue) : QPropertyData<T>(initialValue) {}
explicit QObjectCompatProperty(T &&initialValue) : QPropertyData<T>(std::move(initialValue)) {}
parameter_type value() const {
parameter_type value() const
{
const QBindingStorage *storage = qGetBindingStorage(owner());
// make sure we don't register this binding as a dependency to itself
if (!inBindingWrapper(storage))
@ -393,7 +397,8 @@ public:
return value();
}
void setValue(parameter_type t) {
void setValue(parameter_type t)
{
QBindingStorage *storage = qGetBindingStorage(owner());
auto *bd = storage->bindingData(this);
// make sure we don't remove the binding if called from the bindingWrapper

View File

@ -49,7 +49,8 @@ class QSignalMapperPrivate : public QObjectPrivate
{
Q_DECLARE_PUBLIC(QSignalMapper)
public:
void _q_senderDestroyed() {
void _q_senderDestroyed()
{
Q_Q(QSignalMapper);
q->removeMappings(q->sender());
}

View File

@ -1062,7 +1062,6 @@ void QVariant::clear()
Returns \nullptr if the type is QMetaType::UnknownType or doesn't exist.
*/
/*!
\fn QVariant::Type QVariant::nameToType(const char *name)
\deprecated Use QMetaType instead
@ -2221,7 +2220,8 @@ static bool integralEquals(uint promotedType, const QVariant::Private *d1, const
namespace {
template<typename Numeric>
int spaceShip(Numeric lhs, Numeric rhs) {
int spaceShip(Numeric lhs, Numeric rhs)
{
bool smaller;
if constexpr (std::is_same_v<Numeric, QObject *>)
smaller = std::less<QObject *>()(lhs, rhs); // can't use less all the time because of bool
@ -2320,7 +2320,8 @@ static bool pointerEquals(const QVariant::Private *d1, const QVariant::Private *
return d1->get<QObject *>() == d2->get<QObject *>();
}
static int pointerCompare(const QVariant::Private *d1, const QVariant::Private *d2) {
static int pointerCompare(const QVariant::Private *d1, const QVariant::Private *d2)
{
return spaceShip<QObject *>(d1->get<QObject *>(), d2->get<QObject *>());
}
#endif
@ -2387,15 +2388,12 @@ std::optional<int> QVariant::compare(const QVariant &lhs, const QVariant &rhs)
return t.compare(lhs.constData(), rhs.constData());
}
/*!
\fn const void *QVariant::constData() const
\fn const void* QVariant::data() const
\internal
*/
/*!
\internal
*/
@ -2407,7 +2405,6 @@ void* QVariant::data()
return const_cast<void *>(constData());
}
/*!
Returns \c true if this is a null variant, false otherwise.