2 var <drawFunc, <drawingEnabled=true;
4 *qtClass { ^'QcCustomPainted' }
6 *new { arg parent, bounds;
7 var me = super.new(parent, bounds ?? {this.sizeHint} );
16 drawingEnabled_ { arg boolean;
17 // Allow setting the property apart from the instance variable
18 // to optimize when drawFunc is nil. See drawFunc_ implementation.
19 drawingEnabled = boolean;
20 this.setProperty( \drawingEnabled, boolean );
23 clearOnRefresh { ^this.getProperty( \clearOnRefresh ); }
24 clearOnRefresh_ { arg boolean; this.setProperty( \clearOnRefresh, boolean ); }
26 clearDrawing { this.invokeMethod( \clear ); }
28 drawFunc_ { arg aFunction;
29 this.setProperty( \drawingEnabled, aFunction.notNil );
34 // NOTE: it is only allowed to call this while a QPaintEvent is being
35 // processed by this QWidget, or an error will be thrown.
39 animate_ { arg bool; this.invokeMethod( \animate, bool ); }
41 frameRate_ { arg fps; this.setProperty( \frameRate, fps.asFloat ); }
42 frameRate { ^this.getProperty( \frameRate ); }
44 frame { ^this.getProperty( \frameCount ); }
46 // override QView's action_ to not connect to 'action()' signal
51 doDrawFunc { drawFunc.value(this) }