{
double angle;
for( n = 0; n < paintLines.count(); ++n ) {
k = paintLines[n];
temp = k.split( "," );
xs = temp[0].toInt( &ok );
ys = temp[1].toInt( &ok );
xe = temp[2].toInt( &ok );
ye = temp[3].toInt( &ok );
painter.drawLine( xs, ys, xe, ye );
}
for( n = 0; n < paintLabels.count(); ++n ) {
k = paintLabels[n];
temp = k.split( "," );
xs = temp[0].toInt( &ok );
ys = temp[1].toInt( &ok );
angle = temp[2].toDouble( &ok );
painter.save();
painter.translate( xs, ys );
painter.rotate( angle );
painter.drawText( 0, 0, temp[3] );
//painter.drawText( xs, ys, temp[3] );
painter.restore();
}
}
void edpForm::paintEvent(QPaintEvent *event)
{
double angle;
QPainter painter( this );
for( n = 0; n < paintLines.count(); ++n ) {
k = paintLines[n];
temp = k.split( "," );
xs = temp[0].toInt( &ok );
ys = temp[1].toInt( &ok );
xe = temp[2].toInt( &ok );
ye = temp[3].toInt( &ok );
painter.drawLine( xs, ys, xe, ye );
}
for( n = 0; n < paintLabels.count(); ++n ) {
k = paintLabels[n];
temp = k.split( "," );
xs = temp[0].toInt( &ok );
ys = temp[1].toInt( &ok );
angle = temp[2].toDouble( &ok );
painter.save();
painter.translate( xs, ys );
painter.rotate( angle );
painter.drawText( 0, 0, temp[3] );
//painter.drawText( xs, ys, temp[3] );
painter.restore();
}
}
To copy to clipboard, switch view to plain text mode
Bookmarks