I’m trying to handle the event of when my ChartManager (QWidget) is destroyed (i.e. when it’s closed). But the signal isn’t emitted at all (i dont get the debug output)
//Mainwindow.cpp
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent), m_ui(new Ui::MainWindow),
. . .
m_chartManager(new ChartManager(nullptr)) {
. . .
connect(m_chartManager, &QObject::destroyed, this, [this]() {
qDebug() << "ChartManager destroyed";
m_isChartVisible = false;
m_toolbar->actionShowCharts->setEnabled(false);
});
. . .
//Chartmanager.h
. . .
class ChartManager : public QWidget {
Q_OBJECT
public:
. . .
setting it to .. new ChartManager(this), embodies the chart manager window into mainwindow itself
which is not what i want…
I tried chaning to QObject
New contributor
Mosazghi is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.