Posted by
corecible on
Oct 26, 2014; 3:23am
URL: https://forum.librecad.org/RS-TextData-const-QString-style-error-tp5710573p5710576.html
use these codes ,it doesn't work!
void QC_ApplicationWindow::slotTestInsertText() {
RS_DEBUG->print("QC_ApplicationWindow::slotTestInsertMText()");
RS_Document* d = getDocument();
if (d!=NULL) {
RS_Graphic* graphic = (RS_Graphic*)d;
if (graphic==NULL) {
return;
}
RS_Text* text;
RS_TextData textData;
textData = RS_TextData(RS_Vector(10.0,10.0),RS_Vector(10.0,10.0),
10.0, 1.0,
RS_TextData::VABaseline,
RS_TextData::HALeft,
RS_TextData::None,
"LibreCAD",
"iso",
0.0);
text = new RS_Text(graphic, textData);
text->setLayerToActive();
text->setPen(RS_Pen(RS_Color(255, 0, 0),
RS2::Width01,
RS2::SolidLine));
graphic->addEntity(text);
}

use these codes ,it works! well.
void QC_ApplicationWindow::slotTestInsertMText() {
RS_DEBUG->print("QC_ApplicationWindow::slotTestInsertMText()");
RS_Document* d = getDocument();
if (d!=NULL) {
RS_Graphic* graphic = (RS_Graphic*)d;
if (graphic==NULL) {
return;
}
RS_MText* text;
RS_MTextData textData;
textData = RS_MTextData(RS_Vector(10.0,10.0),
10.0, 100.0,
RS_MTextData::VATop,
RS_MTextData::HALeft,
RS_MTextData::LeftToRight,
RS_MTextData::Exact,
1.0,
"LibreCAD",
"iso",
0.0);
text = new RS_MText(graphic, textData);
text->setLayerToActive();
text->setPen(RS_Pen(RS_Color(255, 0, 0),
RS2::Width01,
RS2::SolidLine));
graphic->addEntity(text);
}
}