Setting a default pencolor for qvectorlayer, and persistent penwidth

Q&ACategory: BugSetting a default pencolor for qvectorlayer, and persistent penwidth
sdonn asked 3 years ago

I often face two problems with the qvectorlayer:

  • there is no default pencolor (when OpenGL rendering is checked in the runtime program settings): whenever i don’t set anything explicitly, nothing is drawn. This in stark contrast with penwidth,pendashstyle, etc.

Testing code:

    import "Quasar.UI.dll"
    import "system.q"

    function [] = main()
        main1()
        main2()
    end

    function [] = main1()
        frm = form()
        dsp = frm.add_display()
        ims = dsp.imshow(cat(zeros(320,160),ones(320,160)),[-1,2])
        
        lyr = new(qvectorlayer)
        ims.addlayer(lyr)
        lyr.drawline([50,50],[270,50])
        lyr.fillellipse([100,100],[220,220])
        ims.update()
    end
    
    function [] = main2()
        frm = form()
        dsp = frm.add_display()
        ims = dsp.imshow(cat(zeros(320,160),ones(320,160)),[-1,2])
        
        lyr = new(qvectorlayer)
        ims.addlayer(lyr)
        lyr.setpencolor("black")
        lyr.drawline([50,50],[270,50])
        lyr.setbrushcolor("white")
        lyr.fillellipse([100,100],[220,220])
        ims.update()
    end

This results in the following output

  • The penwidth persists after I finish drawing: changes are reflected in e.g. the selection dropper.

https://puu.sh/qlXRh/2b4e41567f.png