repos
/
qt.core
/ annotate_shade
summary
|
shortlog
|
log
|
tree
|
commit
|
commitdiff
|
headdiff
|
annotate
|
filehistory
normal
|
plain
|
shade
|
zebra
initial import
Annotate for file examples/hello-world.lisp
2009-04-05 tobias
1
(in-package :qt-examples)
17:56:16 '
2
(declaim (optimize (debug 3)))
'
3
'
4
(defun hello-world ()
'
5
"Hello world"
'
6
(qt:with-app
'
7
(let ((widget (make-instance 'qt:push-button :args '("Hello world"))))
'
8
(cxx:show widget)
'
9
(qt:exec))))
2010-01-10 tobias
10
2009-04-05 tobias
11
17:56:16 '
12
(defun hello-world-quit ()
'
13
"Quit on push-button click"
'
14
(qt:with-app
'
15
(let ((quit (make-instance 'qt:push-button :args '("Quit"))))
'
16
(cxx:resize quit 75 30)
'
17
(cxx:set-font quit (make-instance 'qt:font :args (list "Times"
'
18
18
'
19
qt:font.+bold+)))
'
20
'
21
(qt:object.connect quit (qt:qsignal "clicked()")
'
22
(qt:app) (qt:qslot "quit()"))
'
23
(cxx:show quit)
'
24
(qt:exec))))
'
25
'
26
(defun hello-world-gc ()
'
27
"GC on push-button click"
'
28
(qt:with-app
'
29
(let ((gc (make-instance 'qt:widget)))
'
30
(let ((layout (make-instance 'qt:vbox-layout))
'
31
(button (make-instance 'qt:push-button :args '("GC"))))
'
32
(trivial-garbage:gc :full t)
'
33
(cxx:add-widget layout button)
'
34
(trivial-garbage:gc :full t)
'
35
(cxx:set-layout gc layout)
'
36
(trivial-garbage:gc :full t)
'
37
(qt:connect-function button "clicked()"
'
38
#'(lambda ()
'
39
(format t "GC-ing~%")
'
40
(trivial-garbage:gc :full t))))
'
41
(trivial-garbage:gc :full t)
'
42
(cxx:show gc)
'
43
(trivial-garbage:gc :full t)
'
44
(qt:exec))))
'
45
'
46
;; You need to run cmake & make to generate the .po and .qm files
'
47
(defun i18n-hello-world ()
'
48
"i18n hello world"
'
49
(qt:with-app
'
50
(qt:with-translator "hello-world"
'
51
(let ((widget (make-instance 'qt:label)))
'
52
(setf (qt:property widget 'window-title)
'
53
(qt:tr "Lisp Qt Example" "hello-world"))
'
54
(cxx:set-text widget
'
55
(format nil (qt:tr "<h1>Hello world</h1>
'
56
'
57
You are running ~A version ~A on a ~A ~A")
'
58
(lisp-implementation-type)
'
59
(lisp-implementation-version)
'
60
(software-type)
'
61
(software-version)))
'
62
(cxx:show widget)
'
63
(qt:exec)))))
'
64