[Ecls-list] Small ECL Qt GUI demo in 111 lines

Goffioul Michael goffioul at imec.be
Thu Dec 1 09:03:00 UTC 2005


> Hi,
> 
> I've heard about ECL only a few weeks ago, and I really like it.
> 
> When I saw the Windows example from Michael Goffioul, I 
> wondered if something similar would be possible with the 
> (GPL'd) Qt cross platfrom GUI toolkit, which I already know.
> Since I was able to build a small example, I would like to 
> share this first try with anybody interested.
> I've made it available here (temporarily):
> 
> http://myteam-software.info/tmp/ECL-Qt.zip
> 
> It is only a very small example, but hey, it works! (Tested 
> on Linux and Windows.)
> 
> Look at the screenshot:
> 
> http://myteam-software.info/tmp/ECL-Qt.png
> 
> Paul

That's funny, because I'm currently working on something pretty
similar... :-)
However, I used another approach to avoid having to provide a C
interface to
the Qt library. I tried like you first, then switched to another
approach.

Now, I'm using the Smoke interface from KDE (kdebindings package, with
some
hacks to make it work with Qt4 under Windows). Smoke is a framework
(automatically
generated from Qt sources) that allows to access and look for classes
and methods
by name. It also provides a framework to overload C++ methods.

I already built a low-level interface that allows me to write a small
"Hello"
example like:

(let ((app #q(Qapplication.new 0 nil))
      (lab #q(Qlabel.new "Hello" nil)))
  #q(lab->show)
  (prog1
    #q(app->exec)
    #q(app->delete)))

Now, I'm extending this low-level interface to provide a CLOS interface
to Qt,
such that in the end, you could write classes in LISP that inherits from
Qt classes
and overload some virtual methods. Currently, the above example rewrites
as:

(let ((app (qt::qt_new_Qapplication 0 nil))
      (lab (qt::qt_new_Qlabel "Hello" nil)))
  (qt::qt_show lab)
  (prog1
    (qt::qt_exec app)
    (qt::qt_delete app)))

In this case, "app" and "lab" are really CLOS objects, acting as
wrappers
around C++ objects.

I'm sure we could help each other, or even work on the same
mini-project:
providing Qt4 bindings to ECL, couldn't we?

Michael.




More information about the ecl-devel mailing list