From Cesar L.B. Silveira, "I have written these few lines of code which allow setting the label
of an osgWidget::Label with an osgText::String. I had to do this on a project I'm working on, because I needed UTF-8 strings on my labels, and using setLabel with std::string was not working. "
This commit is contained in:
parent
058d31d7b5
commit
3fce07e5e5
@ -36,6 +36,7 @@ class OSGWIDGET_EXPORT Label: public Widget
|
|||||||
virtual void positioned ();
|
virtual void positioned ();
|
||||||
|
|
||||||
void setLabel (const std::string&);
|
void setLabel (const std::string&);
|
||||||
|
void setLabel (const osgText::String&);
|
||||||
void setFont (const std::string&);
|
void setFont (const std::string&);
|
||||||
void setFontSize (unsigned int);
|
void setFontSize (unsigned int);
|
||||||
void setFontColor (const Color&);
|
void setFontColor (const Color&);
|
||||||
|
@ -108,6 +108,13 @@ void Label::setLabel(const std::string& label) {
|
|||||||
_calculateSize(getTextSize());
|
_calculateSize(getTextSize());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Label::setLabel(const osgText::String& label)
|
||||||
|
{
|
||||||
|
_text->setText(label);
|
||||||
|
|
||||||
|
_calculateSize(getTextSize());
|
||||||
|
}
|
||||||
|
|
||||||
void Label::setFont(const std::string& font) {
|
void Label::setFont(const std::string& font) {
|
||||||
_text->setFont(font);
|
_text->setFont(font);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user