examples: Fix -Wdeprecated-copy warnings
examples/corelib/tools/customtypesending/window.cpp: In member function ‘void Window::sendMessage()’: examples/corelib/tools/customtypesending/window.cpp:79:71: warning: implicitly-declared ‘Message& Message::operator=(const Message&)’ is deprecated [-Wdeprecated-copy] 79 | thisMessage = Message(editor->toPlainText(), thisMessage.headers()); | ^ In file included from examples/corelib/tools/customtypesending/window.h:55, from examples/corelib/tools/customtypesending/window.cpp:52: examples/corelib/tools/customtypesending/message.h:62:5: note: because ‘Message’ has user-provided ‘Message::Message(const Message&)’ 62 | Message(const Message &other); | ^~~~~~~ examples/corelib/tools/customtypesending/window.cpp: In member function ‘void Window::setMessage(const Message&)’: examples/corelib/tools/customtypesending/window.cpp:87:19: warning: implicitly-declared ‘Message& Message::operator=(const Message&)’ is deprecated [-Wdeprecated-copy] 87 | thisMessage = message; | ^~~~~~~ In file included from examples/corelib/tools/customtypesending/window.h:55, from examples/corelib/tools/customtypesending/window.cpp:52: examples/corelib/tools/customtypesending/message.h:62:5: note: because ‘Message’ has user-provided ‘Message::Message(const Message&)’ 62 | Message(const Message &other); | ^~~~~~~ Change-Id: I563d53f7dd1e0e0dc5fd4db06299b2d0a70c62ff Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
This commit is contained in:
parent
d05ca484cf
commit
f121f319b9
@ -52,21 +52,6 @@
|
|||||||
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
|
||||||
//! [Message class implementation]
|
|
||||||
Message::Message()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
Message::Message(const Message &other)
|
|
||||||
: m_body(other.m_body), m_headers(other.m_headers)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
Message::~Message()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
//! [Message class implementation]
|
|
||||||
|
|
||||||
Message::Message(const QString &body, const QStringList &headers)
|
Message::Message(const QString &body, const QStringList &headers)
|
||||||
: m_body(body), m_headers(headers)
|
: m_body(body), m_headers(headers)
|
||||||
{
|
{
|
||||||
|
@ -58,9 +58,10 @@
|
|||||||
class Message
|
class Message
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Message();
|
Message() = default;
|
||||||
Message(const Message &other);
|
~Message() = default;
|
||||||
~Message();
|
Message(const Message &) = default;
|
||||||
|
Message &operator=(const Message &) = default;
|
||||||
|
|
||||||
Message(const QString &body, const QStringList &headers);
|
Message(const QString &body, const QStringList &headers);
|
||||||
|
|
||||||
|
@ -50,19 +50,6 @@
|
|||||||
|
|
||||||
#include "message.h"
|
#include "message.h"
|
||||||
|
|
||||||
Message::Message()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
Message::Message(const Message &other)
|
|
||||||
: m_body(other.m_body), m_headers(other.m_headers)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
Message::~Message()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
Message::Message(const QString &body, const QStringList &headers)
|
Message::Message(const QString &body, const QStringList &headers)
|
||||||
: m_body(body), m_headers(headers)
|
: m_body(body), m_headers(headers)
|
||||||
{
|
{
|
||||||
|
@ -58,9 +58,10 @@
|
|||||||
class Message
|
class Message
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Message();
|
Message() = default;
|
||||||
Message(const Message &other);
|
~Message() = default;
|
||||||
~Message();
|
Message(const Message &) = default;
|
||||||
|
Message &operator=(const Message &) = default;
|
||||||
|
|
||||||
Message(const QString &body, const QStringList &headers);
|
Message(const QString &body, const QStringList &headers);
|
||||||
|
|
||||||
|
@ -81,11 +81,6 @@
|
|||||||
|
|
||||||
\section1 The Message Class Implementation
|
\section1 The Message Class Implementation
|
||||||
|
|
||||||
The implementation of the default constructor, copy constructor and destructor
|
|
||||||
are straightforward for the \c Message class:
|
|
||||||
|
|
||||||
\snippet tools/customtype/message.cpp Message class implementation
|
|
||||||
|
|
||||||
The streaming operator is implemented in the following way:
|
The streaming operator is implemented in the following way:
|
||||||
|
|
||||||
\snippet tools/customtype/message.cpp custom type streaming operator
|
\snippet tools/customtype/message.cpp custom type streaming operator
|
||||||
|
Loading…
x
Reference in New Issue
Block a user