[kmymoney] [Bug 460007] Forecasting graph on the home page has random quality problems

Ralf Habacker bugzilla_noreply at kde.org
Fri Oct 14 09:51:39 BST 2022


https://bugs.kde.org/show_bug.cgi?id=460007

--- Comment #18 from Ralf Habacker <ralf.habacker at freenet.de> ---
I changed the code on the 5.1 branch to 

void KHomeView::refresh()
{
    Q_D(KHomeView);
    if (isVisible()) {
        auto t_start = std::chrono::high_resolution_clock::now();
        d->loadView();
        auto t_end = std::chrono::high_resolution_clock::now();
        qDebug() << __FUNCTION__ << std::chrono::duration<double,
std::milli>(t_end-t_start).count() << " ms";
        d->m_needsRefresh = false;
    } else {
        d->m_needsRefresh = true;
    }
}

void KHomeView::resizeEvent(QResizeEvent* event)
{
    static QTimer timeout;

    static auto t_now = std::chrono::high_resolution_clock::now();
    auto t_old = t_now;
    t_now = std::chrono::high_resolution_clock::now();
    qDebug() << __FUNCTION__ << "time to last resize event" <<
std::chrono::duration<double, std::milli>(t_now-t_old).count() << " ms";

    // refresh only if no other resize event occurs within the specified time
    timeout.stop();
    connect(&timeout, &QTimer::timeout, this, &KHomeView::refresh,
Qt::UniqueConnection);
    timeout.setSingleShot(true);
    timeout.start(100);
    KMyMoneyViewBase::resizeEvent(event);
}

and  got with the appended testfile:

- app start (Qt5.12)  
resizeEvent time to last resize event 8.1e-05  ms (initial call)
refresh 336.841  ms
refresh 185.522  ms ( triggered by other event)
resizeEvent time to last resize event 690.682  ms
refresh 305.591  ms

- moving to another screen 
resizeEvent time to last resize event 53915.6  ms
refresh 172.17  ms

- resizing the window
resizeEvent time to last resize event 21941.2  ms
resizeEvent time to last resize event 35.1883  ms
resizeEvent time to last resize event 29.0735  ms
resizeEvent time to last resize event 37.9509  ms
resizeEvent time to last resize event 25.2898  ms
resizeEvent time to last resize event 31.865  ms
resizeEvent time to last resize event 24.6573  ms
resizeEvent time to last resize event 30.3148  ms
resizeEvent time to last resize event 20.7432  ms
resizeEvent time to last resize event 23.4848  ms
resizeEvent time to last resize event 19.4617  ms
resizeEvent time to last resize event 21.0152  ms
resizeEvent time to last resize event 18.9487  ms
resizeEvent time to last resize event 20.2506  ms
resizeEvent time to last resize event 20.7011  ms
resizeEvent time to last resize event 17.4308  ms
resizeEvent time to last resize event 29.7552  ms
resizeEvent time to last resize event 24.0264  ms
resizeEvent time to last resize event 16.496  ms
resizeEvent time to last resize event 16.8137  ms
resizeEvent time to last resize event 17.4071  ms
resizeEvent time to last resize event 23.0246  ms
resizeEvent time to last resize event 23.6899  ms
resizeEvent time to last resize event 16.7566  ms
resizeEvent time to last resize event 23.7812  ms
resizeEvent time to last resize event 17.9087  ms
resizeEvent time to last resize event 30.9371  ms
resizeEvent time to last resize event 13.8725  ms
resizeEvent time to last resize event 15.2983  ms
resizeEvent time to last resize event 15.8863  ms
resizeEvent time to last resize event 16.1352  ms
resizeEvent time to last resize event 15.8075  ms
resizeEvent time to last resize event 16.1257  ms
resizeEvent time to last resize event 16.1365  ms
resizeEvent time to last resize event 16.9236  ms
resizeEvent time to last resize event 23.0767  ms
resizeEvent time to last resize event 16.533  ms
resizeEvent time to last resize event 16.6189  ms
resizeEvent time to last resize event 16.8857  ms
resizeEvent time to last resize event 29.1898  ms
resizeEvent time to last resize event 16.5146  ms
resizeEvent time to last resize event 16.106  ms
resizeEvent time to last resize event 16.6079  ms
resizeEvent time to last resize event 16.2147  ms
resizeEvent time to last resize event 16.5906  ms
resizeEvent time to last resize event 16.1275  ms
resizeEvent time to last resize event 16.351  ms
resizeEvent time to last resize event 16.8019  ms
resizeEvent time to last resize event 16.6459  ms
resizeEvent time to last resize event 18.7296  ms
resizeEvent time to last resize event 18.1929  ms
resizeEvent time to last resize event 15.7177  ms
resizeEvent time to last resize event 16.428  ms
resizeEvent time to last resize event 16.1611  ms
refresh 118.69  ms

-> only one refresh

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the KMyMoney-devel mailing list