Use new qt:with-app.
src/i18n-hello-world.lisp
Wed Jul 1 13:01:24 CEST 2009 Tobias Rautenkranz <tobias@rautenkranz.ch>
* Use new qt:with-app.
--- old-qt.examples/src/i18n-hello-world.lisp 2014-10-01 09:50:50.000000000 +0200
+++ new-qt.examples/src/i18n-hello-world.lisp 2014-10-01 09:50:50.000000000 +0200
@@ -5,26 +5,35 @@
(defun i18n-hello-world ()
"i18n hello world"
- (qt:with-app
- ;; ensures that the message catalogs are found regardless
- ;; of the current directory.
- (let ((source-path
- #+mudballs (directory-namestring
- (mb.sysdef:input-file
- (mb.sysdef:find-component :qt.examples "src"
- "i18n-hello-world")))
- #-mudballs *default-pathname-defaults*))
- (qt:with-translator ("hello-world"
- *default-pathname-defaults*
- source-path)
- (let ((widget (make-instance 'qt:label)))
- (setf (cxx:window-title widget) (qt:tr "Lisp Qt Example" "hello-world")
- (cxx:text widget) (format nil (qt:tr "<h1>Hello world</h1>
+ (qt:with-app ()
+ ;; ensures that the message catalogs are found regardless
+ ;; of the current directory.
+ (let ((source-path
+ #+mudballs (directory-namestring
+ (mb.sysdef:input-file
+ (mb.sysdef:find-component :qt.examples "src"
+ "i18n-hello-world")))
+ #-mudballs *default-pathname-defaults*))
+ (qt:with-translator ("hello-world"
+ *default-pathname-defaults*
+ source-path)
+ (let ((widget (make-instance 'qt:label)))
+ (setf (cxx:window-title widget) (qt:tr "Lisp Qt Example" "hello-world")
+ (cxx:text widget) (format nil (qt:tr "<h1>Hello world</h1>
You are running ~A version ~A on a ~A ~A")
- (lisp-implementation-type)
- (lisp-implementation-version)
- (software-type)
- (software-version)))
- (cxx:show widget)
- (qt:exec widget))))))
+ (lisp-implementation-type)
+ (lisp-implementation-version)
+ (software-type)
+ (software-version)))
+ (cxx:show widget)
+ (qt:exec))))))
+
+;; FIXME:
+;; calling #'software-version from the qt:application event loop
+;; segfaults in SBCL. The first call caches the result in
+;; sb-sys::*software-version* and we thus prevent the crash in
+;; (run-program "/bin/uname" [...]).
+#+sbcl
+(eval-when (:load-toplevel)
+ (software-version))