I have an interface with two QListViews, where the left determines what is displayed in the right:

To update the list on the right, I have the following function:
void CodePlug::handleSelectionChanged()
{
QModelIndex portIndex = ui->listPorts->currentIndex();
QString portItemText = portIndex.data(Qt::DisplayRole).toString();
ui->listPlugs->setModel(ListModelFromMap(plugs[portItemText]));
currentPort = portItemText;
qDebug(currentPort.toStdString().data());
}
and it's connected to the selectionChanged signal here:
CodePlug::CodePlug(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::CodePlug)
{
ui->setupUi(this);
ui->listPorts->setModel(ListModelFromMap(ports));
QModelIndex portIndex = ui->listPlugs->currentIndex();
QString portItemText = portIndex.data(Qt::DisplayRole).toString();
ui->listPlugs->setModel(ListModelFromMap(plugs[portItemText]));
connect(ui->listPorts->selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)), this, SLOT(handleSelectionChanged()));
}
However, changing the selected item by either the keyboard or the mouse never triggers handleSelectionChanged(). It doesn't generate any errors, it just doesn't do anything. Could anybody give me an idea why?