RS_TextData const QString& style, error

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

RS_TextData const QString& style, error

corecible
This post was updated on .
when I use these codes:
 RS_TextData textData = RS_TextData(RS_Vector(IED_RECTANGLE_LEFTTOP_X,IED_RECTANGLE_LEFTTOP_Y-(height*2/3)),RS_Vector(IED_RECTANGLE_LEFTTOP_X+IED_RECTANGLE_WIDTH,IED_RECTANGLE_LEFTTOP_Y-(height*2/3)),
                                       (height/3>IED_NAME_HEIGHT)?IED_NAME_HEIGHT:height/3, 1.0,
                           RS_TextData::VABottom,
                           RS_TextData::HAFit,
                           RS_TextData::None,
                           iedName,
                           "wqy-unicode",
                           0.0);
    RS_Text* text = new RS_Text(graphic, textData);
    text->setPen(RS_Pen(RS_Color(255,255,255),RS2::Width01,RS2::SolidLine));
    graphic->addEntity(text);
set style to "wqy-unicode" ,or any other style such as iso,unicode. librecad will run 100% cpu. Is there any thing should I do?
 however when I only add image  that is OK。 I think redraw graph is the problem.
my dev env is :
debian Debian GUN/Linux 7.0 (wheezy)
qt version :4.8.2.
Reply | Threaded
Open this post in threaded view
|

Re: RS_TextData const QString& style, error

dxli
do you have a github branch for this change?

Or share a patch again the master branch.

Please include enough information to reproduce this issue.

corecible wrote
when I use these codes:
 RS_TextData textData = RS_TextData(RS_Vector(IED_RECTANGLE_LEFTTOP_X,IED_RECTANGLE_LEFTTOP_Y-(height*2/3)),RS_Vector(IED_RECTANGLE_LEFTTOP_X+IED_RECTANGLE_WIDTH,IED_RECTANGLE_LEFTTOP_Y-(height*2/3)),
                                       (height/3>IED_NAME_HEIGHT)?IED_NAME_HEIGHT:height/3, 1.0,
                           RS_TextData::VABottom,
                           RS_TextData::HAFit,
                           RS_TextData::None,
                           iedName,
                           "wqy-unicode",
                           0.0);
    RS_Text* text = new RS_Text(graphic, textData);
    text->setPen(RS_Pen(RS_Color(255,255,255),RS2::Width01,RS2::SolidLine));
    graphic->addEntity(text);
set style to "wqy-unicode" ,or any other style such as iso,unicode. librecad will run 100% cpu. Is there any thing should I do?
 however when I only add image  that is OK。 I think redraw graph is the problem.
my dev env is :
debian Debian GUN/Linux 7.0 (wheezy)
qt version :4.8.2.
Reply | Threaded
Open this post in threaded view
|

Re: RS_TextData const QString& style, error

corecible
sorry , I don't have a github branch .

but now, I use RS_MTextData 、 RS_MText to replace RS_TextData RS_Text . it works OK.
Reply | Threaded
Open this post in threaded view
|

Re: RS_TextData const QString& style, error

corecible
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);
    }
}