QVector translations
Annotate for file src/application.lisp
2010-01-10 tobias 1 (in-package :cl-smoke.qt.gui)
2009-04-05 tobias 2
17:56:16 ' 3 (defvar *widgets* nil)
' 4
2010-01-25 tobias 5 (defmethod delete-app :around ((application qt:application))
2010-01-10 tobias 6 (qt:application.close-all-windows)
08:52:49 ' 7 ;; widgets are only valid as long, as an application object
' 8 ;; exists. QApplication::~QApplication() deletes all widgets in
' 9 ;; QApplication::allWidgets().
' 10 ;;
' 11 ;; see: qt4/src/gui/kernel/qapplication.cpp
' 12 (loop for widget across (qt:application.all-widgets) do
' 13 (tg:cancel-finalization widget))
' 14 (call-next-method)
' 15 (setf *widgets* nil))
2009-04-05 tobias 16
2009-07-01 tobias 17 (defmacro qt:with-app (options &body body)
2009-04-05 tobias 18 "Ensures that a APPLICATION instance exists,
17:56:16 ' 19 evaluates BODY and executes the APPLICATION instance after BODY.
' 20 The instance can be accessed with:
2009-07-01 tobias 21 QT:APP.
2009-04-05 tobias 22
17:56:16 ' 23 Can be nested.
' 24
' 25 When a APPLICATION was created, it will be deleted when returning
' 26 from BODY."
2009-07-01 tobias 27 (assert (null options)
10:58:06 ' 28 (options)
' 29 "Currently no options can be passed to QT:WITH-APP.")
2010-01-23 tobias 30 `(cl-smoke.qt.core:with-application ((cl-smoke.qt.core:ensure-app 'qt:application)
19:48:00 ' 31 (cl-smoke.qt.core:kill-app))
2009-07-01 tobias 32 ,@body))
2009-04-05 tobias 33
2009-07-01 tobias 34 (defun qt:exec ()
10:58:06 ' 35 "Executes APP. When QT:*EXEC-P* is false it returns immediately
' 36 and transfers the ownership of the top-level widgets to the qt:application
' 37 instance."
' 38 (if qt:*exec-p*
' 39 (restart-bind ((qt::abort-app #'(lambda ()
' 40 (cxx:quit (qt:app))
' 41 (invoke-restart (find-restart 'continue)))
' 42 :report-function
' 43 #'(lambda (stream)
' 44 (format stream "Return from the application event loop."))
' 45 :test-function
' 46 #'(lambda (condition)
' 47 (declare (ignore condition))
' 48 (and (qt:app-p)
' 49 (find-restart 'continue)))))
2009-07-03 tobias 50 (let ((qt:*exec-p* nil))
10:14:09 ' 51 (cxx:exec (qt:app))))
2009-07-01 tobias 52 (when (typep (qt:app) 'qt:application)
10:58:06 ' 53 (setf *widgets* (qt:application.top-level-widgets)))))