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:
tableWidget
->setObjectName
(QString::fromUtf8("tableView"));
tableWidget->setModel(&model);
tableWidget->setAttribute(Qt::WA_DeleteOnClose, true);
QTableView *tableWidget = new QTableView(this);
tableWidget->setObjectName(QString::fromUtf8("tableView"));
tableWidget->setModel(&model);
tableWidget->setAttribute(Qt::WA_DeleteOnClose, true);
tableWidget->setSelectionMode(QAbstractItemView::SingleSelection);
tableWidget->setSelectionBehavior(QAbstractItemView::SelectColumns);
QObject::connect(tableWidget, SIGNAL(clicked(QModelIndex)), this, SLOT(on_tableView_clicked(QModelIndex)));
To copy to clipboard, switch view to plain text mode
Header file:
public slots:
public slots:
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)
Bookmarks