mirror of
https://bitbucket.org/smil3y/katie.git
synced 2025-02-24 10:52:56 +00:00
replace 0 with Q_NULLPTR where applicable
Signed-off-by: Ivailo Monev <xakepa10@laimg.moc>
This commit is contained in:
parent
e323838a8a
commit
392ba35497
8 changed files with 73 additions and 74 deletions
|
@ -49,7 +49,7 @@ QT_BEGIN_NAMESPACE
|
||||||
QPersistentModelIndexData *QPersistentModelIndexData::create(const QModelIndex &index)
|
QPersistentModelIndexData *QPersistentModelIndexData::create(const QModelIndex &index)
|
||||||
{
|
{
|
||||||
Q_ASSERT(index.isValid()); // we will _never_ insert an invalid index in the list
|
Q_ASSERT(index.isValid()); // we will _never_ insert an invalid index in the list
|
||||||
QPersistentModelIndexData *d = 0;
|
QPersistentModelIndexData *d = Q_NULLPTR;
|
||||||
QAbstractItemModel *model = const_cast<QAbstractItemModel *>(index.model());
|
QAbstractItemModel *model = const_cast<QAbstractItemModel *>(index.model());
|
||||||
QHash<QModelIndex, QPersistentModelIndexData *> &indexes = model->d_func()->persistent.indexes;
|
QHash<QModelIndex, QPersistentModelIndexData *> &indexes = model->d_func()->persistent.indexes;
|
||||||
const QHash<QModelIndex, QPersistentModelIndexData *>::iterator it = indexes.find(index);
|
const QHash<QModelIndex, QPersistentModelIndexData *>::iterator it = indexes.find(index);
|
||||||
|
@ -105,7 +105,7 @@ void QPersistentModelIndexData::destroy(QPersistentModelIndexData *data)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
QPersistentModelIndex::QPersistentModelIndex()
|
QPersistentModelIndex::QPersistentModelIndex()
|
||||||
: d(0)
|
: d(Q_NULLPTR)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -127,7 +127,7 @@ QPersistentModelIndex::QPersistentModelIndex(const QPersistentModelIndex &other)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
QPersistentModelIndex::QPersistentModelIndex(const QModelIndex &index)
|
QPersistentModelIndex::QPersistentModelIndex(const QModelIndex &index)
|
||||||
: d(0)
|
: d(Q_NULLPTR)
|
||||||
{
|
{
|
||||||
if (index.isValid()) {
|
if (index.isValid()) {
|
||||||
d = QPersistentModelIndexData::create(index);
|
d = QPersistentModelIndexData::create(index);
|
||||||
|
@ -145,7 +145,7 @@ QPersistentModelIndex::~QPersistentModelIndex()
|
||||||
{
|
{
|
||||||
if (d && !d->ref.deref()) {
|
if (d && !d->ref.deref()) {
|
||||||
QPersistentModelIndexData::destroy(d);
|
QPersistentModelIndexData::destroy(d);
|
||||||
d = 0;
|
d = Q_NULLPTR;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -219,7 +219,7 @@ QPersistentModelIndex &QPersistentModelIndex::operator=(const QModelIndex &other
|
||||||
d = QPersistentModelIndexData::create(other);
|
d = QPersistentModelIndexData::create(other);
|
||||||
if (d) d->ref.ref();
|
if (d) d->ref.ref();
|
||||||
} else {
|
} else {
|
||||||
d = 0;
|
d = Q_NULLPTR;
|
||||||
}
|
}
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
@ -308,7 +308,7 @@ void *QPersistentModelIndex::internalPointer() const
|
||||||
{
|
{
|
||||||
if (d)
|
if (d)
|
||||||
return d->index.internalPointer();
|
return d->index.internalPointer();
|
||||||
return 0;
|
return Q_NULLPTR;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
@ -400,7 +400,7 @@ const QAbstractItemModel *QPersistentModelIndex::model() const
|
||||||
{
|
{
|
||||||
if (d)
|
if (d)
|
||||||
return d->index.model();
|
return d->index.model();
|
||||||
return 0;
|
return Q_NULLPTR;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
@ -752,7 +752,7 @@ void QAbstractItemModelPrivate::rowsRemoved(const QModelIndex &parent,
|
||||||
QPersistentModelIndexData *data = *it;
|
QPersistentModelIndexData *data = *it;
|
||||||
persistent.indexes.erase(persistent.indexes.find(data->index));
|
persistent.indexes.erase(persistent.indexes.find(data->index));
|
||||||
data->index = QModelIndex();
|
data->index = QModelIndex();
|
||||||
data->model = 0;
|
data->model = Q_NULLPTR;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -847,7 +847,7 @@ void QAbstractItemModelPrivate::columnsRemoved(const QModelIndex &parent,
|
||||||
QPersistentModelIndexData *data = *it;
|
QPersistentModelIndexData *data = *it;
|
||||||
persistent.indexes.erase(persistent.indexes.find(data->index));
|
persistent.indexes.erase(persistent.indexes.find(data->index));
|
||||||
data->index = QModelIndex();
|
data->index = QModelIndex();
|
||||||
data->model = 0;
|
data->model = Q_NULLPTR;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1736,10 +1736,10 @@ QStringList QAbstractItemModel::mimeTypes() const
|
||||||
QMimeData *QAbstractItemModel::mimeData(const QModelIndexList &indexes) const
|
QMimeData *QAbstractItemModel::mimeData(const QModelIndexList &indexes) const
|
||||||
{
|
{
|
||||||
if (indexes.count() <= 0)
|
if (indexes.count() <= 0)
|
||||||
return 0;
|
return Q_NULLPTR;
|
||||||
QStringList types = mimeTypes();
|
QStringList types = mimeTypes();
|
||||||
if (types.isEmpty())
|
if (types.isEmpty())
|
||||||
return 0;
|
return Q_NULLPTR;
|
||||||
QMimeData *data = new QMimeData();
|
QMimeData *data = new QMimeData();
|
||||||
QString format = types.at(0);
|
QString format = types.at(0);
|
||||||
QByteArray encoded;
|
QByteArray encoded;
|
||||||
|
@ -2968,7 +2968,7 @@ void QAbstractItemModel::changePersistentIndex(const QModelIndex &from, const QM
|
||||||
if (to.isValid())
|
if (to.isValid())
|
||||||
d->persistent.insertMultiAtEnd(to, data);
|
d->persistent.insertMultiAtEnd(to, data);
|
||||||
else
|
else
|
||||||
data->model = 0;
|
data->model = Q_NULLPTR;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3002,7 +3002,7 @@ void QAbstractItemModel::changePersistentIndexList(const QModelIndexList &from,
|
||||||
if (data->index.isValid())
|
if (data->index.isValid())
|
||||||
toBeReinserted << data;
|
toBeReinserted << data;
|
||||||
else
|
else
|
||||||
data->model = 0;
|
data->model = Q_NULLPTR;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3134,7 +3134,7 @@ QAbstractTableModel::~QAbstractTableModel()
|
||||||
|
|
||||||
QModelIndex QAbstractTableModel::index(int row, int column, const QModelIndex &parent) const
|
QModelIndex QAbstractTableModel::index(int row, int column, const QModelIndex &parent) const
|
||||||
{
|
{
|
||||||
return hasIndex(row, column, parent) ? createIndex(row, column, 0) : QModelIndex();
|
return hasIndex(row, column, parent) ? createIndex(row, column, Q_NULLPTR) : QModelIndex();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
@ -3262,7 +3262,7 @@ QAbstractListModel::~QAbstractListModel()
|
||||||
|
|
||||||
QModelIndex QAbstractListModel::index(int row, int column, const QModelIndex &parent) const
|
QModelIndex QAbstractListModel::index(int row, int column, const QModelIndex &parent) const
|
||||||
{
|
{
|
||||||
return hasIndex(row, column, parent) ? createIndex(row, column, 0) : QModelIndex();
|
return hasIndex(row, column, parent) ? createIndex(row, column, Q_NULLPTR) : QModelIndex();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
|
|
@ -48,10 +48,10 @@ class Q_CORE_EXPORT QModelIndex
|
||||||
friend class QAbstractItemModel;
|
friend class QAbstractItemModel;
|
||||||
friend class QProxyModel;
|
friend class QProxyModel;
|
||||||
public:
|
public:
|
||||||
inline QModelIndex() : r(-1), c(-1), p(0), m(0) {}
|
inline QModelIndex() : r(-1), c(-1), p(Q_NULLPTR), m(Q_NULLPTR) {}
|
||||||
inline QModelIndex(const QModelIndex &other)
|
inline QModelIndex(const QModelIndex &other)
|
||||||
: r(other.r), c(other.c), p(other.p), m(other.m) {}
|
: r(other.r), c(other.c), p(other.p), m(other.m) {}
|
||||||
inline ~QModelIndex() { p = 0; m = 0; }
|
inline ~QModelIndex() { p = Q_NULLPTR; m = Q_NULLPTR; }
|
||||||
inline int row() const { return r; }
|
inline int row() const { return r; }
|
||||||
inline int column() const { return c; }
|
inline int column() const { return c; }
|
||||||
inline void *internalPointer() const { return p; }
|
inline void *internalPointer() const { return p; }
|
||||||
|
@ -62,7 +62,7 @@ public:
|
||||||
inline QVariant data(int role = Qt::DisplayRole) const;
|
inline QVariant data(int role = Qt::DisplayRole) const;
|
||||||
inline Qt::ItemFlags flags() const;
|
inline Qt::ItemFlags flags() const;
|
||||||
inline const QAbstractItemModel *model() const { return m; }
|
inline const QAbstractItemModel *model() const { return m; }
|
||||||
inline bool isValid() const { return (r >= 0) && (c >= 0) && (m != 0); }
|
inline bool isValid() const { return (r >= 0) && (c >= 0) && (m != Q_NULLPTR); }
|
||||||
inline bool operator==(const QModelIndex &other) const
|
inline bool operator==(const QModelIndex &other) const
|
||||||
{ return (other.r == r) && (other.p == p) && (other.c == c) && (other.m == m); }
|
{ return (other.r == r) && (other.p == p) && (other.c == c) && (other.m == m); }
|
||||||
inline bool operator!=(const QModelIndex &other) const
|
inline bool operator!=(const QModelIndex &other) const
|
||||||
|
@ -255,7 +255,7 @@ public Q_SLOTS:
|
||||||
protected:
|
protected:
|
||||||
QAbstractItemModel(QAbstractItemModelPrivate &dd, QObject *parent = Q_NULLPTR);
|
QAbstractItemModel(QAbstractItemModelPrivate &dd, QObject *parent = Q_NULLPTR);
|
||||||
|
|
||||||
inline QModelIndex createIndex(int row, int column, void *data = 0) const;
|
inline QModelIndex createIndex(int row, int column, void *data = Q_NULLPTR) const;
|
||||||
inline QModelIndex createIndex(int row, int column, int id) const;
|
inline QModelIndex createIndex(int row, int column, int id) const;
|
||||||
inline QModelIndex createIndex(int row, int column, quint32 id) const;
|
inline QModelIndex createIndex(int row, int column, quint32 id) const;
|
||||||
|
|
||||||
|
|
|
@ -87,7 +87,7 @@ public:
|
||||||
void itemsMoved(const QModelIndex &srcParent, int srcFirst, int srcLast, const QModelIndex &destinationParent, int destinationChild, Qt::Orientation orientation);
|
void itemsMoved(const QModelIndex &srcParent, int srcFirst, int srcLast, const QModelIndex &destinationParent, int destinationChild, Qt::Orientation orientation);
|
||||||
bool allowMove(const QModelIndex &srcParent, int srcFirst, int srcLast, const QModelIndex &destinationParent, int destinationChild, Qt::Orientation orientation);
|
bool allowMove(const QModelIndex &srcParent, int srcFirst, int srcLast, const QModelIndex &destinationParent, int destinationChild, Qt::Orientation orientation);
|
||||||
|
|
||||||
inline QModelIndex createIndex(int row, int column, void *data = 0) const {
|
inline QModelIndex createIndex(int row, int column, void *data = Q_NULLPTR) const {
|
||||||
return q_func()->createIndex(row, column, data);
|
return q_func()->createIndex(row, column, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -118,7 +118,7 @@ public:
|
||||||
QPersistentModelIndexData *data = *it;
|
QPersistentModelIndexData *data = *it;
|
||||||
persistent.indexes.erase(it);
|
persistent.indexes.erase(it);
|
||||||
data->index = QModelIndex();
|
data->index = QModelIndex();
|
||||||
data->model = 0;
|
data->model = Q_NULLPTR;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -122,8 +122,8 @@ QObjectPrivate::QObjectPrivate(int version)
|
||||||
version, QObjectPrivateVersion);
|
version, QObjectPrivateVersion);
|
||||||
|
|
||||||
// QObjectData initialization
|
// QObjectData initialization
|
||||||
q_ptr = 0;
|
q_ptr = Q_NULLPTR;
|
||||||
parent = 0; // no parent yet. It is set by setParent()
|
parent = Q_NULLPTR; // no parent yet. It is set by setParent()
|
||||||
isWidget = false; // assume not a widget object
|
isWidget = false; // assume not a widget object
|
||||||
pendTimer = false; // no timers yet
|
pendTimer = false; // no timers yet
|
||||||
blockSig = false; // not blocking signals
|
blockSig = false; // not blocking signals
|
||||||
|
@ -131,10 +131,10 @@ QObjectPrivate::QObjectPrivate(int version)
|
||||||
sendChildEvents = true; // if we should send ChildInsert and ChildRemove events to parent
|
sendChildEvents = true; // if we should send ChildInsert and ChildRemove events to parent
|
||||||
receiveChildEvents = true;
|
receiveChildEvents = true;
|
||||||
postedEvents = 0;
|
postedEvents = 0;
|
||||||
extraData = 0;
|
extraData = Q_NULLPTR;
|
||||||
connectedSignals[0] = connectedSignals[1] = 0;
|
connectedSignals[0] = connectedSignals[1] = 0;
|
||||||
inThreadChangeEvent = false;
|
inThreadChangeEvent = false;
|
||||||
metaObject = 0;
|
metaObject = Q_NULLPTR;
|
||||||
}
|
}
|
||||||
|
|
||||||
QObjectPrivate::~QObjectPrivate()
|
QObjectPrivate::~QObjectPrivate()
|
||||||
|
@ -296,7 +296,7 @@ void QObjectPrivate::cleanConnectionLists()
|
||||||
// Set to the last entry in the connection list that was *not*
|
// Set to the last entry in the connection list that was *not*
|
||||||
// deleted. This is needed to update the list's last pointer
|
// deleted. This is needed to update the list's last pointer
|
||||||
// at the end of the cleanup.
|
// at the end of the cleanup.
|
||||||
QObjectPrivate::Connection *last = 0;
|
QObjectPrivate::Connection *last = Q_NULLPTR;
|
||||||
|
|
||||||
QObjectPrivate::Connection **prev = &connectionList.first;
|
QObjectPrivate::Connection **prev = &connectionList.first;
|
||||||
QObjectPrivate::Connection *c = *prev;
|
QObjectPrivate::Connection *c = *prev;
|
||||||
|
@ -562,8 +562,8 @@ QObject::QObject(QObject *parent)
|
||||||
d->threadData->ref();
|
d->threadData->ref();
|
||||||
if (parent) {
|
if (parent) {
|
||||||
QT_TRY {
|
QT_TRY {
|
||||||
if (!check_parent_thread(parent, parent ? parent->d_func()->threadData : 0, d->threadData))
|
if (!check_parent_thread(parent, parent ? parent->d_func()->threadData : Q_NULLPTR, d->threadData))
|
||||||
parent = 0;
|
parent = Q_NULLPTR;
|
||||||
setParent(parent);
|
setParent(parent);
|
||||||
} QT_CATCH(...) {
|
} QT_CATCH(...) {
|
||||||
d->threadData->deref();
|
d->threadData->deref();
|
||||||
|
@ -585,8 +585,8 @@ QObject::QObject(QObjectPrivate &dd, QObject *parent)
|
||||||
d->threadData->ref();
|
d->threadData->ref();
|
||||||
if (parent) {
|
if (parent) {
|
||||||
QT_TRY {
|
QT_TRY {
|
||||||
if (!check_parent_thread(parent, parent ? parent->d_func()->threadData : 0, d->threadData))
|
if (!check_parent_thread(parent, parent ? parent->d_func()->threadData : Q_NULLPTR, d->threadData))
|
||||||
parent = 0;
|
parent = Q_NULLPTR;
|
||||||
if (d->isWidget) {
|
if (d->isWidget) {
|
||||||
if (parent) {
|
if (parent) {
|
||||||
d->parent = parent;
|
d->parent = parent;
|
||||||
|
@ -646,7 +646,6 @@ QObject::~QObject()
|
||||||
delete d->sharedRefcount;
|
delete d->sharedRefcount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (!d->isWidget && d->isSignalConnected(0)) {
|
if (!d->isWidget && d->isSignalConnected(0)) {
|
||||||
emit destroyed(this);
|
emit destroyed(this);
|
||||||
}
|
}
|
||||||
|
@ -697,7 +696,7 @@ QObject::~QObject()
|
||||||
} else {
|
} else {
|
||||||
d->connectionLists->orphaned = true;
|
d->connectionLists->orphaned = true;
|
||||||
}
|
}
|
||||||
d->connectionLists = 0;
|
d->connectionLists = Q_NULLPTR;
|
||||||
}
|
}
|
||||||
|
|
||||||
// disconnect all senders
|
// disconnect all senders
|
||||||
|
@ -712,7 +711,7 @@ QObject::~QObject()
|
||||||
m->unlock();
|
m->unlock();
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
node->receiver = 0;
|
node->receiver = Q_NULLPTR;
|
||||||
QObjectConnectionListVector *senderLists = sender->d_func()->connectionLists;
|
QObjectConnectionListVector *senderLists = sender->d_func()->connectionLists;
|
||||||
if (senderLists)
|
if (senderLists)
|
||||||
senderLists->dirty = true;
|
senderLists->dirty = true;
|
||||||
|
@ -734,7 +733,7 @@ QObject::~QObject()
|
||||||
}
|
}
|
||||||
|
|
||||||
if (d->parent) // remove it from parent object
|
if (d->parent) // remove it from parent object
|
||||||
d->setParent_helper(0);
|
d->setParent_helper(Q_NULLPTR);
|
||||||
|
|
||||||
delete d_ptr;
|
delete d_ptr;
|
||||||
}
|
}
|
||||||
|
@ -799,8 +798,8 @@ QObjectPrivate::Connection::~Connection()
|
||||||
\relates QObject
|
\relates QObject
|
||||||
|
|
||||||
Returns the given \a object cast to type T if the object is of type
|
Returns the given \a object cast to type T if the object is of type
|
||||||
T (or of a subclass); otherwise returns 0. If \a object is 0 then
|
T (or of a subclass); otherwise returns Q_NULLPTR. If \a object is
|
||||||
it will also return 0.
|
null then it will also return null.
|
||||||
|
|
||||||
The class T must inherit (directly or indirectly) QObject and be
|
The class T must inherit (directly or indirectly) QObject and be
|
||||||
declared with the \l Q_OBJECT macro.
|
declared with the \l Q_OBJECT macro.
|
||||||
|
@ -1160,7 +1159,7 @@ void QObject::moveToThread(QThread *targetThread)
|
||||||
|
|
||||||
QThreadData *currentData = QThreadData::current();
|
QThreadData *currentData = QThreadData::current();
|
||||||
QThreadData *targetData = targetThread ? QThreadData::get2(targetThread) : new QThreadData(0);
|
QThreadData *targetData = targetThread ? QThreadData::get2(targetThread) : new QThreadData(0);
|
||||||
if (d->threadData->thread == 0 && currentData == targetData) {
|
if (!d->threadData->thread && currentData == targetData) {
|
||||||
// one exception to the rule: we allow moving objects with no thread affinity to the current thread
|
// one exception to the rule: we allow moving objects with no thread affinity to the current thread
|
||||||
currentData = d->threadData;
|
currentData = d->threadData;
|
||||||
} else if (Q_UNLIKELY(d->threadData != currentData)) {
|
} else if (Q_UNLIKELY(d->threadData != currentData)) {
|
||||||
|
@ -1475,7 +1474,7 @@ void QObjectPrivate::deleteChildren()
|
||||||
// delete siblings
|
// delete siblings
|
||||||
for (int i = 0; i < children.count(); ++i) {
|
for (int i = 0; i < children.count(); ++i) {
|
||||||
currentChildBeingDeleted = children.at(i);
|
currentChildBeingDeleted = children.at(i);
|
||||||
children[i] = 0;
|
children[i] = Q_NULLPTR;
|
||||||
delete currentChildBeingDeleted;
|
delete currentChildBeingDeleted;
|
||||||
}
|
}
|
||||||
children.clear();
|
children.clear();
|
||||||
|
@ -1497,7 +1496,7 @@ void QObjectPrivate::setParent_helper(QObject *o)
|
||||||
} else {
|
} else {
|
||||||
const int index = parentD->children.indexOf(q);
|
const int index = parentD->children.indexOf(q);
|
||||||
if (parentD->wasDeleted) {
|
if (parentD->wasDeleted) {
|
||||||
parentD->children[index] = 0;
|
parentD->children[index] = Q_NULLPTR;
|
||||||
} else {
|
} else {
|
||||||
parentD->children.removeAt(index);
|
parentD->children.removeAt(index);
|
||||||
if (sendChildEvents && parentD->receiveChildEvents) {
|
if (sendChildEvents && parentD->receiveChildEvents) {
|
||||||
|
@ -1580,7 +1579,7 @@ void QObject::installEventFilter(QObject *obj)
|
||||||
}
|
}
|
||||||
|
|
||||||
// clean up unused items in the list
|
// clean up unused items in the list
|
||||||
d->eventFilters.removeAll((QObject*)0);
|
d->eventFilters.removeAll((QObject*)Q_NULLPTR);
|
||||||
d->eventFilters.removeAll(obj);
|
d->eventFilters.removeAll(obj);
|
||||||
d->eventFilters.prepend(obj);
|
d->eventFilters.prepend(obj);
|
||||||
}
|
}
|
||||||
|
@ -1603,7 +1602,7 @@ void QObject::removeEventFilter(QObject *obj)
|
||||||
Q_D(QObject);
|
Q_D(QObject);
|
||||||
for (int i = 0; i < d->eventFilters.count(); ++i) {
|
for (int i = 0; i < d->eventFilters.count(); ++i) {
|
||||||
if (d->eventFilters.at(i) == obj)
|
if (d->eventFilters.at(i) == obj)
|
||||||
d->eventFilters[i] = 0;
|
d->eventFilters[i] = Q_NULLPTR;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1741,7 +1740,7 @@ static const char * extract_location(const char *member)
|
||||||
if (*location != '\0')
|
if (*location != '\0')
|
||||||
return location;
|
return location;
|
||||||
}
|
}
|
||||||
return 0;
|
return Q_NULLPTR;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool check_signal_macro(const QObject *sender, const char *signal,
|
static bool check_signal_macro(const QObject *sender, const char *signal,
|
||||||
|
@ -1833,14 +1832,14 @@ QObject *QObject::sender() const
|
||||||
|
|
||||||
QMutexLocker locker(signalSlotLock(this));
|
QMutexLocker locker(signalSlotLock(this));
|
||||||
if (!d->currentSender)
|
if (!d->currentSender)
|
||||||
return 0;
|
return Q_NULLPTR;
|
||||||
|
|
||||||
for (QObjectPrivate::Connection *c = d->senders; c; c = c->next) {
|
for (QObjectPrivate::Connection *c = d->senders; c; c = c->next) {
|
||||||
if (c->sender == d->currentSender->sender)
|
if (c->sender == d->currentSender->sender)
|
||||||
return d->currentSender->sender;
|
return d->currentSender->sender;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return Q_NULLPTR;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
@ -1974,7 +1973,7 @@ void QMetaObjectPrivate::memberIndexes(const QObject *obj,
|
||||||
return;
|
return;
|
||||||
const QMetaObject *m = obj->metaObject();
|
const QMetaObject *m = obj->metaObject();
|
||||||
// Check that member is member of obj class
|
// Check that member is member of obj class
|
||||||
while (m != 0 && m != member.mobj)
|
while (m && m != member.mobj)
|
||||||
m = m->d.superdata;
|
m = m->d.superdata;
|
||||||
if (!m)
|
if (!m)
|
||||||
return;
|
return;
|
||||||
|
@ -2226,7 +2225,7 @@ bool QObject::connect(const QObject *sender, const QMetaMethod &signal,
|
||||||
if (type == Qt::QueuedConnection && !(types = queuedConnectionTypes(signal.parameterTypes())))
|
if (type == Qt::QueuedConnection && !(types = queuedConnectionTypes(signal.parameterTypes())))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (Q_UNLIKELY(!QMetaObjectPrivate::connect(sender, signal_index, receiver, method_index, 0, type, types)))
|
if (Q_UNLIKELY(!QMetaObjectPrivate::connect(sender, signal_index, receiver, method_index, Q_NULLPTR, type, types)))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
const_cast<QObject*>(sender)->connectNotify(signalSignature.constData());
|
const_cast<QObject*>(sender)->connectNotify(signalSignature.constData());
|
||||||
|
@ -2471,7 +2470,7 @@ bool QObject::disconnect(const QObject *sender, const QMetaMethod &signal,
|
||||||
if (Q_UNLIKELY(!QMetaObjectPrivate::disconnect(sender, signal_index, receiver, method_index)))
|
if (Q_UNLIKELY(!QMetaObjectPrivate::disconnect(sender, signal_index, receiver, method_index)))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
const_cast<QObject*>(sender)->disconnectNotify(method.mobj ? signalSignature.constData() : 0);
|
const_cast<QObject*>(sender)->disconnectNotify(method.mobj ? signalSignature.constData() : Q_NULLPTR);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2580,7 +2579,7 @@ bool QMetaObject::connect(const QObject *sender, int signal_index,
|
||||||
signal_index = methodIndexToSignalIndex(sender->metaObject(), signal_index);
|
signal_index = methodIndexToSignalIndex(sender->metaObject(), signal_index);
|
||||||
return QMetaObjectPrivate::connect(sender, signal_index,
|
return QMetaObjectPrivate::connect(sender, signal_index,
|
||||||
receiver, method_index,
|
receiver, method_index,
|
||||||
0, //FIXME, we could speed this connection up by computing the relative index
|
Q_NULLPTR, //FIXME, we could speed this connection up by computing the relative index
|
||||||
type, types);
|
type, types);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2598,7 +2597,7 @@ bool QMetaObjectPrivate::connect(const QObject *sender, int signal_index,
|
||||||
|
|
||||||
int method_offset = rmeta ? rmeta->methodOffset() : 0;
|
int method_offset = rmeta ? rmeta->methodOffset() : 0;
|
||||||
Q_ASSERT(!rmeta || QMetaObjectPrivate::get(rmeta)->revision >= 6);
|
Q_ASSERT(!rmeta || QMetaObjectPrivate::get(rmeta)->revision >= 6);
|
||||||
QObjectPrivate::StaticMetaCallFunction callFunction = rmeta ? rmeta->d.static_metacall : 0;
|
QObjectPrivate::StaticMetaCallFunction callFunction = rmeta ? rmeta->d.static_metacall : Q_NULLPTR;
|
||||||
|
|
||||||
QOrderedMutexLocker locker(signalSlotLock(sender),
|
QOrderedMutexLocker locker(signalSlotLock(sender),
|
||||||
signalSlotLock(receiver));
|
signalSlotLock(receiver));
|
||||||
|
@ -2627,7 +2626,7 @@ bool QMetaObjectPrivate::connect(const QObject *sender, int signal_index,
|
||||||
c->method_offset = method_offset;
|
c->method_offset = method_offset;
|
||||||
c->connectionType = type;
|
c->connectionType = type;
|
||||||
c->argumentTypes = QAtomicPointer<int>(types);
|
c->argumentTypes = QAtomicPointer<int>(types);
|
||||||
c->nextConnectionList = 0;
|
c->nextConnectionList = Q_NULLPTR;
|
||||||
c->callFunction = callFunction;
|
c->callFunction = callFunction;
|
||||||
|
|
||||||
QT_TRY {
|
QT_TRY {
|
||||||
|
@ -2688,10 +2687,10 @@ bool QMetaObjectPrivate::disconnectHelper(QObjectPrivate::Connection *c,
|
||||||
bool success = false;
|
bool success = false;
|
||||||
while (c) {
|
while (c) {
|
||||||
if (c->receiver
|
if (c->receiver
|
||||||
&& (receiver == 0 || (c->receiver == receiver
|
&& (!receiver || (c->receiver == receiver
|
||||||
&& (method_index < 0 || c->method() == method_index)))) {
|
&& (method_index < 0 || c->method() == method_index)))) {
|
||||||
bool needToUnlock = false;
|
bool needToUnlock = false;
|
||||||
QMutex *receiverMutex = 0;
|
QMutex *receiverMutex = Q_NULLPTR;
|
||||||
if (!receiver) {
|
if (!receiver) {
|
||||||
receiverMutex = signalSlotLock(c->receiver);
|
receiverMutex = signalSlotLock(c->receiver);
|
||||||
// need to relock this receiver and sender in the correct order
|
// need to relock this receiver and sender in the correct order
|
||||||
|
@ -2706,7 +2705,7 @@ bool QMetaObjectPrivate::disconnectHelper(QObjectPrivate::Connection *c,
|
||||||
if (needToUnlock)
|
if (needToUnlock)
|
||||||
receiverMutex->unlock();
|
receiverMutex->unlock();
|
||||||
|
|
||||||
c->receiver = 0;
|
c->receiver = Q_NULLPTR;
|
||||||
|
|
||||||
success = true;
|
success = true;
|
||||||
|
|
||||||
|
@ -2731,7 +2730,7 @@ bool QMetaObjectPrivate::disconnect(const QObject *sender, int signal_index,
|
||||||
QObject *s = const_cast<QObject *>(sender);
|
QObject *s = const_cast<QObject *>(sender);
|
||||||
|
|
||||||
QMutex *senderMutex = signalSlotLock(sender);
|
QMutex *senderMutex = signalSlotLock(sender);
|
||||||
QMutex *receiverMutex = receiver ? signalSlotLock(receiver) : 0;
|
QMutex *receiverMutex = receiver ? signalSlotLock(receiver) : Q_NULLPTR;
|
||||||
QOrderedMutexLocker locker(senderMutex, receiverMutex);
|
QOrderedMutexLocker locker(senderMutex, receiverMutex);
|
||||||
|
|
||||||
QObjectConnectionListVector *connectionLists = QObjectPrivate::get(s)->connectionLists;
|
QObjectConnectionListVector *connectionLists = QObjectPrivate::get(s)->connectionLists;
|
||||||
|
@ -2860,7 +2859,7 @@ static void queued_activate(QObject *sender, int signal, QObjectPrivate::Connect
|
||||||
void **args = (void **) malloc(nargs*sizeof(void *));
|
void **args = (void **) malloc(nargs*sizeof(void *));
|
||||||
Q_CHECK_PTR(args);
|
Q_CHECK_PTR(args);
|
||||||
types[0] = 0; // return type
|
types[0] = 0; // return type
|
||||||
args[0] = 0; // return value
|
args[0] = Q_NULLPTR; // return value
|
||||||
for (int n = 1; n < nargs; ++n)
|
for (int n = 1; n < nargs; ++n)
|
||||||
args[n] = QMetaType::construct((types[n] = c->argumentTypes[n-1]), argv[n]);
|
args[n] = QMetaType::construct((types[n] = c->argumentTypes[n-1]), argv[n]);
|
||||||
QCoreApplication::postEvent(c->receiver, new QMetaCallEvent(c->method_offset,
|
QCoreApplication::postEvent(c->receiver, new QMetaCallEvent(c->method_offset,
|
||||||
|
@ -2900,8 +2899,8 @@ void QMetaObject::activate(QObject *sender, const QMetaObject *m, int local_sign
|
||||||
|
|
||||||
int signal_absolute_index = methodOffset + local_signal_index;
|
int signal_absolute_index = methodOffset + local_signal_index;
|
||||||
|
|
||||||
void *empty_argv[] = { 0 };
|
void *empty_argv[] = { Q_NULLPTR };
|
||||||
if (qt_signal_spy_callback_set.signal_begin_callback != 0) {
|
if (qt_signal_spy_callback_set.signal_begin_callback) {
|
||||||
qt_signal_spy_callback_set.signal_begin_callback(sender, signal_absolute_index,
|
qt_signal_spy_callback_set.signal_begin_callback(sender, signal_absolute_index,
|
||||||
argv ? argv : empty_argv);
|
argv ? argv : empty_argv);
|
||||||
}
|
}
|
||||||
|
@ -2912,7 +2911,7 @@ void QMetaObject::activate(QObject *sender, const QMetaObject *m, int local_sign
|
||||||
QObjectConnectionListVector *connectionLists = sender->d_func()->connectionLists;
|
QObjectConnectionListVector *connectionLists = sender->d_func()->connectionLists;
|
||||||
if (!connectionLists) {
|
if (!connectionLists) {
|
||||||
locker.unlock();
|
locker.unlock();
|
||||||
if (qt_signal_spy_callback_set.signal_end_callback != 0)
|
if (qt_signal_spy_callback_set.signal_end_callback)
|
||||||
qt_signal_spy_callback_set.signal_end_callback(sender, signal_absolute_index);
|
qt_signal_spy_callback_set.signal_end_callback(sender, signal_absolute_index);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -2958,7 +2957,7 @@ void QMetaObject::activate(QObject *sender, const QMetaObject *m, int local_sign
|
||||||
QCoreApplication::postEvent(receiver, new QMetaCallEvent(c->method_offset, c->method_relative,
|
QCoreApplication::postEvent(receiver, new QMetaCallEvent(c->method_offset, c->method_relative,
|
||||||
c->callFunction,
|
c->callFunction,
|
||||||
sender, signal_absolute_index,
|
sender, signal_absolute_index,
|
||||||
0, 0,
|
0, Q_NULLPTR,
|
||||||
argv ? argv : empty_argv,
|
argv ? argv : empty_argv,
|
||||||
&semaphore));
|
&semaphore));
|
||||||
semaphore.acquire();
|
semaphore.acquire();
|
||||||
|
@ -2968,7 +2967,7 @@ void QMetaObject::activate(QObject *sender, const QMetaObject *m, int local_sign
|
||||||
}
|
}
|
||||||
|
|
||||||
QObjectPrivate::Sender currentSender;
|
QObjectPrivate::Sender currentSender;
|
||||||
QObjectPrivate::Sender *previousSender = 0;
|
QObjectPrivate::Sender *previousSender = Q_NULLPTR;
|
||||||
if (receiverInSameThread) {
|
if (receiverInSameThread) {
|
||||||
currentSender.sender = sender;
|
currentSender.sender = sender;
|
||||||
currentSender.signal = signal_absolute_index;
|
currentSender.signal = signal_absolute_index;
|
||||||
|
@ -2980,7 +2979,7 @@ void QMetaObject::activate(QObject *sender, const QMetaObject *m, int local_sign
|
||||||
if (callFunction && c->method_offset <= receiver->metaObject()->methodOffset()) {
|
if (callFunction && c->method_offset <= receiver->metaObject()->methodOffset()) {
|
||||||
//we compare the vtable to make sure we are not in the destructor of the object.
|
//we compare the vtable to make sure we are not in the destructor of the object.
|
||||||
locker.unlock();
|
locker.unlock();
|
||||||
if (qt_signal_spy_callback_set.slot_begin_callback != 0)
|
if (qt_signal_spy_callback_set.slot_begin_callback)
|
||||||
qt_signal_spy_callback_set.slot_begin_callback(receiver, c->method(), argv ? argv : empty_argv);
|
qt_signal_spy_callback_set.slot_begin_callback(receiver, c->method(), argv ? argv : empty_argv);
|
||||||
|
|
||||||
QT_TRY {
|
QT_TRY {
|
||||||
|
@ -2997,14 +2996,14 @@ void QMetaObject::activate(QObject *sender, const QMetaObject *m, int local_sign
|
||||||
QT_RETHROW;
|
QT_RETHROW;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (qt_signal_spy_callback_set.slot_end_callback != 0)
|
if (qt_signal_spy_callback_set.slot_end_callback)
|
||||||
qt_signal_spy_callback_set.slot_end_callback(receiver, c->method());
|
qt_signal_spy_callback_set.slot_end_callback(receiver, c->method());
|
||||||
locker.relock();
|
locker.relock();
|
||||||
} else {
|
} else {
|
||||||
const int method = method_relative + c->method_offset;
|
const int method = method_relative + c->method_offset;
|
||||||
locker.unlock();
|
locker.unlock();
|
||||||
|
|
||||||
if (qt_signal_spy_callback_set.slot_begin_callback != 0) {
|
if (qt_signal_spy_callback_set.slot_begin_callback) {
|
||||||
qt_signal_spy_callback_set.slot_begin_callback(receiver,
|
qt_signal_spy_callback_set.slot_begin_callback(receiver,
|
||||||
method,
|
method,
|
||||||
argv ? argv : empty_argv);
|
argv ? argv : empty_argv);
|
||||||
|
@ -3024,7 +3023,7 @@ void QMetaObject::activate(QObject *sender, const QMetaObject *m, int local_sign
|
||||||
QT_RETHROW;
|
QT_RETHROW;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (qt_signal_spy_callback_set.slot_end_callback != 0)
|
if (qt_signal_spy_callback_set.slot_end_callback)
|
||||||
qt_signal_spy_callback_set.slot_end_callback(receiver, method);
|
qt_signal_spy_callback_set.slot_end_callback(receiver, method);
|
||||||
|
|
||||||
locker.relock();
|
locker.relock();
|
||||||
|
@ -3035,7 +3034,7 @@ void QMetaObject::activate(QObject *sender, const QMetaObject *m, int local_sign
|
||||||
|
|
||||||
if (connectionLists->orphaned)
|
if (connectionLists->orphaned)
|
||||||
break;
|
break;
|
||||||
} while (c != last && (c = c->nextConnectionList) != 0);
|
} while (c != last && (c = c->nextConnectionList) != Q_NULLPTR);
|
||||||
|
|
||||||
if (connectionLists->orphaned)
|
if (connectionLists->orphaned)
|
||||||
break;
|
break;
|
||||||
|
@ -3054,7 +3053,7 @@ void QMetaObject::activate(QObject *sender, const QMetaObject *m, int local_sign
|
||||||
|
|
||||||
locker.unlock();
|
locker.unlock();
|
||||||
|
|
||||||
if (qt_signal_spy_callback_set.signal_end_callback != 0)
|
if (qt_signal_spy_callback_set.signal_end_callback)
|
||||||
qt_signal_spy_callback_set.signal_end_callback(sender, signal_absolute_index);
|
qt_signal_spy_callback_set.signal_end_callback(sender, signal_absolute_index);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -3362,7 +3361,7 @@ QDebug operator<<(QDebug dbg, const QObject *o) {
|
||||||
/*!
|
/*!
|
||||||
\fn void QObject::removeChild(QObject *object)
|
\fn void QObject::removeChild(QObject *object)
|
||||||
|
|
||||||
Use setParent() instead, i.e., call object->setParent(0).
|
Use setParent() instead, i.e., call object->setParent(Q_NULLPTR).
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
|
|
@ -72,7 +72,7 @@ public:
|
||||||
hasRegisteredTimer(false),
|
hasRegisteredTimer(false),
|
||||||
isPause(false),
|
isPause(false),
|
||||||
isGroup(false),
|
isGroup(false),
|
||||||
group(0)
|
group(Q_NULLPTR)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -82,7 +82,7 @@ void QProxyStylePrivate::ensureBaseStyle() const
|
||||||
if (qstrcmp(baseStyle->metaObject()->className(),
|
if (qstrcmp(baseStyle->metaObject()->className(),
|
||||||
q->metaObject()->className()) == 0) {
|
q->metaObject()->className()) == 0) {
|
||||||
delete baseStyle;
|
delete baseStyle;
|
||||||
baseStyle = 0;
|
baseStyle = Q_NULLPTR;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,8 +60,8 @@ public:
|
||||||
void ensureBaseStyle() const;
|
void ensureBaseStyle() const;
|
||||||
private:
|
private:
|
||||||
QProxyStylePrivate() :
|
QProxyStylePrivate() :
|
||||||
QCommonStylePrivate(), baseStyle(0) {}
|
QCommonStylePrivate(), baseStyle(Q_NULLPTR) {}
|
||||||
mutable QPointer <QStyle> baseStyle;
|
mutable QPointer<QStyle> baseStyle;
|
||||||
};
|
};
|
||||||
|
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
|
|
@ -44,7 +44,7 @@ QT_BEGIN_NAMESPACE
|
||||||
|
|
||||||
struct QDBusItem
|
struct QDBusItem
|
||||||
{
|
{
|
||||||
inline QDBusItem(QDBusModel::Type aType, const QString &aName, QDBusItem *aParent = 0)
|
inline QDBusItem(QDBusModel::Type aType, const QString &aName, QDBusItem *aParent = Q_NULLPTR)
|
||||||
: type(aType), parent(aParent), isPrefetched(type != QDBusModel::PathItem), name(aName)
|
: type(aType), parent(aParent), isPrefetched(type != QDBusModel::PathItem), name(aName)
|
||||||
{}
|
{}
|
||||||
inline ~QDBusItem()
|
inline ~QDBusItem()
|
||||||
|
@ -112,7 +112,7 @@ void QDBusModel::addMethods(QDBusItem *parent, const QDomElement &iface)
|
||||||
|
|
||||||
QDomElement child = iface.firstChildElement();
|
QDomElement child = iface.firstChildElement();
|
||||||
while (!child.isNull()) {
|
while (!child.isNull()) {
|
||||||
QDBusItem *item = 0;
|
QDBusItem *item = Q_NULLPTR;
|
||||||
if (child.tagName() == QLatin1String("method")) {
|
if (child.tagName() == QLatin1String("method")) {
|
||||||
item = new QDBusItem(QDBusModel::MethodItem,
|
item = new QDBusItem(QDBusModel::MethodItem,
|
||||||
child.attribute(QLatin1String("name")), parent);
|
child.attribute(QLatin1String("name")), parent);
|
||||||
|
@ -174,7 +174,7 @@ void QDBusModel::addPath(QDBusItem *parent)
|
||||||
}
|
}
|
||||||
|
|
||||||
QDBusModel::QDBusModel(const QString &aService, const QDBusConnection &connection)
|
QDBusModel::QDBusModel(const QString &aService, const QDBusConnection &connection)
|
||||||
: service(aService), c(connection), root(0)
|
: service(aService), c(connection), root(Q_NULLPTR)
|
||||||
{
|
{
|
||||||
root = new QDBusItem(QDBusModel::PathItem, QLatin1String("/"));
|
root = new QDBusItem(QDBusModel::PathItem, QLatin1String("/"));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue