I am new to QT and tried to create a custom waveform that would tell me that a removable disk was inserted. This is what I did
mainwindow.h
class MainWindow { QOBJECT .. .. signals: void qm_diskInserted(QString &); public slots: void addItemToList(QString &); ... }
mainwindow.cpp
void MainWindow::onDeviceChange(MSG * msg) { //code for detecting device here QString &driveLetter= getDriveLetter(mask); //try to emit QT signal here emit qm_diskInserted(driveLetter); } MainWindow::MainWindow(QWidget * parent=NULL) { ui.setupUi(this); QObject::connect(this, SIGNAL(qm_diskInserted(QString&)), this, SLOT(addItemToList(QString &)); } void MainWindow::addItemToList(QString &) { //more stuff here }
somehow the addItemToList () slot is not being called, and I have to call it manually.
What am I doing wrong?
Thanks. PS:
By the way, is there a way to debug signals?
Those. How can I be sure that the signal is being emitted?
source share