LGTM: [skip ci] fix: Inconsistent definition of copy constructor and assignment ('Rule of Two')

This commit is contained in:
wmayer
2020-07-27 14:39:14 +02:00
parent 3b0eeb63e8
commit 244d7aae41
7 changed files with 51 additions and 0 deletions

View File

@@ -50,6 +50,21 @@ MotionEvent::MotionEvent(const MotionEvent& in) : EventBase(static_cast<QEvent::
handled = in.handled;
}
MotionEvent& MotionEvent::operator= (const MotionEvent& in)
{
if (this == &in)
return *this;
xTrans = in.xTrans;
yTrans = in.yTrans;
zTrans = in.zTrans;
xRot = in.xRot;
yRot = in.yRot;
zRot = in.zRot;
handled = in.handled;
return *this;
}
void MotionEvent::translations(int &xTransOut, int &yTransOut, int &zTransOut)
{
xTransOut = xTrans;
@@ -91,6 +106,17 @@ ButtonEvent::ButtonEvent(const ButtonEvent& in) : EventBase(static_cast<QEvent::
handled = in.handled;
}
ButtonEvent& ButtonEvent::operator= (const ButtonEvent& in)
{
if (this == &in)
return *this;
buttonState = in.buttonState;
button = in.button;
handled = in.handled;
return *this;
}
ButtonStateType ButtonEvent::buttonStatus()
{
return buttonState;