Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Weird behavior when resizing a SwipeView
Forum Updated to NodeBB v4.3 + New Features

Weird behavior when resizing a SwipeView

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
5 Posts 2 Posters 449 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    GuillaumeMZ
    wrote on last edited by
    #1

    Hello everyone,

    I'm encountering an issue with a small application I've written in Python and QML that involves using a SwipeView which occupies the entire window. When I resize the window, there's a brief period where I can see the pages adjacent to the current one, except when the first page is visible. I've attached a link to a video I recorded demonstrating this issue.
    Warning: contains flashing lights
    The video

    Another puzzling aspect is that when I set the "interactive" property of the SwipeView back to true (as it was initially set to false in my application), I observe the same strange behavior, UNLESS I interact with the current page before resizing. I haven't shown this in the video, but I can record another one if necessary.

    This is the code of the QML file. I didn't include the code of the main.py file since it only creates a QQmlApplicationEngine and loads the QML file.

    import QtQuick
    import QtQuick.Window
    import QtQuick.Controls
    
    Window {
        width: 640
        height: 480
        visible: true
    
        SwipeView {
            id: swipe
    
            anchors.fill: parent
            interactive: false
    
            Repeater {
                model: ["red", "blue", "pink", "yellow", "green"]
                Rectangle {
                    required property string modelData
                    color: modelData
                }
            }
        }
    
        RoundButton {
            anchors {
                left: parent.left
                verticalCenter: parent.verticalCenter
            }
    
            text: "<"
            onClicked: swipe.decrementCurrentIndex()
        }
    
        RoundButton {
            anchors {
                right: parent.right
                verticalCenter: parent.verticalCenter
            }
    
            text: ">"
            onClicked: swipe.incrementCurrentIndex()
        }
    }
    

    I've tried to troubleshoot this behavior by examining my code for potential issues related to resizing events or SwipeView properties, but I haven't been able to pinpoint the exact cause. I've seen no information in the docs regarding this issue, and I've noticed this happens regardless of the OS the app is running on - I've tried running this on Windows 11 and EndeavourOS (Gnome 45) and I noticed the same problem. Has anyone else encountered a similar problem or could provide insights into what might be causing this unexpected behavior?

    Any help or suggestions would be greatly appreciated. Thank you in advance for your assistance!

    1 Reply Last reply
    0
    • G Offline
      G Offline
      GuillaumeMZ
      wrote on last edited by
      #2

      Up ! Can anyone try this code and tell me if they face the same problem ? If yes, should this be considered as a bug ? Should I open a bug report on the Qt Bug Tracker ?

      D 1 Reply Last reply
      0
      • G GuillaumeMZ

        Up ! Can anyone try this code and tell me if they face the same problem ? If yes, should this be considered as a bug ? Should I open a bug report on the Qt Bug Tracker ?

        D Offline
        D Offline
        duojiaoyutouteng
        wrote on last edited by
        #3

        @GuillaumeMZ d89c358a-f529-4b94-b747-5173b82137a9-image.png
        But then when you change the window size you might see a white area

        G 1 Reply Last reply
        0
        • D duojiaoyutouteng

          @GuillaumeMZ d89c358a-f529-4b94-b747-5173b82137a9-image.png
          But then when you change the window size you might see a white area

          G Offline
          G Offline
          GuillaumeMZ
          wrote on last edited by
          #4

          @duojiaoyutouteng Where does index come from ? I've tried this code but it doesn't compile.

          D 1 Reply Last reply
          0
          • G GuillaumeMZ

            @duojiaoyutouteng Where does index come from ? I've tried this code but it doesn't compile.

            D Offline
            D Offline
            duojiaoyutouteng
            wrote on last edited by
            #5

            @GuillaumeMZ
            e00854c6-5a8c-4d03-a3be-62cb5866d555-image.png

            1 Reply Last reply
            0

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved