Greg Bennett gwbennett@sentex.ca writes:
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")))
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"))