Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Signal not connecting to Slot
The following code does not connect the signal to the slot:
void MyCanvas::paintEvent(QPaintEvent *event)
. . . .
//connect(ui->canvas, &MyCanvas::updateTheMatrixTable, this, &MainWindow::updateMatrixTable);
connect(ui->canvas, SIGNAL (updateTheMatrixTable()),
this, SLOT (updateMatrixTable()));
qDebug() << "In MainWindow Slot";
ui->tableWidget->setItem(1, 1, new QTableWidgetItem(QString::number(t.m11())));
QTableWidgetItem *newItem12 = new QTableWidgetItem(QString::number(t.m12()));
. . . .
As you can see I apears very simple, normally the signal and slot mechanism works with not problem, but in this case there is nothing to go on. Any suggestions?
from quick glance it looks ok
Please check what connect returns. ( just to be sure it says TRUE)
Also , you seem to have the connect in the DESTRUCTOR ?
That is very odd as that will first be called when main window is closed..
Normally it would be in the constructor. After the call to setupUI(xx)
You are correct, it is in the destructor, no wonder it would not work. The old eyes are really letting me down. Thanks so much, I feel like a real fool for not seeing that, it is so obvious now that you pointed it out. I should note that the reason I posted the question about getting the ui pointer was because this did not work.
I moved the code in the DESTRUCTOR to the CONSTRUCTOR and it worked like it should.
PS the spell checker used in the forum does not recognize destuctor, it should be updated for C++ terms.
Yep, big surprise ;)
Luckily it was easy to spot. ( mostly for a person that did not write the code)
"destuctor" should be destructor, i think ?
It is destructor and it shows as a misspelled word--I am dyslexic and depend on spellcheckers.
For my 50+ years of programming, it has always easier for someone else to see simple errors, and it will always be true.
Hmm i can't see it. i have installed another in chrome so i guess it wont show me what u see.