diff --git a/cocos/ui/UIText.cpp b/cocos/ui/UIText.cpp index 77f7d18cf2..ba9806f12e 100644 --- a/cocos/ui/UIText.cpp +++ b/cocos/ui/UIText.cpp @@ -115,7 +115,7 @@ const std::string& Text::getString() const return _labelRenderer->getString(); } -ssize_t Text::getStringLength() +ssize_t Text::getStringLength()const { return _labelRenderer->getStringLength(); } diff --git a/cocos/ui/UIText.h b/cocos/ui/UIText.h index 3b2690b3f0..408a93623a 100644 --- a/cocos/ui/UIText.h +++ b/cocos/ui/UIText.h @@ -87,7 +87,7 @@ public: * * @return string length. */ - ssize_t getStringLength(); + ssize_t getStringLength()const; /** * Sets the font size of label. diff --git a/cocos/ui/UITextAtlas.cpp b/cocos/ui/UITextAtlas.cpp index bce366478b..d249f4422b 100644 --- a/cocos/ui/UITextAtlas.cpp +++ b/cocos/ui/UITextAtlas.cpp @@ -114,7 +114,7 @@ const std::string& TextAtlas::getString() const return _labelAtlasRenderer->getString(); } -ssize_t TextAtlas::getStringLength() +ssize_t TextAtlas::getStringLength()const { return _labelAtlasRenderer->getStringLength(); } diff --git a/cocos/ui/UITextAtlas.h b/cocos/ui/UITextAtlas.h index 18942830bd..4ffa93f927 100644 --- a/cocos/ui/UITextAtlas.h +++ b/cocos/ui/UITextAtlas.h @@ -87,7 +87,7 @@ public: * * @return string length. */ - ssize_t getStringLength(); + ssize_t getStringLength()const; //override "getVirtualRendererSize" method of widget. virtual const Size& getVirtualRendererSize() const override; diff --git a/cocos/ui/UITextBMFont.cpp b/cocos/ui/UITextBMFont.cpp index 28b6e050a5..f6769ee2dc 100644 --- a/cocos/ui/UITextBMFont.cpp +++ b/cocos/ui/UITextBMFont.cpp @@ -108,7 +108,7 @@ const std::string& TextBMFont::getString()const return _stringValue; } -ssize_t TextBMFont::getStringLength() +ssize_t TextBMFont::getStringLength()const { return _labelBMFontRenderer->getStringLength(); } diff --git a/cocos/ui/UITextBMFont.h b/cocos/ui/UITextBMFont.h index 03c3334555..5cca667916 100644 --- a/cocos/ui/UITextBMFont.h +++ b/cocos/ui/UITextBMFont.h @@ -76,7 +76,7 @@ public: * * @return string length. */ - ssize_t getStringLength(); + ssize_t getStringLength()const; virtual const Size& getVirtualRendererSize() const override; virtual Node* getVirtualRenderer() override;