Taschenorakel.de

Postings tagged with Programming

Devhelp books in QtCreator

Had a few problems focusing on my work today, so I came up with this little hack: A script converting devhelp books into Qt help collections.

Searching GTK3 docs in QtCreator

Together with QtCreator's autotools plugin it should help turning QtCreator into a proper GNOME IDE.

Next steps: Let QtCreator index devhelp books automatically. Also on my wishlish: A code ...

Qt Contributors Summit is over

Really enjoyed the Qt Contributors Summit. Nice, open minded people. Café Moskau turned out as awesome location for technical orientated meetings.

Even held my own little session about my griefs with QObject life-cycle. We found some few chances for improvement, but we also sadly had to conclude that proper two-phase construction and destruction isn't possible in C++, unless you forbid stack allocation and ...

Writing QML-based input methods for Maliit

This week I pushed a simple QML-based virtual keyboard to our MeeGo Keyboard repository. It's functional, but don't expect too much. This functionality will most likely never arrive in MeeGo 1.2, sorry folks.

Getting Started

Let's continue with the good parts instead: The required C++ code was kept to an absolute minimum and in fact it's only needed to wrap the QML resources into a Qt/C++ plugin that can be loaded by our framework. If you want to write your own QML-based input method plugin for Maliit, then this is the required interface:

class MyQmlBasedInputMethodPlugin
    : public QObject, public MInputMethodQuickPlugin
{
...

Painting Strategy in MeeGo's Virtual Keyboard

I've never been happy with the conclusion in the influential blog post "Qt Graphics and Performance — The Cost of Convenience" by Gunnar Sletta: If you want performance, downgrade QGraphicsView to a mere canvas with a single QGraphicsItem. It defeats the whole purpose of decomposing the problem into many small QGraphicsItems and is therefore entirely counter-intuitive. One might be quick to ask what Qt Graphics View is good for (and one might find the answer here), but instead I would like to present an alternate solution to Gunnar's which reaches the same performance but embraces the ...

If generic programming beats OOP ...

I've read a bit about the history of the C++ STL over the weekend (go do it, it's quite interesting), mostly because I think I am slowly arriving at a stage where I can form my own opinion about generic programming. The thing that stuck with me was "STL, at least for me, represents the only way programming is possible." and the almost famous OOP rant: "I think that object orientedness is almost as much of a hoax as Artificial Intelligence. I have yet to see an interesting piece of code that comes from these OO people." (credit for this goes to Alexander Stepanov, the mastermind behind the STL).

Well ...

Using DBus as lock-daemon

Recently I found this comment in the source code I am working with:

// what if both processes read in the same time and write at the same time, no increment

Please! Don't do such things! Don't just leave such comments in hope someone else will come around and will fix later. Please take the time to apply a locking mechanism.

Obvious choice when dealing with files would be to create a lock file. Unfortunately creating a ...

GCC 4.5 - Awesome Release!

GCC 4.5 just was has been released yesterday. It's a really awesome release according to its summary of changes. My favorites:

About reinventing the wheel

Nice article: I Can't Wait for NoSQL to Die. Fits on many IT problems, not only SQL vs. NoSQL. Should be common knowledge, but apparently is not.

Bottom line: First of all do some research before throwing out the baby with the bath. And no: Jumping on the current hype won't magically cure your self made skill/knowledge/management/whatever problems.

Fragile API and invalid iterators

For the Miniature project I sometimes need to iterate over all graphics items in a QGraphicsScene, or more precisely, all items of a specific parent item, the chess board itself. For that, I use the QGraphicsItem::childItems() API. However, when used with STL-style iterators you have to be careful, since value types of that form can easily break the iterator idiom:

for (QList<QGraphicsItem *>::iterator iter = parent_item->childItems().begin();
     iter != parent_item->childItems().end();
     ++iter)
{

...

About delegates and cell renderers - data formatting in Qt

Warning: the following blog post has a rant-to-usefulness ratio of 3:1.

Last week I needed to perform some data formatting on Qt list view. From reading the documentation alone I could not find a satisfying answer. When asking on IRC the answer was to use proxy models. This would have worked, but having two models for one view can create all kind of correspondence problems (think of sorting etc.). And there is [this ...

Miniature - it moves!

How it begun

Miniature

When I read Quim's thread about the idea for a better Maemo chess app I knew I wanted to join the project. To me, it's all about the device and the sparkling Hildon UX. I really want a good chess app, for myself! I want to play chess online, everywhere! And I want to analyze ...

Wt - a Qt-ish web toolkit written in C++

First of all, C++ for web apps doesn't necessarily make it easier to write them. Compared to other solutions (let's say Django) you'll end up writing a lot more code. And you have to be very very careful with memory leaks.

But that isn't the point. The main advantage of this framework is how close it is to desktop applications. Porting your Qt desktop application to the web is certainly easier with Wt than with any other solution, as you keep most of the widget API and also the signal and slots paradigm (which should allow to port the ...

C++ Template Poisoning

Today I was sick. At first I thought, "Ha, serves you right for eating dead animals!", but then I realized this weren't the usual kind of stomach problems. All of a sudden it struck me - I had a C++ Template Poisoning!

So what happened? I've been busy picking up C++ over the last weeks, mostly from reading books. When I ...

C genuinely less powerful than modern languages

So today I finally realized that C is not only less convenient than modern programming languages, it's also genuinely less powerful than modern languages: In garbage collected (and reference counted) languages you can easily write:

if (attr_list != priv->cached_attr_list ||
    0 != list_compare (attr_list, priv->cached_attr_list)) {
    priv->attr_value = parse_attr (attr_list);
    priv->cached_attr_list ...