summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShawn Rutledge <shawn.rutledge@qt.io>2020-11-09 16:03:59 +0100
committerShawn Rutledge <shawn.rutledge@qt.io>2020-11-10 19:08:44 +0100
commitef051a61f6e458cb89b6ef20b5d55cb1e001dd93 (patch)
tree33dedfc32d6d2b587c2bf5c6cc858241dfdeeee1
parent88efeb9e258a473ca5f98eaf2ee25719e23263fd (diff)
Rename remaining QEvent variables to m_ convention; init m_reserved
Change-Id: I08694657b7c9d2713d0cb33519698dbba3bfdffa Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
-rw-r--r--src/corelib/kernel/qcoreapplication.cpp18
-rw-r--r--src/corelib/kernel/qcoreapplication_p.h2
-rw-r--r--src/corelib/kernel/qcoreapplication_win.cpp2
-rw-r--r--src/corelib/kernel/qcoreevent.cpp16
-rw-r--r--src/corelib/kernel/qcoreevent.h10
-rw-r--r--src/corelib/thread/qthread.cpp2
-rw-r--r--src/widgets/graphicsview/qgraphicsscene.cpp6
-rw-r--r--src/widgets/kernel/qapplication.cpp24
8 files changed, 41 insertions, 39 deletions
diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp
index ec227f6d99..5f169674fc 100644
--- a/src/corelib/kernel/qcoreapplication.cpp
+++ b/src/corelib/kernel/qcoreapplication.cpp
@@ -492,7 +492,7 @@ void QCoreApplicationPrivate::cleanupThreadData()
const QPostEvent &pe = thisThreadData->postEventList.at(i);
if (pe.event) {
--pe.receiver->d_func()->postedEvents;
- pe.event->posted = false;
+ pe.event->m_posted = false;
delete pe.event;
}
}
@@ -1050,7 +1050,7 @@ bool QCoreApplication::notifyInternal2(QObject *receiver, QEvent *event)
bool QCoreApplication::forwardEvent(QObject *receiver, QEvent *event, QEvent *originatingEvent)
{
if (event && originatingEvent)
- event->spont = originatingEvent->spont;
+ event->m_spont = originatingEvent->m_spont;
return notifyInternal2(receiver, event);
}
@@ -1431,7 +1431,7 @@ bool QCoreApplication::sendEvent(QObject *receiver, QEvent *event)
Q_TRACE(QCoreApplication_sendEvent, receiver, event, event->type());
if (event)
- event->spont = false;
+ event->m_spont = false;
return notifyInternal2(receiver, event);
}
@@ -1443,7 +1443,7 @@ bool QCoreApplication::sendSpontaneousEvent(QObject *receiver, QEvent *event)
Q_TRACE(QCoreApplication_sendSpontaneousEvent, receiver, event, event->type());
if (event)
- event->spont = true;
+ event->m_spont = true;
return notifyInternal2(receiver, event);
}
@@ -1563,7 +1563,7 @@ void QCoreApplication::postEvent(QObject *receiver, QEvent *event, int priority)
Q_TRACE(QCoreApplication_postEvent_event_posted, receiver, event, event->type());
data->postEventList.addEvent(QPostEvent(receiver, event, priority));
eventDeleter.take();
- event->posted = true;
+ event->m_posted = true;
++receiver->d_func()->postedEvents;
data->canWait = false;
locker.unlock();
@@ -1774,7 +1774,7 @@ void QCoreApplicationPrivate::sendPostedEvents(QObject *receiver, int event_type
// first, we diddle the event so that we can deliver
// it, and that no one will try to touch it later.
- pe.event->posted = false;
+ pe.event->m_posted = false;
QEvent *e = pe.event;
QObject * r = pe.receiver;
@@ -1844,7 +1844,7 @@ void QCoreApplication::removePostedEvents(QObject *receiver, int eventType)
if ((!receiver || pe.receiver == receiver)
&& (pe.event && (eventType == 0 || pe.event->type() == eventType))) {
--pe.receiver->d_func()->postedEvents;
- pe.event->posted = false;
+ pe.event->m_posted = false;
events.append(pe.event);
const_cast<QPostEvent &>(pe).event = nullptr;
} else if (!data->postEventList.recursion) {
@@ -1881,7 +1881,7 @@ void QCoreApplication::removePostedEvents(QObject *receiver, int eventType)
void QCoreApplicationPrivate::removePostedEvent(QEvent * event)
{
- if (!event || !event->posted)
+ if (!event || !event->m_posted)
return;
QThreadData *data = QThreadData::current();
@@ -1906,7 +1906,7 @@ void QCoreApplicationPrivate::removePostedEvent(QEvent * event)
pe.receiver->objectName().toLocal8Bit().data());
#endif
--pe.receiver->d_func()->postedEvents;
- pe.event->posted = false;
+ pe.event->m_posted = false;
delete pe.event;
const_cast<QPostEvent &>(pe).event = nullptr;
return;
diff --git a/src/corelib/kernel/qcoreapplication_p.h b/src/corelib/kernel/qcoreapplication_p.h
index 04a740caf1..c711c48a85 100644
--- a/src/corelib/kernel/qcoreapplication_p.h
+++ b/src/corelib/kernel/qcoreapplication_p.h
@@ -120,7 +120,7 @@ public:
bool sendThroughApplicationEventFilters(QObject *, QEvent *);
static bool sendThroughObjectEventFilters(QObject *, QEvent *);
static bool notify_helper(QObject *, QEvent *);
- static inline void setEventSpontaneous(QEvent *e, bool spontaneous) { e->spont = spontaneous; }
+ static inline void setEventSpontaneous(QEvent *e, bool spontaneous) { e->m_spont = spontaneous; }
virtual void createEventDispatcher();
virtual void eventDispatcherReady();
diff --git a/src/corelib/kernel/qcoreapplication_win.cpp b/src/corelib/kernel/qcoreapplication_win.cpp
index b3b3e6c4da..628313fbac 100644
--- a/src/corelib/kernel/qcoreapplication_win.cpp
+++ b/src/corelib/kernel/qcoreapplication_win.cpp
@@ -865,7 +865,7 @@ void QCoreApplicationPrivate::removePostedTimerEvent(QObject *object, int timerI
&& (pe.event->type() == QEvent::Timer || pe.event->type() == QEvent::ZeroTimerEvent)
&& static_cast<QTimerEvent *>(pe.event)->timerId() == timerId) {
--pe.receiver->d_func()->postedEvents;
- pe.event->posted = false;
+ pe.event->m_posted = false;
delete pe.event;
const_cast<QPostEvent &>(pe).event = 0;
return;
diff --git a/src/corelib/kernel/qcoreevent.cpp b/src/corelib/kernel/qcoreevent.cpp
index af89524dc4..ceb1a35775 100644
--- a/src/corelib/kernel/qcoreevent.cpp
+++ b/src/corelib/kernel/qcoreevent.cpp
@@ -294,8 +294,9 @@ QT_BEGIN_NAMESPACE
Contructs an event object of type \a type.
*/
QEvent::QEvent(Type type)
- : d(nullptr), t(type), posted(false), spont(false), m_accept(true),
- m_inputEvent(false), m_pointerEvent(false), m_singlePointEvent(false)
+ : d(nullptr), t(type), m_posted(false), m_spont(false), m_accept(true),
+ m_inputEvent(false), m_pointerEvent(false), m_singlePointEvent(false),
+ m_reserved(0)
{
Q_TRACE(QEvent_ctor, this, t);
}
@@ -305,9 +306,10 @@ QEvent::QEvent(Type type)
Copies the \a other event.
*/
QEvent::QEvent(const QEvent &other)
- : d(other.d), t(other.t), posted(other.posted), spont(other.spont),
+ : d(other.d), t(other.t), m_posted(other.m_posted), m_spont(other.m_spont),
m_accept(other.m_accept), m_inputEvent(other.m_inputEvent),
- m_pointerEvent(other.m_pointerEvent), m_singlePointEvent(other.m_singlePointEvent)
+ m_pointerEvent(other.m_pointerEvent), m_singlePointEvent(other.m_singlePointEvent),
+ m_reserved(other.m_reserved)
{
Q_TRACE(QEvent_ctor, this, t);
// if QEventPrivate becomes available, make sure to implement a
@@ -355,8 +357,8 @@ QEvent &QEvent::operator=(const QEvent &other)
Q_ASSERT_X(!other.d, "QEvent", "Impossible, this can't happen: QEventPrivate isn't defined anywhere");
t = other.t;
- posted = other.posted;
- spont = other.spont;
+ m_posted = other.m_posted;
+ m_spont = other.m_spont;
m_accept = other.m_accept;
return *this;
}
@@ -369,7 +371,7 @@ QEvent &QEvent::operator=(const QEvent &other)
QEvent::~QEvent()
{
Q_TRACE(QEvent_dtor, this, t);
- if (posted && QCoreApplication::instance())
+ if (m_posted && QCoreApplication::instance())
QCoreApplicationPrivate::removePostedEvent(this);
Q_ASSERT_X(!d, "QEvent", "Impossible, this can't happen: QEventPrivate isn't defined anywhere");
}
diff --git a/src/corelib/kernel/qcoreevent.h b/src/corelib/kernel/qcoreevent.h
index 88262659e9..4beb064d92 100644
--- a/src/corelib/kernel/qcoreevent.h
+++ b/src/corelib/kernel/qcoreevent.h
@@ -298,7 +298,7 @@ public:
virtual ~QEvent();
QEvent &operator=(const QEvent &other);
inline Type type() const { return static_cast<Type>(t); }
- inline bool spontaneous() const { return spont; }
+ inline bool spontaneous() const { return m_spont; }
inline virtual void setAccepted(bool accepted) { m_accept = accepted; }
inline bool isAccepted() const { return m_accept; }
@@ -323,13 +323,13 @@ protected:
quint16 t;
private:
- quint16 posted : 1;
- quint16 spont : 1;
+ quint16 m_posted : 1;
+ quint16 m_spont : 1;
quint16 m_accept : 1;
quint16 m_inputEvent : 1;
quint16 m_pointerEvent : 1;
quint16 m_singlePointEvent : 1;
- quint16 reserved : 10;
+ quint16 m_reserved : 10;
friend class QCoreApplication;
friend class QCoreApplicationPrivate;
@@ -345,7 +345,7 @@ private:
friend class QSpontaneKeyEvent;
// needs this:
Q_ALWAYS_INLINE
- void setSpontaneous() { spont = true; }
+ void setSpontaneous() { m_spont = true; }
};
class Q_CORE_EXPORT QTimerEvent : public QEvent
diff --git a/src/corelib/thread/qthread.cpp b/src/corelib/thread/qthread.cpp
index 70ec71c26d..543c491201 100644
--- a/src/corelib/thread/qthread.cpp
+++ b/src/corelib/thread/qthread.cpp
@@ -97,7 +97,7 @@ QThreadData::~QThreadData()
const QPostEvent &pe = postEventList.at(i);
if (pe.event) {
--pe.receiver->d_func()->postedEvents;
- pe.event->posted = false;
+ pe.event->m_posted = false;
delete pe.event;
}
}
diff --git a/src/widgets/graphicsview/qgraphicsscene.cpp b/src/widgets/graphicsview/qgraphicsscene.cpp
index 4880e316e2..2f3cb4eaaf 100644
--- a/src/widgets/graphicsview/qgraphicsscene.cpp
+++ b/src/widgets/graphicsview/qgraphicsscene.cpp
@@ -1254,7 +1254,7 @@ bool QGraphicsScenePrivate::sendEvent(QGraphicsItem *item, QEvent *event)
bool spont = event->spontaneous();
if (spont ? qt_sendSpontaneousEvent(o, event) : QCoreApplication::sendEvent(o, event))
return true;
- event->spont = spont;
+ event->m_spont = spont;
}
return item->sceneEvent(event);
}
@@ -1443,7 +1443,7 @@ void QGraphicsScenePrivate::mousePressEventHandler(QGraphicsSceneMouseEvent *mou
// event is converted to a press. Known limitation:
// Triple-clicking will not generate a doubleclick, though.
QGraphicsSceneMouseEvent mousePress(QEvent::GraphicsSceneMousePress);
- mousePress.spont = mouseEvent->spont;
+ mousePress.m_spont = mouseEvent->spontaneous();
mousePress.accept();
mousePress.setButton(mouseEvent->button());
mousePress.setButtons(mouseEvent->buttons());
@@ -6032,7 +6032,7 @@ bool QGraphicsScenePrivate::sendTouchBeginEvent(QGraphicsItem *origin, QTouchEve
} else {
item->d_ptr->acceptedTouchBeginEvent = (res && eventAccepted);
}
- touchEvent->spont = false;
+ touchEvent->m_spont = false;
if (res && eventAccepted) {
// the first item to accept the TouchBegin gets an implicit grab.
const auto &touchPoints = touchEvent->points();
diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp
index 7d10e700e9..1440b14d41 100644
--- a/src/widgets/kernel/qapplication.cpp
+++ b/src/widgets/kernel/qapplication.cpp
@@ -2842,7 +2842,7 @@ bool QApplication::notify(QObject *receiver, QEvent *e)
while (w) {
QMouseEvent me(mouse->type(), relpos, mouse->scenePosition(), mouse->globalPosition().toPoint(),
mouse->button(), mouse->buttons(), mouse->modifiers(), mouse->source());
- me.spont = mouse->spontaneous();
+ me.m_spont = mouse->spontaneous();
me.setTimestamp(mouse->timestamp());
QMutableSinglePointEvent::from(me).setDoubleClick(QMutableSinglePointEvent::from(mouse)->isDoubleClick());
// throw away any mouse-tracking-only mouse events
@@ -2854,7 +2854,7 @@ bool QApplication::notify(QObject *receiver, QEvent *e)
} else {
w->setAttribute(Qt::WA_NoMouseReplay, false);
res = d->notify_helper(w, w == receiver ? mouse : &me);
- e->spont = false;
+ e->m_spont = false;
}
eventAccepted = (w == receiver ? mouse : &me)->isAccepted();
if (res && eventAccepted)
@@ -2970,7 +2970,7 @@ bool QApplication::notify(QObject *receiver, QEvent *e)
we.setTimestamp(wheel->timestamp());
bool eventAccepted;
do {
- we.spont = wheel->spontaneous() && w == receiver;
+ we.m_spont = wheel->spontaneous() && w == receiver;
res = d->notify_helper(w, &we);
eventAccepted = we.isAccepted();
if (res && eventAccepted)
@@ -2994,10 +2994,10 @@ bool QApplication::notify(QObject *receiver, QEvent *e)
bool eventAccepted = context->isAccepted();
while (w) {
QContextMenuEvent ce(context->reason(), relpos, context->globalPos(), context->modifiers());
- ce.spont = e->spontaneous();
+ ce.m_spont = e->spontaneous();
res = d->notify_helper(w, w == receiver ? context : &ce);
eventAccepted = ((w == receiver) ? context : &ce)->isAccepted();
- e->spont = false;
+ e->m_spont = false;
if ((res && eventAccepted)
|| w->isWindow() || w->testAttribute(Qt::WA_NoMousePropagation))
@@ -3024,11 +3024,11 @@ bool QApplication::notify(QObject *receiver, QEvent *e)
tablet->pressure(), tablet->xTilt(), tablet->yTilt(),
tablet->tangentialPressure(), tablet->rotation(), tablet->z(),
tablet->modifiers(), tablet->button(), tablet->buttons());
- te.spont = e->spontaneous();
+ te.m_spont = e->spontaneous();
te.setAccepted(false);
res = d->notify_helper(w, w == receiver ? tablet : &te);
eventAccepted = ((w == receiver) ? tablet : &te)->isAccepted();
- e->spont = false;
+ e->m_spont = false;
if ((res && eventAccepted)
|| w->isWindow()
|| w->testAttribute(Qt::WA_NoMousePropagation))
@@ -3053,9 +3053,9 @@ bool QApplication::notify(QObject *receiver, QEvent *e)
bool eventAccepted = help->isAccepted();
while (w) {
QHelpEvent he(help->type(), relpos, help->globalPos());
- he.spont = e->spontaneous();
+ he.m_spont = e->spontaneous();
res = d->notify_helper(w, w == receiver ? help : &he);
- e->spont = false;
+ e->m_spont = false;
eventAccepted = (w == receiver ? help : &he)->isAccepted();
if ((res && eventAccepted) || w->isWindow())
break;
@@ -3175,7 +3175,7 @@ bool QApplication::notify(QObject *receiver, QEvent *e)
} else {
widget->setAttribute(Qt::WA_WState_AcceptedTouchBeginEvent, res && eventAccepted);
}
- touchEvent->spont = false;
+ touchEvent->m_spont = false;
if (res && eventAccepted) {
// the first widget to accept the TouchBegin gets an implicit grab.
d->activateImplicitTouchGrab(widget, touchEvent);
@@ -3271,11 +3271,11 @@ bool QApplication::notify(QObject *receiver, QEvent *e)
if (!gestures.isEmpty()) { // we have gestures for this w
QGestureEvent ge(gestures);
ge.t = gestureEvent->t;
- ge.spont = gestureEvent->spont;
+ ge.m_spont = gestureEvent->spontaneous();
ge.m_accept = wasAccepted;
ge.m_accepted = gestureEvent->m_accepted;
res = d->notify_helper(w, &ge);
- gestureEvent->spont = false;
+ gestureEvent->m_spont = false;
eventAccepted = ge.isAccepted();
for (int i = 0; i < gestures.size(); ++i) {
QGesture *g = gestures.at(i);