After two days in Chicago, Marius, Gunnar and I are heading to Houston for the first Road Show conference. We had a little sightseeing trip yesterday. Went to the Sears Tower, the Millenium Park and some other places.

And guess what? In the Millenium Park, I found Metal Slime King! I tried to knock him down with my Falcon Sabre using Metal Slash, but it didn’t work. Ah, well… 
It’s a beautiful saturday here in Røyken / Norway. About -5C, blue skies, and snow all over the place. Wear sunglassses! Feeling good; some week-old bruise around my spinal tap from snowboarding last week-end is still annoying me a little, but that’s just part of the charm ;-).
Tomorrow I’ll be on a plane across the Pond, preparing for the Qt Developer Road Show, with events in Houston and Boston. If I’m lucky, I’ll get a chance to visit my childhood home, which is just 30 minutes outside of downtown Houston. Checked it out on Google Earth just to make sure the house is still there! My school seems to be gone, though. Tough luck ;-).
Marius B M and I will be flying over to Chicago tomorrow, and hopefully the hotel’s facilities will be good enough for us to get some quality time for development. During the Road Show we’ll be holding presentations about threaded programming and the model-view architecture. Looking forward to a nice couple of weeks abroad!
I’ve been playing with QProcess quite a bit lately, which is a wonderful class. However, I noticed that I cannot start an interactive process with it (i.e. a process that gets stdin from the terminal). This is because QProcess redirects stdin for all processes it starts back to the parent process, so that the programmer can send data to the process using write(). Thing is, I don’t want this. So, after talking a bit with Andreas (who wrote QProcess), we came up with the following trick:
class InteractiveProcess : public QProcess
{
static int stdinClone;
public:
InteractiveProcess(QObject *parent = 0)
: QProcess(parent)
{
if (stdinClone == -1)
stdinClone = ::dup(fileno(stdin));
}
protected:
void setupChildProcess()
{
::dup2(stdinClone, fileno(stdin));
}
};
int InteractiveProcess::stdinClone = -1;
Basically, we clone stdin in the parent process, and in the child (which calls our QProcess::setupChidProcess() reimplementation), we redirect stdin to the clone created by the parent.
Pretty neat, isn’t it?
One of the coolest things about Qt Embedded 4, Qtopia Core 4, is that it has support for keyboard, mouse and screen plugins. Which means easier implementation and deployment of embedded applications across different devices.
Mousedriver is usually the touchscreen, and screendriver can be an accelerated framebuffer.
Not only that, but Trolltech seperated some of the embedded gui source code. This allows for easier patching/bug fixing. Look in src/gui/embedded/ The plugins live in src/plugins/gfxdriver/ src/plugins/inputmethods/ and src/plugins/mousedrivers/. You will also see other plugins available such as decorations, styles.
In the upcoming Qtopia 4 editions, we have used this concept a bit, in the build system, to allow easier addition of device specifics and even whole source trees. More on this later.

I am pleased to announce that we have sent the final manuscript of the Qt 4 book to the publisher last week. C++ GUI Programming with Qt 4 (ISBN 0131872494), by Mark Summerfield and myself, is an update of the official Trolltech Qt 3 book and is based on Qt 4.1. It features three new chapters and a new appendix:
- Item View Classes
- Creating Plugins
- Embedded Programming
- Introduction to C++ for Java and C# Programmers
The book features some cool troll drawings, including one on the (draft) cover. It is already possible to order the book from Amazon.
From the preface:
Readers of the Qt 3 edition of this book will find this new edition familiar in both content and style. This edition has been updated to take advantage of Qt 4’s new features (including some that were introduced with Qt 4.1) and to present code that shows good idiomatic Qt 4 programming techniques. In many cases, we have used similar examples to the ones used in the Qt 3 edition. This will not affect new readers, but will help those who read the previous edition orient themselves to Qt 4’s cleaner, clearer, and more expressive style.
[…] Just like the Qt 3 book, the emphasis is on explaining Qt programming rather than simply rehashing or summarizing Qt’s extensive online documentation.