Posts

Showing posts from October, 2020

QFutureWatcher

  QFutureWatcher QFutureWatcher  is useful in keeping track of when an asynchronous task complete. Consider a scenario where a dialog pops up while some operation runs in the background. The first step is to show the dialog: msgDialog = new MessageDialog ( ) ; msgDialog -> show ( ) ; QApplication :: processEvents ( ) ; //needed to properly show the dialog Having a  QFuture m_OperationFuture  as a field, a naive approach to keeping the GUI responsive while the background operation takes place is to keep calling  QApplication::processEvents()  while the operation is still executing: m_OperationFuture = QtConcurrent :: run ( runBackgroundOperation ) ; while ( m_OperationFuture . isRunning ( ) ) { QApplication :: processEvents ( ) ; } performNextOperation ( ) ; However,  QFutureWatcher  provides a better alternative: QFutureWatcher < QString > * watcher = new QFutureWatcher < QString > ( this ) ; QObject :: connect ( watcher , SIGNAL ( finished

macOS "App cannot be opened"

macOS "App Cannot be opened"  If the problem doesn't have to do with app that is not notarized, try making the contents of MacOS folder executable (using chmod +x): https://superuser.com/questions/898124/the-application-someapp-app-can-t-be-opened

Adding Qt Dialog to existing project

Image
Adding Qt Dialog to existing project: