Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix scroll methods for e2e tests #16325

Open
anastasiyaig opened this issue Sep 12, 2024 · 1 comment
Open

Fix scroll methods for e2e tests #16325

anastasiyaig opened this issue Sep 12, 2024 · 1 comment
Assignees
Labels
autotest-blocker issue that does not allow autotest to pass bug Something isn't working
Milestone

Comments

@anastasiyaig
Copy link
Contributor

Bug Report

Description

There are 2 scrolls now in framework:

There are 2 problems here:

  1. scroll for ScrollView is applicable only for ScrollView, so I can't use it for ListView for example
  2. scroll for Flickable is buggy and leads to infinite scrolling. Some changes landed because of this assumption chore: reworked scroll method #15513 in this PR, so we basically moved to use scroll for scrollView. But the initial problem with Flickable scroll is the method implementation. To fix this issue I probably need to check if the view is at the end, because flick never scroll infinitely, always till the end (or till the beginning) of scroll view object
  3. issue with both implementations. Both functions are receiving a qml object and want to scroll until this object is visible. But the delegates in listviews are lazy and are created only when the object is close to being visible.
    So it's only good to scroll to an object close to the view

Suggested implementation per @alexjba

// Some pseudocode

function object_in_view(flickable, object)
    return object.exists &&
           object.y > flickable.contentY - flickable.originY && // check if the object is below the current top of the view
           object.y + object.height < flickable.contentY - flickable.originY + flickable.height // check if the object is above the current bottom of the view

function scroll_to_object(flickable, object)
    flickable.contentY = flickable.originY //move at beginning

    if object_in_view
        return
    while !flickable.atYEnd
        flick
        if object_in_view
            return

Also, if we have an index and want to scroll to it in a ListView, we can easily use https://doc.qt.io/qt-5/qml-qtquick-listview.html#positionViewAtIndex-method. Same with GridView. That might be worth implementing as well

@anastasiyaig anastasiyaig added bug Something isn't working autotest-blocker issue that does not allow autotest to pass labels Sep 12, 2024
@anastasiyaig anastasiyaig added this to the 2.32.0 Beta milestone Sep 12, 2024
@anastasiyaig anastasiyaig self-assigned this Sep 12, 2024
@anastasiyaig
Copy link
Contributor Author

To properly fix that, i would need assistance from QML experts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
autotest-blocker issue that does not allow autotest to pass bug Something isn't working
Projects
Status: No status
Development

No branches or pull requests

1 participant