diff options
author | Shawn Rutledge <shawn.rutledge@qt.io> | 2024-05-21 17:38:11 -0700 |
---|---|---|
committer | Shawn Rutledge <shawn.rutledge@qt.io> | 2024-06-01 13:52:39 -0700 |
commit | 47816e03fddeba1e0172819702830148fb0a103f (patch) | |
tree | 6549c53f61eb9a1d7d5b5228f13d75bc5525d989 /src/quickcontrols/doc/snippets/qtquickcontrols-combobox-accepted.qml | |
parent | 8f1feef274c25deccbbcc971f3bda3cdd9f84db4 (diff) |
In the test class deviceloadingimage.cpp, using d->pix1 only was not a
thorough test: it bypassed the new feature from
e0e0f722b86db7b99185ccd669dd5456623e7e69 to keep showing a previously-
loaded image while a new one is being loaded. It so happens that PDF
files are some of the slowest images to load, and we want that to be as
asynchronous as possible. But as soon as I tried in Qt PDF, with a
single-page viewer, what I noticed is that if a different PDF file is
loaded before the first is done loading, pix1 loads one PDF file and
pix2 loads the other; if we swap twice, we end up showing nothing,
because that's the source whose loading gets cancelled. (And even
Image.frameCount ends up being incorrect, which is problematic for
QML code that depends on it to enable a page-advance Shortcut.) When
loading begins, we call QQuickPixmap::connectFinished() to get a
callback when it finishes; but if the loading is cancelled, that's not
disconnected. So we should not swap buffers if the pending one is not in
Ready or Error state. When the second job is done, requestFinished() is
called again anyway.
Since the swapping is done in requestFinished(), we now have to ensure
that requestFinished() is always called, even if loading happens very
quickly.
tst_qquickpixmapcache::slowDeviceInterrupted() is added to test a
similar scenario (but using a QQuickImageProvider. Neither it nor
QPdfIOHandler do their own threading; but PDF loading is really async.)
Task-number: QTBUG-66713
Change-Id: I85022909fe55bb439a4b37dbb8a4035d692ca96d
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Diffstat (limited to 'src/quickcontrols/doc/snippets/qtquickcontrols-combobox-accepted.qml')
0 files changed, 0 insertions, 0 deletions