diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-01-08 09:43:42 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-01-08 09:43:42 +0200 |
commit | 93dae42fd4e5c7425cd0dfa945acd2fa0512d27f (patch) | |
tree | fa21f16fbe03a6501689ffe4122a30f60c9f9d4f /vcl/qt5 | |
parent | 4f3c5db4dfacfad32ef207193a21c96e1d39da85 (diff) |
loplugin:useuniqueptr in qt5
Change-Id: Ic7135e6ca3be7848fa39cd442d6dd716ea090713
Diffstat (limited to 'vcl/qt5')
-rw-r--r-- | vcl/qt5/Qt5Data.cxx | 11 | ||||
-rw-r--r-- | vcl/qt5/Qt5Data.hxx | 3 | ||||
-rw-r--r-- | vcl/qt5/Qt5Graphics.cxx | 7 | ||||
-rw-r--r-- | vcl/qt5/Qt5Graphics.hxx | 2 | ||||
-rw-r--r-- | vcl/qt5/Qt5Graphics_Text.cxx | 5 |
5 files changed, 8 insertions, 20 deletions
diff --git a/vcl/qt5/Qt5Data.cxx b/vcl/qt5/Qt5Data.cxx index 7d529964eed9..5c5a341df208 100644 --- a/vcl/qt5/Qt5Data.cxx +++ b/vcl/qt5/Qt5Data.cxx @@ -27,20 +27,13 @@ Qt5Data::Qt5Data(SalInstance* pInstance) : GenericUnixSalData(SAL_DATA_QT5, pInstance) { - for (QCursor*& rpCsr : m_aCursors) - rpCsr = nullptr; - ImplSVData* pSVData = ImplGetSVData(); // draw toolbars on separate lines pSVData->maNWFData.mbDockingAreaSeparateTB = true; } -Qt5Data::~Qt5Data() -{ - for (QCursor*& rpCsr : m_aCursors) - delete rpCsr; -} +Qt5Data::~Qt5Data() {} static QCursor* getQCursorFromXBM(const unsigned char* pBitmap, const unsigned char* pMask, int nWidth, int nHeight, int nXHot, int nYHot) @@ -184,7 +177,7 @@ QCursor& Qt5Data::getCursor(PointerStyle ePointerStyle) SAL_WARN("vcl.qt5", "pointer " << static_cast<int>(ePointerStyle) << "not implemented"); } - m_aCursors[ePointerStyle] = pCursor; + m_aCursors[ePointerStyle].reset(pCursor); } return *m_aCursors[ePointerStyle]; diff --git a/vcl/qt5/Qt5Data.hxx b/vcl/qt5/Qt5Data.hxx index a63d243b6967..f8cf4fb05e6a 100644 --- a/vcl/qt5/Qt5Data.hxx +++ b/vcl/qt5/Qt5Data.hxx @@ -23,12 +23,13 @@ #include <o3tl/enumarray.hxx> #include <vcl/ptrstyle.hxx> +#include <memory> class QCursor; class Qt5Data : public GenericUnixSalData { - o3tl::enumarray<PointerStyle, QCursor*> m_aCursors; + o3tl::enumarray<PointerStyle, std::unique_ptr<QCursor>> m_aCursors; public: explicit Qt5Data(SalInstance* pInstance); diff --git a/vcl/qt5/Qt5Graphics.cxx b/vcl/qt5/Qt5Graphics.cxx index 411dfd7543b8..23249c5799c6 100644 --- a/vcl/qt5/Qt5Graphics.cxx +++ b/vcl/qt5/Qt5Graphics.cxx @@ -44,12 +44,7 @@ Qt5Graphics::Qt5Graphics( Qt5Frame *pFrame, QImage *pQImage ) ResetClipRegion(); } -Qt5Graphics::~Qt5Graphics() -{ - // release the text styles - for (int i = 0; i < MAX_FALLBACK; ++i) - delete m_pTextStyle[i]; -} +Qt5Graphics::~Qt5Graphics() {} void Qt5Graphics::ChangeQImage(QImage* pQImage) { diff --git a/vcl/qt5/Qt5Graphics.hxx b/vcl/qt5/Qt5Graphics.hxx index 6e8332356d49..a9a71c64b5e2 100644 --- a/vcl/qt5/Qt5Graphics.hxx +++ b/vcl/qt5/Qt5Graphics.hxx @@ -49,7 +49,7 @@ class Qt5Graphics : public SalGraphics PhysicalFontCollection* m_pFontCollection; const Qt5FontFace* m_pFontData[MAX_FALLBACK]; - Qt5Font* m_pTextStyle[MAX_FALLBACK]; + std::unique_ptr<Qt5Font> m_pTextStyle[MAX_FALLBACK]; SalColor m_aTextColor; Qt5Graphics(Qt5Frame* pFrame, QImage* pQImage); diff --git a/vcl/qt5/Qt5Graphics_Text.cxx b/vcl/qt5/Qt5Graphics_Text.cxx index ec07d50e4af6..8d25e97df786 100644 --- a/vcl/qt5/Qt5Graphics_Text.cxx +++ b/vcl/qt5/Qt5Graphics_Text.cxx @@ -39,8 +39,7 @@ void Qt5Graphics::SetFont(const FontSelectPattern* pReqFont, int nFallbackLevel) { if (!m_pTextStyle[i]) break; - delete m_pTextStyle[i]; - m_pTextStyle[i] = nullptr; + m_pTextStyle[i].reset(); } if (!pReqFont) @@ -49,7 +48,7 @@ void Qt5Graphics::SetFont(const FontSelectPattern* pReqFont, int nFallbackLevel) else { m_pFontData[nFallbackLevel] = static_cast<const Qt5FontFace*>(pReqFont->mpFontData); - m_pTextStyle[nFallbackLevel] = new Qt5Font(*pReqFont); + m_pTextStyle[nFallbackLevel].reset(new Qt5Font(*pReqFont)); } } |