On 2020-02-21 15:02, NIkolai Marchenko wrote:
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 <he...@tungware.se <mailto:he...@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!


Agreed, you could roll your own class say in an hour, but it's there, *documented* and someone has tested and debugged it for me already. That's what "standing on the shoulder of giants" is all about...

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

Reply via email to