[Interest] [PROGRESS] Long pause with 5.7

Konstantin Shegunov kshegunov at gmail.com
Mon Nov 14 20:20:21 CET 2016


On Tue, Nov 8, 2016 at 3:56 PM, william.crocker at analog.com <
william.crocker at analog.com> wrote:
>
> It appears that with Qt 5.7, SOMETIMES, my call to processEvents waits
> for the full 5 secs even though I do not believe there is anything to do.
> That is why my app is SOMETIMES unresponsive for 5 seconds when I start it
> up.
>
> [Snippet ...]
>

Perhaps I'm missing something, but why not skip the processEvents call
altogether and just queue an event to do the resizing later?
E.g:

void MyApp::show()
{
    QSettings settings;
    QSize sz = settings.value("MainWindowWSize",QSize(1200,700)).toSize();
    QPoint pos = settings.value("MainWindowPos",QPoint(180,190)).toPoint();

    if (sz.width() > 0 && sz.height() > 0)  {
        resize(sz);
        move(pos);
    }

    BaseClass::show();

    // The lambda is just quickest to write, you can use a private slot as
well.
    QTimer::singleShot(0, [sz, pos] () -> void  {
        if (sz.width() > 0 && sz.height() > 0)  {
            resize(sz);
            move(pos);
        }

        raise();
    });
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20161114/4e650606/attachment.html>


More information about the Interest mailing list