>Melbourne 2007

>The F1 season has finally started with a nice race. Hamilton proved to be quick, Kovi was a bit of a disappointment, as was the breakdown of Kubica’s car. The results could had been even better than they where (for a BMW fan, that is). A fourth for Heidfeld, with a good part of the race in second place was really good. Hopefully we’ll see both cars there or even further ahead next time.

>Qt Designer Plug-ins

>When creating plug-ins for Qt Designer you always run into the task of implementing a plug-in class. This can be tedious as you pretty much add your class name to a template. Now, thanks to some php-magic, you just have to enter your class name and press a button to get the code. Try it yourself: the Qt Designer Plug-in Generator.

Note! This is beta (alpha) software – not very tested – use it at your own risk.

>Skoda Fabia

>Last week I had my car on service and was given a fairly new Skoda Fabia as a replacement car for the day. I live in Sweden, so I had the car fitted with spiked tires, just in case. As you might already be aware – these tires adds some extra noise, compared to ordinary friction tires or summer tires. Anyway – I just could not understand why the car was fitted with a stereo. Especially as I had to rev it over 4000 rpm to get a decent high-way speed.

But all is not bad – having to rev means having to shift alot and that makes the driving more challenging. To sum thing up, it is slow, noisy and requires quite alot of shifting – but also kind of fun in that regard. It felt good to get my own car back.

>Selecting

>I ran into something peculiar today when using the Model/View classes in Qt 4.2 – probably something related to TaskTracker issue 143383. To demonstrate, let’s start with a minimal model that can be reset from a public method:

class MyStringListModel : public QStringListModel
{
public:
MyStringListModel( const QStringList &items ) : QStringListModel( items, 0 ) {}

void resetModel() { reset(); }
};

I start by initializing the model and viewing it through a QListView:

  QListView listView;
QStringList items;
items << "Kalle" << "Olle" << "Albert" << "Sven" << "Anders" << "Markus";
MyStringListModel model( items );
listView.setModel( &model );

Then I set the current index and select it – this is equvalent to picking it with the mouse (that was how I ran into the issue):

  listView.selectionModel()->setCurrentIndex(
model.index( 3, 0, QModelIndex() ),
QItemSelectionModel::SelectCurrent );

This gives us the following state:

  listView.selectionModel()->hasSelection() == true
listView.selectionModel()->selectedIndexes().count() == 1
listView.selectionModel()->currentIndex().isValue == true

Now, I reset the model:

  model.resetModel();

The situation changes to:

  listView.selectionModel()->hasSelection() == true
listView.selectionModel()->selectedIndexes().count() == 0
listView.selectionModel()->currentIndex().isValue == false

The same thing happens when using select instead of setCurrentIndex. When using the following line…

  listView.selectionModel()->select(
model.index( 3, 0, QModelIndex() ),
QItemSelectionModel::SelectCurrent );

… you get the following:

  listView.selectionModel()->hasSelection() == true
listView.selectionModel()->selectedIndexes().count() == 1
listView.selectionModel()->currentIndex().isValue == false

And after resetting the model it looks like this:

  listView.selectionModel()->hasSelection() == true
listView.selectionModel()->selectedIndexes().count() == 0
listView.selectionModel()->currentIndex().isValue == false

The TaskTracker entry says that the bug is fixed, so this is likely to have been fixed in the Qt 4.3 snapshots. If you’re using an earlier release it looks as if the selectedIndexes().count() is a better way to determine if something is selected.

>I visited the BitSim headquarters yesterday and got a chance to see the spring in Stockholm. It was nice to notice that it is slightly warmer in Gothenburg – but still far too cold for my taste – around 8 dgC.

It it would have been raining it would have been dangerously close to the Swedish standard temperature. It is 12 dgC. Combined with rain this is the Swedish standard weather. It is called just that because it could be chistmas eve or midsummer. It is is 12 dgC and raining you cannot tell.

Now it may sound as if Sweden is permanently cold and rainy. That is quite far from the truth. I’ve seen beautiful winterdays in the north with temperatures close to -35 dgC. In the summer we can reach around 30 dgC some days – and that is a bit too hot for my taste. I prefer around 25-27 dgC if I can be picky :-)

Anyway, enough about the weather. Stockholm was nice as always and it is always fun to visit the headquarters. This time I got a chance to have a closer look at the Badger demo – it was really cool. Live video, alphablended graphics and nearly no CPU load – it impressed the geek in me :-)