Weird behavior when resizing a SwipeView
-
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 videoAnother 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!
-
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 ?
-
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 ?
@GuillaumeMZ
But then when you change the window size you might see a white area -
@GuillaumeMZ
But then when you change the window size you might see a white area@duojiaoyutouteng Where does
index
come from ? I've tried this code but it doesn't compile. -
@duojiaoyutouteng Where does
index
come from ? I've tried this code but it doesn't compile.