use currentItemChanged signal instead of itemSelectionChanged - since the latter is always one item behind if you hold down the mousebutton and move the cursor through the list
#include <QtGui/QApplication>
#include "mainwindow.h"
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
MainWindow w;
w.show();
return a.exec();
}