this is really annoying, I have to install an eventFilter and remove the sectionPressed handler
ui->tableWidget->horizontalHeader()->viewport()->installEventFilter(this);
Within the eventFilter I can check wether a key was pressed like so
bool MainWindow::eventFilter(QObject *object, QEvent *event)
{
if(event->type() == QEvent::MouseButtonPress)
{
if(Qt::ControlModifier == QApplication::keyboardModifiers())
{
QMouseEvent *mouseEvent = static_cast<QMouseEvent *>(event);
if(mouseEvent)
{
if(mouseEvent->button()== Qt::LeftButton)
{
ui->tableWidget->selectColumn(ui->tableWidget->itemAt(mouseEvent->pos())->column());
return true;
}
}
}
}
return QWidget::eventFilter(object,event);
}