[Development] Thank you for qScopeGuard

NIkolai Marchenko enmarantispam at gmail.com
Fri Feb 21 15:02:29 CET 2020


it's definitely neat, but it's nothing that you can't do with pure c++
though. It's just qt's native implementation of score guard pattern. Tbh I
didn't even know it existed because I use my own scope guarder class.

On Fri, Feb 21, 2020 at 4:33 PM Henry Skoglund <henry at tungware.se> wrote:

> 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 at qt-project.org
> https://lists.qt-project.org/listinfo/development
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/development/attachments/20200221/c0cfa04b/attachment.html>


More information about the Development mailing list