QObject::connect isn't working for me if I create the object in C++. It does work if I add it in QT designer though. Doesn't make sense. What am I doing wrong?

CPP:

Qt Code:
  1. QTableView *tableWidget = new QTableView(this);
  2. tableWidget->setObjectName(QString::fromUtf8("tableView"));
  3. tableWidget->setModel(&model);
  4. tableWidget->setAttribute(Qt::WA_DeleteOnClose, true);
  5. tableWidget->setSelectionMode(QAbstractItemView::SingleSelection);
  6. tableWidget->setSelectionBehavior(QAbstractItemView::SelectColumns);
  7. QObject::connect(tableWidget, SIGNAL(clicked(QModelIndex)), this, SLOT(on_tableView_clicked(QModelIndex)));
To copy to clipboard, switch view to plain text mode 

Header file:
Qt Code:
  1. public slots:
  2. void on_tableView_clicked(QModelIndex idx);
To copy to clipboard, switch view to plain text mode 

When I run it it says:

QMetaObject::connectSlotsByName: No matching signal for on_tableView_clicked(QModelIndex)