Qt Centre Programming Contest 2007

This is a story of a programmer who participated in the Qt Centre programming contest.

The contest QxtPushButtonwas announced in January 2007, the same time when Qt Centre was celebrating its first anniversary. As an active user on the forum, I really wanted to participate, but the problem was that I had no decent idea. Luckily, at the endQxtLabel of the same month, someone special (sorry for forgetting your nick) stopped by on #qt. He was looking for a label which can be shrunk below to its preferred size while it automatically elides any text that doesn’t fit. This is where everything started — I decided to write one. On 30th January I joined the Qxt team which consists of some #qt regulars. The same day I introduced QxtLabel which is able to elide its contents as requested. As a further addition, QxtLabel was made rotatable.

A rotatable button — QxtPushbutton — followed immediately after QxtLabel. Later during the spring QxtPushbutton was also improved with rich text support.

The next target was to write a delegate being able to decorate top level items in a tree, like Qt Designer does. This is how QxtItemDelegate and QxtTreeWidget were born. The original plan was to write a bunch of different kind of styles (including a popular MS Office look) but sadly only two were gathered up so far. Later during the spring QxtItemDelegate was extended with a progress role. Returning valid data for QxtItemDelegate::ProgressRole makes the delegate to render an item as a progress bar in a similar way than the torrent example does.

Somewhere in the middle of February a couple of more classes — QxtTabWidget and QxtApplication — were introduced. QxtTabWidget attempts to make it extremely easy to handle tab specific context menus. QxtTabWidget supports same context menu policies than QWidget does but per tab. QxtApplication (improvised by this thread) makes it possible to register global shortcuts that trigger even while application is inactive.

QxtCheckComboBoxIn the next turn of month, I decided to add QxtCheckComboBox — a combo box with checkable items. Thanks go to qiank128 for the original idea and aep for throwing out the idea of different checking modes. Thanks to him it’s possible to choose whether items are checked by clicking anywhere on an item or just inside a check indicator.

While suffering from a temporary lack of improvisation, I decided to include a couple of a simple classes — QxtStringSpinBox and QxtProxyStyle. The former is a simple QStringList wrapper for QSpinBox to have textual items instead of numbers and the latter is the famous proxy style as discussed in Qt Quarterly 9.

The mission was continued with addition of QxtSpanSlider which is a slider with two handles. The idea for a double headed slider was yet again adapted from various posts at Qt Centre. This must have been the most challenging widget of the submission of mine. On the other hand, the most challenging utility class was definitely QxtDesktopWidget on which I started working next. QxtDesktopWidget provides access to all windows on the desktop, not just Qt ones, but also native windows. This makes it rather simple to for example implement a screenshot application. As a proof of concept, I did a quick port of KSnapshot. QxtSnapshot is included as a demo in the submission package.

Suddenly — while working with tooltips — I got an idea of QxtToolTip which would allow one to show any arbitrary widget as a tooltip. I somehow felt QToolTip a bit restrictive. By this time I had also plucked up enough courage to actually register to the contest. Funnily enough, the reply got somehow marked as spam so for a while I didn’t even notice the approval of my contest entry.

The approaching deadline run me into going through what I’ve had gathered together so far. The beginning of May was time of improvements in documentation, some little refactoring and writing of demo apps & unit tests. Somewhere in the middle of May I got a nice little boost. Yet half a doze new classes were introduced.

QxtDockWidget fills in the gap in QDockWidget and makes the dock widget to remember its size while toggling visibility off and on. QxtListWidget, QxtTableWidget and respective item classes provide more convenience such as editingQxtStars notifications, check state changes and item flag handling. QxtStars is a funny little stars assessment widget. QxtProgressLabel does the work for you and automatically calculates the estimated time awaiting while being connected to a QProgressBar. QxtGroupBox is a checkable group box that automatically shows/hides its content according to the check state. Behaviour is pretty much identical to GtkExpander. A couple of last minute additions were QxtConfigDialog and QxtConfirmationMessage. The former wraps common type of a config dialog into a convenient API and the latter provides an common confirmation message with “do not show again” option.

According to this post, the judging process is soon about to finish. I’m eagerly waiting for the results. My personal favourite is definitely the Marple Desktop Globe. It looks awesome!

Leave a Reply