jimbo
19th October 2016, 15:23
Hello,
A follow on to this post of mine.
http://www.qtcentre.org/threads/66953-Qt5-C-Signals-and-slots-QMainwindow-to-QDialog
I've progressed a little, thanks to your help.
Another problem.
I'm emitting a signal early in the noobsForm init process, which is not getting called.
I've read somewhere that signals and slots are set up sometime in the process but are not guaranteed when.
I added a process events call, no help.
Is this my problem? If it is, is there any round it?
Regards
mainwindow.cpp
noobsForm myNoobs(listPart, file);
QObject::connect(&myNoobs, SIGNAL(doFormat(int, bool)),
this, SLOT(formatSDcard(int, bool)));
QObject::connect(&myNoobs, SIGNAL(doWriteNoobs(int, bool, QString)),
this, SLOT(writeNoobs(int, bool, QString)));
QObject::connect(&myNoobs, SIGNAL(doUpdateDriveDataList()),
this, SLOT(getLogicalDrivesSlot()));
****
QObject::connect(&myNoobs, SIGNAL(doGetFileCount(QString)),
this, SLOT(getUpdatedFileCount(QString)));
****
myNoobs.exec();
void MainWindow::getUpdatedFileCount(QString driveLetter) //slot
{
qDebug() << "getupdatedfilecountSlot" << driveLetter;
//getFileList(driveLetter);
//qDebug() << countFiles << "-" << countDirs;
//emit doUpdateFileList(countFiles, countDirs);
}
mainwindow.hpp
public slots:
bool formatSDcard(int type, bool remote);
void writeNoobs(int which, bool remote, QString file);
void getLogicalDrives(); // find attached USB devices
void getUpdatedFileCount(QString driveLetter);
noobsForm.cpp
This is in the noobsForm init process:-
delay(1000); //process events - ? required
qDebug() << "passed letter" << (driveLetter + ":");
emit doGetFileCount(driveLetter + ":");
These are triggered by pushbuttons and work:-
emit doFormat(type, true);
emit doWriteNoobs(1, true, address);
emit doUpdateDriveDataList();
noobs.hpp
signals:
void doFormat(int, bool);
void doWriteNoobs(int, bool, QString);
void doUpdateDriveDataList();
void doGetFileCount(QString);
Debug output:-
passed letter "J:"
A follow on to this post of mine.
http://www.qtcentre.org/threads/66953-Qt5-C-Signals-and-slots-QMainwindow-to-QDialog
I've progressed a little, thanks to your help.
Another problem.
I'm emitting a signal early in the noobsForm init process, which is not getting called.
I've read somewhere that signals and slots are set up sometime in the process but are not guaranteed when.
I added a process events call, no help.
Is this my problem? If it is, is there any round it?
Regards
mainwindow.cpp
noobsForm myNoobs(listPart, file);
QObject::connect(&myNoobs, SIGNAL(doFormat(int, bool)),
this, SLOT(formatSDcard(int, bool)));
QObject::connect(&myNoobs, SIGNAL(doWriteNoobs(int, bool, QString)),
this, SLOT(writeNoobs(int, bool, QString)));
QObject::connect(&myNoobs, SIGNAL(doUpdateDriveDataList()),
this, SLOT(getLogicalDrivesSlot()));
****
QObject::connect(&myNoobs, SIGNAL(doGetFileCount(QString)),
this, SLOT(getUpdatedFileCount(QString)));
****
myNoobs.exec();
void MainWindow::getUpdatedFileCount(QString driveLetter) //slot
{
qDebug() << "getupdatedfilecountSlot" << driveLetter;
//getFileList(driveLetter);
//qDebug() << countFiles << "-" << countDirs;
//emit doUpdateFileList(countFiles, countDirs);
}
mainwindow.hpp
public slots:
bool formatSDcard(int type, bool remote);
void writeNoobs(int which, bool remote, QString file);
void getLogicalDrives(); // find attached USB devices
void getUpdatedFileCount(QString driveLetter);
noobsForm.cpp
This is in the noobsForm init process:-
delay(1000); //process events - ? required
qDebug() << "passed letter" << (driveLetter + ":");
emit doGetFileCount(driveLetter + ":");
These are triggered by pushbuttons and work:-
emit doFormat(type, true);
emit doWriteNoobs(1, true, address);
emit doUpdateDriveDataList();
noobs.hpp
signals:
void doFormat(int, bool);
void doWriteNoobs(int, bool, QString);
void doUpdateDriveDataList();
void doGetFileCount(QString);
Debug output:-
passed letter "J:"