qlayer(parent, paintFun, keyPressFun, keyReleaseFun, mouseDoubleClickFun,
mouseMoveFun, mousePressFun, mouseReleaseFun, wheelFun,
hoverMoveFun, hoverEnterFun, hoverLeaveFun, contextMenuFun,
dragEnterFun, dragLeaveFun, dragMoveFun, dropFun, focusInFun,
focusOutFun, sizeHintFun, limits=qrect(), row=0, col=0, rowSpan=1,
colSpan=1, geometry=qrect(0, 0, 600, 400), clip=cache, cache=FALSE)QRectF, possibly created by
qrect, indicating the X and Y scales of the
layer in data/layer coordinatesQRectF, possibly created by
qrect, indicating the position and size of
the layer in figure/scene coordinates. This is overridden by the
parent grid layout, so is really only useful for a top-level layer.RLayerpaintFun, must take at least two arguments,
conventionally named layer and painter. The
layer argument is a C++ RLayer object, the same
instance that was created by calling the constructor. All painting
is performed through the painter argument, which is a C++
Painter object. See the paint functions
for more details. The paintFun may take one additional, optional
argument, conventionally named exposed, which is the rectangle,
in layer coordinates, that needs to be drawn.All of the other callbacks, except for sizeHintFun, are
event handlers. Two arguments are passed, conventionally named
layer and event. The former is the layer constructed
in the call to qlayer, and the latter describes the event
as an instance of C++ QGraphicsSceneEvent. The exact
subclass depends on the event. Manipulating an event currently
requires low-level calls through the qtbase package. See
its documentation.
scene <- qscene()
layer <- qlayer(scene, function(layer, painter) {
qdrawCircle(1:10, 1:10)
}, limits = qtbase::qrect(0, 0, 11, 11))
qplotView(scene)Run the code above in your browser using DataLab