Fix warning: -Wdeprecated-copy - implement StrutRect::operator=

Summary:
/home/frederik/kdesrc/kde/workspace/kwin/geometry.cpp:156:88: warning: implicitly-declared ‘constexpr KWin::StrutRect& KWin::StrutRect::operator=(const KWin::StrutRect&)’ is deprecated [-Wdeprecated-copy]
  156 |             *strut = StrutRect((*strut).intersected(clientsScreenRect), (*strut).area());
      |                                                                                        ^
In file included from /home/frederik/kdesrc/kde/workspace/kwin/rules.h:32,
                 from /home/frederik/kdesrc/kde/workspace/kwin/client.h:27,
                 from /home/frederik/kdesrc/kde/workspace/kwin/geometry.cpp:30:
/home/frederik/kdesrc/kde/workspace/kwin/utils.h:113:5: note: because ‘KWin::StrutRect’ has user-provided ‘KWin::StrutRect::StrutRect(const KWin::StrutRect&)’
  113 |     StrutRect(const StrutRect& other);
      |     ^~~~~~~~~

Reviewers: #kwin, zzag

Reviewed By: #kwin, zzag

Subscribers: zzag, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D23084
icc-effect-5.17.5
Frederik Gladhorn 2019-08-11 15:58:57 +02:00
parent e6ad8786da
commit dd944b2d5e
2 changed files with 10 additions and 0 deletions

View File

@ -69,6 +69,15 @@ StrutRect::StrutRect(const StrutRect& other)
{
}
StrutRect &StrutRect::operator=(const StrutRect &other)
{
if (this != &other) {
QRect::operator=(other);
m_area = other.area();
}
return *this;
}
#endif
#ifndef KCMRULES

View File

@ -111,6 +111,7 @@ class StrutRect : public QRect
public:
explicit StrutRect(QRect rect = QRect(), StrutArea area = StrutAreaInvalid);
StrutRect(const StrutRect& other);
StrutRect &operator=(const StrutRect& other);
inline StrutArea area() const {
return m_area;
}