Modeling: Fix deprecation warning

In file included from /data/dev/qt-5/qtbase/include/QtCore/qlist.h:1,
                 from /data/dev/qt-5/qtbase/include/QtCore/../../src/corelib/kernel/qobject.h:49,
                 from /data/dev/qt-5/qtbase/include/QtCore/qobject.h:1,
                 from /data/dev/qt-5/qtbase/include/QtCore/../../src/corelib/io/qiodevice.h:45,
                 from /data/dev/qt-5/qtbase/include/QtCore/qiodevice.h:1,
                 from /data/dev/qt-5/qtbase/include/QtCore/../../src/corelib/serialization/qdatastream.h:44,
                 from /data/dev/qt-5/qtbase/include/QtCore/qdatastream.h:1,
                 from /data/dev/qt-5/qtbase/include/QtCore/QDataStream:1,
                 from ./qmt/infrastructure/uid.h:30,
                 from qmt/model/melement.h:28,
                 from qmt/model/mobject.h:28,
                 from qmt/model/mobject.cpp:26:
/data/dev/qt-5/qtbase/include/QtCore/../../src/corelib/tools/qlist.h: In instantiation of ‘void QList<T>::node_construct(QList<T>::Node*, const T&) [with T = qmt::Handle<qmt::MObject>]’:
/data/dev/qt-5/qtbase/include/QtCore/../../src/corelib/tools/qlist.h:622:13:   required from ‘void QList<T>::append(const T&) [with T = qmt::Handle<qmt::MObject>]’
./qmt/infrastructure/handles.h:162:9:   required from ‘void qmt::Handles<T>::add(const qmt::Uid&) [with T = qmt::MObject]’
qmt/model/mobject.cpp:80:23:   required from here
/data/dev/qt-5/qtbase/include/QtCore/../../src/corelib/tools/qlist.h:471:35: warning: implicitly-declared ‘constexpr qmt::Handle<qmt::MObject>& qmt::Handle<qmt::MObject>::operator=(const qmt::Handle<qmt::MObject>&)’ is deprecated [-Wdeprecated-copy]
  471 |     else *reinterpret_cast<T*>(n) = t;
      |          ~~~~~~~~~~~~~~~~~~~~~~~~~^~~
In file included from ./qmt/infrastructure/handles.h:28,
                 from qmt/model/mobject.h:29,
                 from qmt/model/mobject.cpp:26:
./qmt/infrastructure/handle.h:40:5: note: because ‘qmt::Handle<qmt::MObject>’ has user-provided ‘qmt::Handle<T>::Handle(const qmt::Handle<T>&) [with T = qmt::MObject]’
   40 |     Handle(const Handle &rhs) : m_uid(rhs.m_uid), m_target(rhs.m_target) { }
      |     ^~~~~~

Change-Id: I9fe85f5b46912a52d1722da0f048d4eee6171ade
Reviewed-by: Jochen Becher <jochen_becher@gmx.de>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
hjk
2020-02-19 09:17:08 +01:00
parent 45a575c218
commit b2a31f5be8

View File

@@ -41,6 +41,8 @@ public:
template<class U>
Handle(const Handle<U> &rhs) : m_uid(rhs.uid()), m_target(rhs.target()) { }
Handle &operator=(const Handle &) = default;
bool isNull() const { return !m_uid.isValid(); }
bool hasTarget() const { return m_target != nullptr; }
Uid uid() const { return m_uid; }