itemviews with KDE styles adhere to KDE settings

June 23, 2008 at 1:08 am | Posted in KDevelop | Comments Off on itemviews with KDE styles adhere to KDE settings

Today I comitted my patch to kstyle.cpp which enables using the QAbstractItemView::activated() signal properly with KDE styles. As noted in the API documentation of the activated() signal it depends on the platform and until today that meant double-clicking on linux.

Luckily the Troll’s have foreseen such needs as from KDE and implemented this behaviour by asking the style wether it wants item-activation on single or double click. So by just adding another case to the styleHint() method of KStyle it was possible to actually read the KDE-wide setting for single/double clicking and provide that to the itemview.

This means that any QAbstractItemView running with a KDE style (one inheriting from KStyle) now behaves this way, so if you find your itemview to work differently you know where it comes from.

Of course I managed to break KStyle with the initial commit, this was due to a bit to little tests on my side. I only tested with my current QtCurve style and didn’t notice that even when linking against KDE4 it still uses a plain Qt style as its base class. So I didn’t notice that my change actually caused a ASSERT in KComponentData to trigger. But once I changed that I was able to quickly fix kdelibs and apparently nobody else noticed🙂

Blog at WordPress.com.
Entries and comments feeds.

%d bloggers like this: