Hello there, I have acquired common-qt and will try to work my way through translating the Qt tutorials. [These can be accessed from http://common-lisp.net/project/commonqt/ by running down to the Examples paragraph and right-clicking on the Qt tutorial link.]
tutorial1 has me puzzled already. Its objective is to create a push button holding dear old Hello World!
The C++ source code shows that its approach is to build the object out of sight, and them display it; the translation of tutorial14 (also reachable from common-qt's home page) kindly supplied by David Lichteblau and Stas Boukarev use clos as the logical improvement on c++ classes. I presume that a purpose of the set of tutorials is to make one familiar with this way of structuring code.
I am running ccl Version 1.9-r15975M (LinuxX8664) under Linux Mint 14 (64bit) on an HP box.
Having loaded commonqt, and issued the requisite (named-readtables:in-readtable :qt) I thought I would see whether I could create the button in the repl before dealing with the structuring. Some poking about in Qt's own documents [for Qt4.8, since that is the version recommended] led to
(with-main-window (window (#_new QPushButton "Hello World!")))
This does produce the desired button, with the letter "a" where a title would go. It's part of argv0dummy, it seems.
I notice, with some interest, that the Qt c++ code shows a result with "t1" as the window's title without any mention of t1 in the code itself.
More poking led me to the function setTitle associated with QWindow, which appears to take a QString as argument, and thus to (with-main-window (window (#_new QPushButton "Hello World!")) (#_setTitle window (#_new QString "t1")))
from which I received Error: Class not found: QString.
Back to the docs, and on the Qt side I would have needed #include <QString> before using one.
Then I realised that I don't know how to get access to such Qt-packages on the fly inside commonqt. Evidently there are some/many which do not come with (ql:quickload :qt).
Pointers to how to get access to QStrings, and how to learn about how to do so without having to ask the list would be appreciated. The joys of converting repl -> clos await me!
With thanks for your patience, Cheers /Greg Bennett
Greg Bennett gwbennett@sentex.ca writes:
I'm not sure where you found the class QWindow, and even if it existed, your window is a QPushButton, a subclass of QWidget. And QWidget has the windowTitle attribute. And commonqt performs automatic marshalling:
(with-main-window (window (#_new QPushButton "Hello World!")) (#_setWindowTitle window "Title"))
commonqt-devel@common-lisp.net