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.
//...
//...
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();
// ...
// ...
//...
//...
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();
// ...
// ...
To copy to clipboard, switch view to plain text mode
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 );
}
bool MyClass::runTheTask()
{
// do the task
// how to emit progress text signal???
}
void MyClass::appendMessageToStatusLineEdit( const QString msg )
{
QMetaObject::invokeMethod( this,
"doAppendMessageToStatusLineEdit",
Qt::QueuedConnection,
Q_ARG( QString, msg ) );
}
void MyClass::doAppendMessageToStatusLineEdit( const QString msg )
{
_ui->statusTextEdit->append( msg );
}
To copy to clipboard, switch view to plain text mode
Bookmarks