|
Not much more to tell.
void layerDemo::execComm(Document_Interface *doc,
QWidget *parent, QString cmd)
{
//to make the compiler happy
Q_UNUSED(cmd);
Q_UNUSED(parent);
QPointF start;
QPointF end;
//stores current layer
QString cl = doc->getCurrentLayer();
//create new layer called "bottom" and set current
doc->setLayer( QString("bottom") );
//create a line in current layer ("bottom")
start.setX = 0.0;
start.setY = 0.0;
end.setX = 10.0;
end.setY = 0.0;
doc->addLine(&start, &end);
//another layer, called "left"
doc->setLayer( QString("left") );
//create a line in current layer ("left")
end.setX = 0.0;
end.setY = 10.0;
doc->addLine(&start, &end);
//restore as current the layer which had before running the plugin
doc->setLayer( cl );
}
|