By Developers, For Developers

Historical errata for Rapid GUI Development with QtRuby

PDF PgPaper PgTypeDescriptionFixed onComments
42TYPO

The font used in the table at the bottom of this page renders atrociously in Acrobat Reader v7.0 on Windows XP.
(I’m looking at the last page of the sample content here - haven’t bought the whole thing).

(We’ve changed the font to fix this)

2005-10-11
71SUGGEST

I found it surprising that in a section on “Taking Advantage of Ruby”, you would use the somewhat cryptic

widget.mouse? and puts “Mouse is over widget”

instead of the cleaner

puts “Mouse is over widget” if widget.mouse?

Minor distinction, but I think the version with the statement modifier is nicer…

2005-10-14
6TYPO

second paragraph from top:

A non-GPL [commercial] options exists, allowing customers to purchase a license from Trolltech so that software written using the toolkit can [be] licensed by the author.

2005-10-10
16OK

first I tried to use QT3 from fink, not a succes. Then I installed QT3.3.6 on my Dual 2.3 PowerPC G5 running OS X (10.4.2) This seems to be OK.

following the QTRuby from page 15 and 16 crased after
>perl generate.pl
>qmake -makefile
>make

this i where it stops:

x_7.cpp:1360: error: invalid conversion from ‘void*’ to ‘unsigned int’
make: * [x_7.o] Error 1

So my question is, do you have any ideer why the instalation fails even though I follow the instruction exaly???

(Caleb says: This is a bug in the QtRuby sources, and will be fixed in the next release. In the meantime, you can edit the source file and change the offending line from “= xret” to "= 0)

2005-10-11
15SUGGEST

Using Linux. If I download the installation files from the web site you proposed “http://rubyforge.org/projects/korundum”, I first have to call “make -f Makefile.cvs” before the “configure” program is available.

(Caleb says: thanks, I added this as a sidebar)

2005-10-10
8ERROR

On the mac (at least) compiling Qt requires ./configure -thread
otherwise Qt is not detected properly by the qtruby configure script.
The default configure does not include thread support.

(Caleb says: new sidebar added on -thread switch on OSX)

2005-10-10
2ERROR

Link for RubyCocoa is broken (“http://rubycoca.sourceforge.net” -> “http://rubycocoa.sourceforge.net”)

2005-10-10
36TYPO

In the sidebar, plurality mismatch:

s/and other don’t/and others don’t/

2005-10-10
yesOK

Viewing this book with kpdf the fonts are really bad almost unreadable this should be fixed asap.

(Dave says: this seems to be a problem with kpdf. The rendering does look bad, but looks fine with Preview on the Mac and all acrobat readers 6 and 7. You might want to file a bug report with the kpdf team.)

2005-10-11
16TYPO

On page 16, the lines marked with * below are supposed to be in maroon, instead they are printed in blue. (Also, it is odd that when copy & pasting from Mac OS X “Preview.app”, all the whitespace between words seems to disappear.)

Wealsobuildtherestofthepackage,againusingthestepshigh-
lightedintheINSTALLfile.
~/qtruby/smoke/qt>cd../..
~/qtruby>cdqtruby/rubylib/qtruby
~/qtruby/qtruby/rubylib/qtruby>rubyextconf.rb\\
—with-qt-dir=/Developer/qt—with-smoke-dir=/usr\\
—with-smoke-include=../../../smoke
~/qtruby/qtruby/rubylib/qtruby>make
…
~/qtruby/qtruby/rubylib/qtruby>sudomakeinstall
…
~/qtruby/qtruby/rubylib/qtruby>cd../../..
~/qtruby>cdqtruby/rubylib/designer/rbuic
~/qtruby/qtruby/rubylib/designer/rbuic>qmake-makefile
~/qtruby/qtruby/rubylib/designer/rbuic>make
…
~/qtruby/qtruby/rubylib/designer/rbuic>sudomakeinstall
…
~/qtruby/qtruby/rubylib/designer/rbuic>cd../uilib
~/qtruby/qtruby/rubylib/designer/uilib>rubyextconf.rb\\
—with-qt-ruby-include=/../../qtruby\\
—with-qt-dir=/Developer/qt *
~/qtruby/qtruby/rubylib/designer/uilib>make
…
~/qtruby/qtruby/rubylib/designer/uilib>sudomakeinstall

2005-10-14
20TYPO

The C example code contains a typo.
app.setMainWidget(&hello);
should be
app.setMainWidget(&label);
since there is no variable named hello.

2006-01-23
8SUGGEST

Please explicitely state which version of Qt you have compiled in the example. I have problems with the QtRuby (1.0.10) configure script when using Qt-Mac-opensource-4.0.0. There is no longer a “thread” configure option (which another user pointed out was necessary), and the QtRuby configure failed with a “headers and libraries not found”.

I use an iBook [PowerPC G4 (3.3)] with 10.4.2 (Tiger).

Qt-3.3.4 is not supported in Tiger. Are you using Qt 3.3.5?

2006-01-23
15SUGGEST

I had a problem configuring QtRuby 1.0.10 using the default gcc (version 4.0) with Mac OS X (10.4.2). The configure script said that the version of the compiler is blacklisted! Switching to gcc 3.3 helped this particular problem. Did you have any problems with the gcc? Which version did you use?

Fix:
$ sudo gcc_select 3.3

(Dave says: should be fixed in 1.0.11)

2006-01-23
16ERROR

when compiling smoke, make smoke, after some considerable time I get…

x_20.cpp:10212: error: `MV_10_DOT_4’ is not a member of type `Qt’
x_20.cpp: In static member function `static void x_Qt::x_495(Smoke::StackItem*)
‘:
x_20.cpp:10227: error: `MV_TIGER’ is not a member of type `Qt’
make: * [x_20.o] Error 1
mac-mini:~/ruby1.8.2/packages/qtruby-1.0.10/smoke/qt rossajmcd$ sudo make install
Password:
make: Nothing to be done for `install’.

thanks for your help!

8-16SUGGEST

It took me a long time to get QT and QTruby working together on OS X. I put all the steps into a script file. If you could test this on an OS X machine, that’d be great. I think your readers who use OS X would really appreciate an easy way to install QTRuby and my script provides that. More information is here: http://www.cs.utexas.edu/~reubgr/pmwiki/index.cgi/Main/QTRuby

(Dave says: Caleb has linked this from his blog)

2006-01-23
26TYPO

Missing word: “of” in the following sentence: Through the heavily used base class Qt::Object, Qt provides a valu-able set [of] introspection methods that can be used to query information about objects and their families.

2006-01-23
30TYPO

Missing word: “of”
In sidebar, sentence should read: Qt::Application has a number [of] global application properties that may be of interest.

2006-01-23
30TYPO

Improper article: “a” … should be “an” in the following sentence because the following word begins with a vowel: "It handles most of the underlying details that make up a GUI application—things like maintaining a common look and feel amongst widgets, managing [an] interprogram clipboard, mouse cursor settings, and internationalization of user visible text.

2006-01-23
45TYPO

“on the next pagewe” should be “on the next page we”

2006-02-28
57TYPO

“connecting the signal to one if its slots” should be “connecting the signal to one of its slots”

2006-02-28
2TYPO

section 1.2 ‘our assumptions’

‘..pick up a copy of of Programming Ruby..’
——-

2006-02-28
77TYPO

grammatical error.. last line

‘..QtRuby provides such this ability with..’

strike ‘such’ ?

2006-02-28
85TYPO

grammatical error..

‘..It can also changes its registration..’

2006-02-28
27TYPO

There seems to be some confusion with RubyQt vs QtRuby - but my impression is that it should be called QtRuby? However, page 27 starts with “The fundamental class i RubyQt is…”

2006-02-28
26TYPO

The note at the bottom of the page, “We recommend using Ruby’s object introspection methods over their QtRuby counterparts if possible, as they’re notably faster. For example, we benchmarked Ruby’s”, has the last line in the dark colored footer and is essentially unreadablee.

2006-05-05
43TYPO

More of a layout issue. The text on the left at the bottom of the page runs into the footer.

2006-05-05
62TYPO

Just a layout issue. The text at the bottom left of this page is also running into the footer. Great writing style. Enjoyed picking up some tips and information on QtRuby. Thanks!

2006-05-05
allSUGGEST

This is a great way to make my suggestions. But first I would like to point out that I really enjoyed going through this book. I’m so glad I was able to get an early download of it. I look forward to future versions of it and hope my suggestions can be of some use.

My suggestions are:

  • Adding System wide event handler example
  • More details and examples of the Strech, Spacing and SizePolicies.
  • I think that information on using QT::Table is an essential part of this book. I think this information would be a great (next :-)) addition to the book.
  • I’ve never used the IconView or Workspace and think more information (examples) would be wonderful additions to the book :-)
  • In the section on the kde class libraries, it would be great if you could have a list of them (or the most common ones) or a link to find this information right there for the interested reader. And of course more example application code is always appreciated :-)
  • In the section on Korundum, it seems like page 82 would be a great place for a link for more information, rather than waiting until the appendix.
  • The closing chapter could have a closing section. Great summary of information, but didn’t really feel like it gave the closure I was looking for (rb pun intended :-)).
  • The Web References could have the URL as plain text in addition to being a link, so the interested reader can quickly glance at the sites.

Once again I would like to thank you for your hard work on this book. It has inspired me to want to write books and articles — and I’ve been looking for that inspiration for a long time.

41TYPO

In File 10.

C syntax. “w1=QWidget.new" should be "w1=Qt::Widget.new ” (For all three instances).

Plus:
Missing @ (at w1) in “@sublayout.addWidget(w1)” and also for w2 in the next line.

2006-05-05
26SUGGEST

The comments on the margin next to 4.3 (We recommend using Ruby’s object introspection methods …) appears on the bottom of page 26, they are so low that the last line of the margin falls in the bottom border of page. Since the border is blue and the text is black it is very hard to read the last line of that comment. I suggest moving the comments to page 27.

2006-05-05
yesOK

I’m having difficulty reading the book, the tiny font means that I’m having to scroll the text around the page.
Having to do that really is a bit of a pain. I wonder if you could drop the gerbil #45 a nice dollop of love and persuade him that it’s really no trouble to create the pdf files of the books in bigger fonts and if necessary more pages.

PS The information in the book is actually readable and distinctly understandable. If you carry on producing books as good as this one you’ll get absolutely swamped with work. Take care now. Thanks, Christopher.

(Dave says: are you reading on a PDA, by any chance? We do have issues with reflowing PDFs: Adobe is remarkably stupid when it comes to interpreting whitespace)

2006-11-11
63ERROR

“The mousePressEvent( ) only gets invoked for presses in the empty
space of the MouseWidget, however. Notice that the MouseWidget
also contains a Qt::PushButton, but if that Qt::PushButton gets pressed,
it has its own internal handling of the mousePressEvent( ), and the
MouseWidget never sees a mousePressEvent( ).”

This isn’t completely true. A right-click is not handled by the button’s event handler and it does get passed through. The example might be clearer if you remove the test for Qt::RightButton since both left and right-clicks would bring up the message dialog in the empty space while only the right-click would do so on the button.

28ERROR

In this page, the author talks about the examples in page 27:

“Note that in the previous example, inherits( ) returns true for QObject but not Qt::Object. This can be a bit tricky. It happens because the This behavior should be fixed in future versions of QtRuby. inherits( ) method is integral to Qt within the QObject class, and as
such does not know about the ruby extension name of Qt::Object.”

As of KDE 3.5.2 (Korundum-20060208), this behavior has been modified and now Ruby behaves as it should be:
irb(main):001:0> require ‘Qt’
=> true
irb(main):002:0> app = Qt::Application.new(ARGV)
=> #
irb(main):003:0> w = Qt::Widget.new(nil)
=> #<Qt::Widget:0x2aaaaf5c5f58 name=“unnamed”, x=320, y=240, width=640, height=320>
irb(main):004:0> w.inherits(“Qt::Widget”)
=> true
irb(main):005:0> w.inherits(“QWidget”)
=> true
irb(main):006:0> w.inherits(“Qt::Object”)
=> true
irb(main):007:0> w.inherits(“QObject”)
=> true

I think the book should be updated.

2006-05-05
8TYPO

top line: manger s/b manager

2006-11-11
12TYPO

First bullet point: s/the the/the/

2006-11-11
20TYPO

The C tries to instantiate a QLabel object, so it should #include <qlabel.h> instead of <qpushbutton.h>.

2006-11-11
32TYPO

“The event loop waits for GUI events to happen and processes them accordingly.” — No ‘s’ after ‘happen’.

2006-11-11
33TYPO

Second bullet point of “Summary”: “all of its descendants” — plural

2006-11-11
37TYPO

“combine them into more complex widgets” — delete “create”

2006-11-11
47TYPO

Third line in marginal note: “using the” is missing a space character.

2006-11-11
14SUGGEST

This is not really a bug, but rather positive feedback:
The tip to look for the “kdebindings” package for installation alone is worth the 8.50 bucks for this “Friday”. Thanks muchly!

Suppose the idea of using the famous Qt GUI library with the Ruby scripting language crossed your mind. Alas, this happened to me yesterday.
Now, try googling for “ruby qt” (from Berlin, Germany) and check the results — quite poor; OK, the first hit directs you to a KDevelop page with huge amounts of text, but nothing really effective.
Then try the swapped “qt ruby” — a bit better; the second hit mentions “Ruby bindings” and the page refers to “QtRuby”.
Third attempt, “qtruby” /without/ the space — bingo!

Now imagine that you’ve never heard of this stuff and that you’re on OpenSUSE. Go over to YaST’s software selection and look for “qtruby” — zilch. The same result on rpmseek.
OK, over to the QtRuby project page, download the .tar.gz source drop, run “make -f Makefile.cvs; ./configure; make; sudo make install” and you’re done. When you’re finished playing around, even “sudo make uninstall” works smoothly and only leaves an empty /usr/local/include subdirectory behind. Unfortunately, I’m no longer happy with this “configure/make” mechanism and really prefer the system package management system.
Seeing that QtRuby’s “Hello World!” example works immediately, I check out Caleb Tennis’ small booklet from this site and plunge into the text. Moments later: Hurray on page 14!

Had I acquired “Rapid GUI development with QtRuby” before doing the ridiculously long list of intermediate steps above, and learned about the “kdebindings” package (in the case of OpenSUSE you want to install “kdebindings3-ruby”), it would have saved me a good amount of time.

To conclude: Someone /should/ try to give “ruby qt” a better Google ranking for “QtRuby” (or vice versa). And maybe the “kdebindings3-ruby” package for OpenSUSE /should/ react to the keyword “qtruby”.

Thanks again to Caleb Tennis for this nice booklet, which got be started so well (after a two-hour false start).

72TYPO

OpenGL Module: API for creating three-dimensional objects — should be hyphened.

2006-11-11
72TYPO

OpenGL, the 2nd: Shshust one line below: from within an application — two typos in a row!

2006-11-11
allSUGGEST

Greetings, I have a suggestion (I’m not a vip to request anything :)
), I recently bought yet another pragamtic book, the Rapid GUI
development with QtRuby friday guide, and I enjoy it enormously.

The suggestion is, that with the working-beta status of the Qt4-Ruby
extensions, and the many advantages of Qt4 over Qt3, it’d be nice to
produce a new edition of the book, with changes centered on the new
way of doing things in Qt4 and maybe an extra chapter with QtRuby ->
Qt4Ruby migration guidelines in it.

Personally I do not need the book right away, though I’d get it
eventually for the collection, but it’d be a good book for many people
and new buyers.

Thanks.
Lars Goldschlager.

73SUGGEST

Would love to see A LOT more info on using with designer. In particular how to add a custom Widget that was created with QtRuby and be able to add that to the designer as a custom widget.

22TYPO

“on page on page 19” second para page 22

27ERROR

Second paragraph reads: First, Qt::Object provides a className() method that returns the name
of the class. Ruby provides the same information via the class() call.

This is simply not true. className returns a String, while class returns a Class.

1SUGGEST

While the technical material covered seems accurate, and is helpful, I was sorely disappointed by the lack of practical examples. The code snippets did illustrate the points being made, but most of it was just snippets, rather than a self-contained script that could be run by itself.
More importantly, the building blocks were presented, with almost no information on how you build with them. It would have been great to see even a relatively simple app, like a regexp evaluator (something the local Perl group showed off in a meeting one day, not terribly complicated). Maybe a clock with reminders, something.
As it is, I think the best thing in terms of examples is the link at the end to Trolltech’s QtRuby tutorials.

4540TYPO

At “Sublayouts” section, you write this code:

layout = Qt::HBoxLayout.new sublayout = Qt::VBoxLayout.new
w1 = Qt::Widget.new w2 = Qt::Widget.new
w3 = Qt::Widget.new sublayout.addWidget(w1)
sublayout.addWidget(w2) layout.addLayout(sublayout) layout.addWidget(@w3)

I think that two lines are wrong, these lines:

sublayout.addWidget(w1) sublayout.addWidget(w2)

most be:

sublayout.addWidget(w1)
sublayout.addWidget(w2)

because you are defining w1, w2 and w3 like class attributes.
It can be supposed but in code is wrong.

Greetings.
Israel Buitrón

1SUGGEST

I think the book was helpful, but I’d really like to see an explanation of how to make a QtRuby executable. What’s the point of making a Gui app if it’s just a tool for my own use? If I’m the only one using it, I’ll know all of the available options and save myself time by running it as a command line tool.

Part of the appeal of Qt was its wide platform support. But if I can’t give a mac or pc user an executable to run without having to install Ruby and Qt on their system, why should I use QtRuby?

:(

Categories: