This should be simple, but I don't see it.
Trying to emit a signal in the EditLog class to call a slot in the MainWindow.
No error, but the slot doesn't get called.
the EditLog.h entries:
signals:
void logChanged();
private slots:
void on_pbSave_clicked();
void on_pbCancel_clicked();
signals:
void logChanged();
private slots:
void on_pbSave_clicked();
void on_pbCancel_clicked();
To copy to clipboard, switch view to plain text mode
the EditLog cpp
void EditLog::on_pbSave_clicked()
{
// some code
emit logChanged();
void EditLog::on_pbSave_clicked()
{
// some code
emit logChanged();
To copy to clipboard, switch view to plain text mode
the MainWindow.h
public slots:
void updateLogView();
public slots:
void updateLogView();
To copy to clipboard, switch view to plain text mode
the MainWindow.cpp // updateLogView never gets executed
// in the constructor:
EditLog el;
connect(&el, SIGNAL(logChanged()), this, SLOT(updateLogView()));
//
void MainWindow::updateLogView() {
view->selectionModel()->clearSelection();
model->select();
view->resizeColumnsToContents();
qDebug() << "edit model error is " << model->lastError();
}
// in the constructor:
EditLog el;
connect(&el, SIGNAL(logChanged()), this, SLOT(updateLogView()));
//
void MainWindow::updateLogView() {
view->selectionModel()->clearSelection();
model->select();
view->resizeColumnsToContents();
qDebug() << "edit model error is " << model->lastError();
}
To copy to clipboard, switch view to plain text mode
Any idea what I am missing?
Bookmarks