repos
/
qt.gui
/ annotate_shade
summary
|
shortlog
|
log
|
tree
|
commit
|
commitdiff
|
headdiff
|
annotate
|
headblob
|
headfilediff
|
filehistory
normal
|
plain
|
shade
|
zebra
Split up in qt.gui & cleanup name prefix.
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-10 tobias
5
(defmethod delete-app :around ((application qt:application))
08:52:49 '
6
(qt:application.close-all-windows)
'
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-10 tobias
30
`(cl-smoke.qt.core::with-application ((cl-smoke.qt.core::ensure-app 'qt:application)
08:52:49 '
31
(cl-smoke.qt.core::kill-app))
'
32
`(with-application ((cl-smoke.qt.gui::ensure-app 'qt:application) (kill-app))
2009-07-01 tobias
33
,@body))
2009-04-05 tobias
34
2010-01-10 tobias
35
`(with-application ((cl-smoke.qt.gui::ensure-app 'qt:core-application) (kill-app))
2009-07-01 tobias
36
(defun qt:exec ()
10:58:06 '
37
"Executes APP. When QT:*EXEC-P* is false it returns immediately
'
38
and transfers the ownership of the top-level widgets to the qt:application
'
39
instance."
'
40
(if qt:*exec-p*
'
41
(restart-bind ((qt::abort-app #'(lambda ()
'
42
(cxx:quit (qt:app))
'
43
(invoke-restart (find-restart 'continue)))
'
44
:report-function
'
45
#'(lambda (stream)
'
46
(format stream "Return from the application event loop."))
'
47
:test-function
'
48
#'(lambda (condition)
'
49
(declare (ignore condition))
'
50
(and (qt:app-p)
'
51
(find-restart 'continue)))))
2009-07-03 tobias
52
(let ((qt:*exec-p* nil))
10:14:09 '
53
(cxx:exec (qt:app))))
2009-07-01 tobias
54
(when (typep (qt:app) 'qt:application)
10:58:06 '
55
(setf *widgets* (qt:application.top-level-widgets)))))