From 32f6b1be3e03a2b0d668caf1b30e334f73f23c32 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi <dismine@gmail.com> Date: Mon, 16 Jan 2023 11:40:21 +0200 Subject: [PATCH] Refactoring. --- src/libs/vlayout/vtextmanager.cpp | 27 +-------------------------- src/libs/vlayout/vtextmanager.h | 15 ++++++++++----- 2 files changed, 11 insertions(+), 31 deletions(-) diff --git a/src/libs/vlayout/vtextmanager.cpp b/src/libs/vlayout/vtextmanager.cpp index adec81999..15f6208bb 100644 --- a/src/libs/vlayout/vtextmanager.cpp +++ b/src/libs/vlayout/vtextmanager.cpp @@ -433,32 +433,7 @@ auto PrepareLines(const QVector<VLabelTemplateLine> &lines) -> QVector<TextLine> return textLines; } -} - -//--------------------------------------------------------------------------------------------------------------------- -/** - * @brief VTextManager::VTextManager constructor - */ -VTextManager::VTextManager() - : m_font(), m_liLines() -{} - -//--------------------------------------------------------------------------------------------------------------------- -VTextManager::VTextManager(const VTextManager &text) - : m_font(text.GetFont()), m_liLines(text.GetAllSourceLines()) -{} - -//--------------------------------------------------------------------------------------------------------------------- -VTextManager &VTextManager::operator=(const VTextManager &text) -{ - if ( &text == this ) - { - return *this; - } - m_font = text.GetFont(); - m_liLines = text.GetAllSourceLines(); - return *this; -} +} // namespace //--------------------------------------------------------------------------------------------------------------------- /** diff --git a/src/libs/vlayout/vtextmanager.h b/src/libs/vlayout/vtextmanager.h index 31ae47be5..9f12c52dc 100644 --- a/src/libs/vlayout/vtextmanager.h +++ b/src/libs/vlayout/vtextmanager.h @@ -72,11 +72,16 @@ class VTextManager { Q_DECLARE_TR_FUNCTIONS(VTextManager) // NOLINT public: - VTextManager(); + VTextManager() = default; virtual ~VTextManager() = default; - VTextManager(const VTextManager &text); - VTextManager &operator=(const VTextManager &text); + VTextManager(const VTextManager &text) = default; + auto operator=(const VTextManager &text) -> VTextManager & = default; + +#ifdef Q_COMPILER_RVALUE_REFS + VTextManager(VTextManager &&text) Q_DECL_NOTHROW = default; + auto operator=(VTextManager &&text) Q_DECL_NOTHROW -> VTextManager & = default; +#endif virtual auto GetSpacing() const -> int; @@ -99,8 +104,8 @@ public: friend auto operator>>(QDataStream& dataStream, VTextManager& data) -> QDataStream&; private: - QFont m_font; - QVector<TextLine> m_liLines; + QFont m_font{}; + QVector<TextLine> m_liLines{}; static const quint32 streamHeader; static const quint16 classVersion;