Hi, just want to thank whoever worked to implement qScopeGuard (in 5.12), it was a perfect gift from heaven today :-)

I'm writing a LOB app with heavy database munging, and want to show the user an hourglass cursor while munging/waiting for MS SQLServer. However my functions have lots of exits due to bad weather etc. and I dreaded pasting a restore-mouse-cursor call everywhere. Googled a bit and now I use this 2-line magic at the top of my functions:
...
    qApp->setOverrideCursor(Qt::WaitCursor);
    auto restoreCursor = qScopeGuard([] { qApp->restoreOverrideCursor(); });
...

Before I discovered Qt I spent 20 years in MFC purgatory, but now I've seen the light!

_______________________________________________
Development mailing list
Development@qt-project.org
https://lists.qt-project.org/listinfo/development

Reply via email to