setting layers

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

setting layers

Birpal Kaur
I have to set different layers for the different views(i.e top, front and side) of an object in my plugin. so  can anyone tell me how to make use of these functions:-
  virtual void setLayer(QString name) = 0;
  virtual QString getCurrentLayer() = 0;
Reply | Threaded
Open this post in threaded view
|

Re: setting layers

Rallaz
    /*! Set the current layer in current document, if not exist create it.
    *  \param name a QString with the name of the layer.
    */
    virtual void setLayer(QString name) = 0;



    /*! Get the current layer in current document.
    *  \return The name of the current layer.
    */
    virtual QString getCurrentLayer() = 0;
Reply | Threaded
Open this post in threaded view
|

Re: setting layers

Birpal Kaur
This post was updated on .
thanks Rallaz.
can you elaborate it more. Actually i dont know how to implement them.
Reply | Threaded
Open this post in threaded view
|

Re: setting layers

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