1 (in-package :cl-smoke.qt.gui)
3 (defmacro qt:with-painter ((painter &optional paint-device) &body body)
4 "Binds a PAINTER instance for PAINT-DEVICE to PAINTER
5 during the evaluation of BODY. Or when PAINT-DEVICE is not
6 specified, saves and restored the state of PAINTER around BODY.
8 Makes sure the painter ends after BODY; thus preventing problems with
9 still active and not yet garbage collected painters in CXX:PAINT-EVENT."
11 `(let ((,painter (make-instance 'qt:painter :arg0 ,paint-device)))
12 (assert (cxx:is-active ,painter)
14 "Painter ~A for ~A is not active"
15 ,painter ,paint-device)
19 `(progn (cxx:save ,painter)
22 (cxx:restore ,painter)))))