initial import
examples
Sun Apr 5 19:56:16 CEST 2009 Tobias Rautenkranz <tobias@rautenkranz.ch>
* initial import
diff -rN -u old-qt.core/examples/hello-world.lisp new-qt.core/examples/hello-world.lisp
--- old-qt.core/examples/hello-world.lisp 1970-01-01 01:00:00.000000000 +0100
+++ new-qt.core/examples/hello-world.lisp 2014-11-11 13:36:26.000000000 +0100
@@ -0,0 +1,63 @@
+(in-package :qt-examples)
+(declaim (optimize (debug 3)))
+
+(defun hello-world ()
+ "Hello world"
+ (qt:with-app
+ (let ((widget (make-instance 'qt:push-button :args '("Hello world"))))
+ (cxx:show widget)
+ (qt:exec))))
+
+
+(defun hello-world-quit ()
+ "Quit on push-button click"
+ (qt:with-app
+ (let ((quit (make-instance 'qt:push-button :args '("Quit"))))
+ (cxx:resize quit 75 30)
+ (cxx:set-font quit (make-instance 'qt:font :args (list "Times"
+ 18
+ qt:font.+bold+)))
+
+ (qt:object.connect quit (qt:qsignal "clicked()")
+ (qt:app) (qt:qslot "quit()"))
+ (cxx:show quit)
+ (qt:exec))))
+
+(defun hello-world-gc ()
+ "GC on push-button click"
+ (qt:with-app
+ (let ((gc (make-instance 'qt:widget)))
+ (let ((layout (make-instance 'qt:vbox-layout))
+ (button (make-instance 'qt:push-button :args '("GC"))))
+ (trivial-garbage:gc :full t)
+ (cxx:add-widget layout button)
+ (trivial-garbage:gc :full t)
+ (cxx:set-layout gc layout)
+ (trivial-garbage:gc :full t)
+ (qt:connect-function button "clicked()"
+ #'(lambda ()
+ (format t "GC-ing~%")
+ (trivial-garbage:gc :full t))))
+ (trivial-garbage:gc :full t)
+ (cxx:show gc)
+ (trivial-garbage:gc :full t)
+ (qt:exec))))
+
+;; You need to run cmake & make to generate the .po and .qm files
+(defun i18n-hello-world ()
+ "i18n hello world"
+ (qt:with-app
+ (qt:with-translator "hello-world"
+ (let ((widget (make-instance 'qt:label)))
+ (setf (qt:property widget 'window-title)
+ (qt:tr "Lisp Qt Example" "hello-world"))
+ (cxx:set-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)))))
diff -rN -u old-qt.core/examples/package.lisp new-qt.core/examples/package.lisp
--- old-qt.core/examples/package.lisp 1970-01-01 01:00:00.000000000 +0100
+++ new-qt.core/examples/package.lisp 2014-11-11 13:36:26.000000000 +0100
@@ -0,0 +1,15 @@
+(defpackage #:qt-examples
+ (:use #:cl)
+ (:export #:hello-world
+ #:i18n-hello-world
+ #:hello-world-quit
+ #:hello-world-gc
+
+ #:class-browser
+
+ #:tick-tack-toe
+ #:repl
+
+ #:launcher
+
+ #:load-ui-file))