Posts Tagged ‘Qt’

AppMenu is here

Qt 4.8 was released last week. The announcement lists Lighthouse integration (aka. QPA) and some optimizations, but nobody mentioned my most-wanted feature yet: Aurelien Gateau’s patch that enables exporting the application menus. On a laptop, especially one of those wide-screen ones like mine, vertical space is very important, so removing one toolbar while keeping all of its actions easily accessible is a killer feature. Ubuntu users had this for some time, but now it has made it way to other distributions as well.

Currently, there are two things you can do with the menu once you rip it out of the application: put it in a plasma panel, or embed it the window decoration. Arch users can get both of them from the AUR. Because I still like the menu to be visually connected to the application, I am now using the second option, with the Oxygen-appmenu window decorations.

Application menus embedded in the window decoration

Currently, this only works for Qt applications. The equivalent patch to Gtk is still included only in Ubuntu and would require recompiling Gtk, something I am not fond of doing. In any case, I have found that at least on the laptop the only non-Qt app I use is Firefox, which includes a similar button as its menu. It doesn’t look as well, but it does the job and keep things consistent. An extension for LibreOffice is avaliable in the AUR as well, but the only text processor I need is Kile.


CGT finally works on Windows

So after some work, some more frustration and even more complaining, the thing actually builds, links and runs without crashing.

CGT on Windows

After reading many times the famous Qt tagline “Code once, deploy everywhere”, I expected that porting CGT to Window would be quick and painless.

It wasn’t. There were a great number of issue to make it even compile, and then some for running and installing. But I admit at least some of them were my fault:

  • CGT_EXPORT macros in public classes in libraries are not needed on Linux, but reqiured on Windows and present in virtually all libraries I looked into. Only my laziness is at fault here.
  • passing an integer to ceil() works on Linux, but not in Windows. I had to change ceil(something) to ceil(1.0 * something) globally.
  • getting application data path (AppData) is different, as there’s no cross-platform method for that in Qt.
  • Qt is comiled with “Treat WChar_t as built-in type” set to “No”, unlike the Visual Studio default. So I had to change that, and it’s not the easiest thing to find in the maze mess of configuration menus.
  • CMake targets for libraries had to be fixed to separate dll’s and lib’s.
  • cmake && make install doesn’t have permission to install into Program Files, so I had to use CPack to build an installer. That’s actually a good thing that had to be done anyway, but it’s another hurdle. It also doesn’t work right now, and I don’t know why.
  • For some reason, Qt binaries install to a location outside of PATH, so they’re not found when I try to start the program (but are found by CMake for linking).
  • You can’t link to libraries built with Visual Studio 2008 from an application built with VS 2010. And heaven forbid that told that to me, the lowly developer. No, all they told me is: The application was unable to start correctly. Go figure. It might be me (the lowly developer again, spoiled by Qt/KDE/Linux), but I haven’t the slightest clue why would the same code, only compiled with a different version of the same compiler be binary incompatible. Why can’t the .lib file, the public interface to the .dll object, be compatible?
  • I had to put up with using Windows (but that’s a subject for another post).

I suppose I could compile Qt with VS2010, and then it would work (maybe), but how’s tht for deployability? I’d like to offer this program to other people without shipping the whole 200MB of Qt libs in the package. Does it really have to be that complicated to write software?

Animations in KChess and CGT

Qt 4.6 release brought many improvements, most notably the Animation Framework. Though it works for any QObject and any property, I’ve only implemented it for graphics items and their position. The API is very simple: all I had to do was replace calls such as:


to this:

QPropertyAnimation* animation = new QPropertyAnimation(item, "pos");

Now, opponent’s moves in KChess and moving or reordering cards in CGTable feels smoother and much more natural.