If I develop a program for QTopia, what ways are there to run it on other machines than the Zaurus (i.e. on a Linux or Windows PC)?

Alternative would be to develop for X instead of QTopia, but I guess I'll have some problems on the Zaurus then.Development of X/QT seems to have stalled in early 2004, so problems may occur at least if a new QT version is used.

I need to develop programs which are usable on as many systems as possible. If possible, I'd like to avoid development in Java.

Over the course of PortaBase development, I ended up writing a fair amount of code for abstracting away platform differences like this. Early last year, I broke out most of this code into a separate library which I planned to refactor PortaBase to use and also utilize for a couple of other applications I wanted to write, but got distracted by other things before I could finish it up. A couple of months ago, I did write one application using this library, so it's been partially tested. If you're interested, I could send you a copy in its current form and try to use the opportunity to motivate myself to start working on this and PortaBase again.

The library consists of a core framework plus a collection of optional components; you add or remove the ones you want from the qmake file, it works out the internal dependencies, and you build a static library that gets compiled into your application (so users don't need to separately install the library, and different apps using different library versions/options don't clash). Off the top of my head, some of the things included are:

- Some Qt 2.x/Qt 3.x API difference abstractions- QApplication/QPEApplication abstraction- Menubar and toolbar handling- MIME type and file extension handling- New and open file dialogs/widgets (using the appropriate implementation on each platform)- Document file management- Calendar dialog for date selection- Help viewer (desktop only, native help system used on Qtopia)- Implementations of widgets missing in the Zaurus version of Qt (QColorDialog, QInputDialog, etc.)- Main window and dialog sizing (typically maximized on Qtopia, not elsewhere)- OK/Cancel buttons added to dialogs for desktop versions, omitted on Qtopia (since they're in the titlebar)- PalmOS-style "grow-by-a-line-when-I-hit-return" text input fields- List/tree widget with alternating row color shading- Other stuff I can't remember at the moment (don't have the code in front of me)

The basic goals are to make it really easy to include functionality that almost every application has, encourage an interface style that's fully functional on the Zaurus, and make it easy to compile native-feeling desktop OS versions without the need for platform-specific ifdefs scattered throughout the application code. I also want to write some documentation on the steps needed to package an application for each platform (ipk files, OS X bundles, Windows installers, deb/rpm files, appropriate icon sizes and formats, etc.), and maybe eventually write some scripts to automate the process somewhat.

I eventually want to post this as its own Sourceforge project, but I'd like to clean it up somewhat and do a little more testing first. If one or two people want to look at it now though, I can just email it to them in its current state; the code is actually pretty clean and well-documented, just not fully packaged and tested (on all platforms) yet. I'm also curious just how much interest there is in this, and what kinds of things other people would find useful in this library. If people are interested in using it, I'll try to get an initial release tidied up and posted soon; shouldn't take as much work as a new PortaBase release (which is long overdue), and would help kickstart me back into working on that also.

Do you have a development environment on the Zaurus itself, or do you develop on a PC and cross-compile?

My wish would be to have a complete development environment on the Zaurus and one on the PC so I can just swap cards and work on the machine I want to. I have only developed on a DOS PC / Palmtop so far, so I don't have ehough experience to know what I need for such a dual syste (I even don't know what I need for a system only on one of of the machines <g>). So it would be even greater if you could give me some advice what I'll have to install additionally to your library in order to be able to develop software.

Is it possible to develop in pure C or do I have to learn C++ if I use your library?

Also, is there a good tutorial for this special kind of software development? I feel I know way too little about makefiles, make, qmake and of course QT and QTopia and its differences to other GUI systems. Can you recommend a good source?

I really like to be able to do anything on a portable device as the Zaurus (or my current palmtop, a HP 200LX). But I have learned over the last 8 years I used the 200LX, that I can only use it to full effectivity if I can develop my own software, or better, if I can modify existing programs so they fit my needs.

I keep having to re-invent the wheel ( or even QFileDialog!) and it would be good to have a common library somewhere that fills the QT -> QTE -> QPE gaps and makes development across the different platforms more uniform.

If you can post it somewhere, I will happily send you any amendments or additions I make for consideration of inclusion in the project or to use however you wish.

Qt is cross platform. It is possible to develop apps that run on Linux x11, Qtopia, Windows and Mac. Although there are a few differences of implementation, mostly can use the same code.

Is it possible to use QT with Java programs?

(Sorry, my questions may sound naive. But before I dive deeper into the stuff I'd like to choose the best option in order not to waste any time for learning something that's not useful to me. And when you say QT is relatively platform independent, and Java is said to be that, too, it may be best to combine both.)

I posted the current code for my utility library here. My working name for it is qqutil (short for "Qt/Qtopia utilities"), and I'm using a "QQ" prefix for all the class names since it seems unlikely to clash with anything. I'll try to get back to work on this over the next few days, so if anybody finds any bugs or suggestions for improvement, please let me know.

Oh, and for clarification: it's not that it's particularly hard to get a program working across Qtopia and the desktop Qt versions. In fact, it's easier than just about any other way to try and get the same code to work on both a PDA and a desktop OS. This is virtually impossible with PalmOS, and pretty hard just across PocketPC and Windows (and code written for that particular combination won't run anywhere else). And the Java versions available for PDAs are so stripped down (and limited performance-wise) that it's tough to get anything substantial running on them. One of the main reasons I bought a Zaurus is because it's relatively easy to write code that runs on the PDA and multiple desktop OSes.

That said, there's still room for improvement. The scope of Qt doesn't include packaging, which is substantially different for each platform; utilities and documentation to make this easier could be quite useful. Some classes present in desktop Qt were omitted from Qt/Embedded on the Zaurus due to space considerations; programs meant to work across both platforms need to either avoid these or provide their own implementation for the Zaurus version. Qtopia uses a custom file management system designed to be more appropriate for a PDA, which means file management is a little different there than in desktop applications. Sharp wasn't quite happy with Qtopia's implementation of this and extended it with custom code of their own, which again needs to be handled a little differently. And finally, the Zaurus uses Qt 2, while desktop applications are typically written with Qt 3 (and soon Qt 4); unless you use Qt 2 for the desktop versions of your application (which foregoes many bugfixes and precludes an OS X version), some work needs to be done to cope with the API differences. Writing applications for future versions of Qtopia based on Qt 4 should be much easier, but for now this is something of an issue.

Hence, an application designed to run on all of these platforms ends up being necessarily cluttered with a moderate number of ifdefs in order to handle these special cases. It also requires a fair amount of knowledge of all these differences and how to work around them. It's a lot easier than writing and maintaining different versions of the code for each platform, but it's not ideal. So my goal with the qqutil library was to abstract away the most common problem cases by putting the ifdefs in a utility library, allowing applications to just use a single unified API as much as possible. Furthermore, I wrote a number of custom widgets for PortaBase that seemed particularly useful for a variety of applications (especially for ones running on a PDA with somewhat limited input capability and screen real estate), so I included those as well. It's all based on my experience with PortaBase, so it probably makes some assumptions that don't necessarily hold for all other applications; but it certainly seems like it'll save me from duplicating a lot of code for other applications I want to write.

To answer some of Daniel's questions: you have to use C++ for this, but C++ using Qt is much easier than without (from my perspective, it's really only worth coding in C++ if the Qt library is available). I've considered setting up a development environment on my Zaurus (and I know other people have had some success with this), but ultimately haven't done so; it's just a lot faster to work with a full-size keyboard and a faster processor. Some instructions on getting started with cross-compiling for the Zaurus are here; some of the information in the INSTALL file from PortaBase's source code tarball may prove useful for setting up development environments on other platforms also.

Anyway, time for me to start reading through the Qt 4 documentation in more detail so I can try to update qqutil to cope with that as well. Some of the new features look really nice, but they won't work in Qt 2 on the Zaurus, and I need to figure out how to deal with the changes in the container classes and list/tree widgets...

Thanks a lot for that detailed information!I think this is a good way to go! And as I'm familiar with C, C++ should not be a too big issue for me.However, the link you posted for a cross compiler setup describes a setup for Linux. Although I have a linux machine, I think I won't develop on that one, but I'd rather be able to develop under Windows XP. Do you know if this is possible (i.e. if there is an appropriate cross-compiler)? Or is there even an example setup somewhere?

I'll definitely look at your code, but please don't expect any useful feedback within the next few weeks. I first have to learn some C++, then find the time to begin to write the applications I use. And since job and family need most of my time, this can take a long time. ;-)

Qtopia is primarily geared for development on Linux (and I think there's a pretty good cross-compiler setup available for Mac OS X also), but it looks like development on Windows should be possible. There's some instructions on how to set up a cross-compilation environment under Cygwin on Windows here. One or two of the installation steps apparently require some preparation done on a Linux box, but that shouldn't be a problem since you said you have access to one. The page also mentions Metrowerks Codewarrior for Zaurus, but that no longer seems to be available.