How to emit progressTextChanged (QString) signal in QFutureWatcher?
Having this code is possible to emit the progressTextChanged(QString) signal? i have tried but i when trying to access the signal the compiler says it is protected.
Code:
//...
//...
QFuture<bool> future = QtConcurrent::run(
this,
&MyClass::runTheTask );
QFutureWatcher<bool> watcher;
connect( &watcher,
SIGNAL( progressTextChanged
( const QString ) ),
this,
SLOT( appendMessageToStatusLineEdit
( const QString ) ) );
watcher.setFuture( future );
future.waitForFinished();
// ...
// ...
Code:
bool MyClass::runTheTask()
{
// do the task
// how to emit progress text signal???
}
void MyClass
::appendMessageToStatusLineEdit( const QString msg
) {
"doAppendMessageToStatusLineEdit",
Qt::QueuedConnection,
}
void MyClass
::doAppendMessageToStatusLineEdit( const QString msg
) {
_ui->statusTextEdit->append( msg );
}
Re: How to emit progressTextChanged (QString) signal in QFutureWatcher?
you cant emit a signal that does not belong to your class.
QFutureWatcher decides when to emit that signal - you do not!