SwipeView gets confused when opening a new Window
-
I have a QML-based desktop application. It uses a main window which is made up of a SwipeView and a TabBar (similar to the Gallery2 TabBar example). Everything works fine... until I open a new Window.
When the user double clicks on a certain item in one of the SwipeView pages (which is itself a ListView), it calls a C++ function which is then connected up to the QML application. When this happens, we open a new window:
Connections { target: _backend onReviewData: { // whenever we get data from the backend signal reviewData, we create a new ResultsWindow to display it // Do note, however, that there is no connectivity between the main app and the ResultsWindows once they // are created-- currently, this doesn't matter. var component = Qt.createComponent("ResultsWindow.qml"); var win = component.createObject(window, {"width": 800, "height": 600, "x": window.x + 100, "y": window.y + 100}); win.setResult(sr); win.show(); } }At this point, if I click on the TabBar buttons in the main window, the SwipeView does not switch to the appropriate page.
My first thought was a broken binding, but everything I've done seems to show that the bindings between the SwipeView and the TabBar are still there. It's just that the SwipeView doesn't move.
If I use my mouse and SWIPE left and right on the SwipeView, it seems like things start working properly again.
What am I missing? What would cause a SwipeView to not actually change its view to match its currentIndex?
Thanks in advance!
-
Just to sit and answer my own question (but also trying to contribute to the forum's knowledge!)...
I figured out that if I set
interactive: falsein the SwipeView, then everything works correctly-- it's just that you can't use your mouse to swipe left and right, which, could be argued, wouldn't be correct behavior in a windows/pointer desktop approach anyway.I'm guessing that there is something odd that happens in SwipeView when another window is opened. We are planning on targeting a touchscreen/fullscreen version eventually, in which case setting
interactive: trueand switching the Window creation to Popups would be the right thing to do anyway.I'm leaving as unsolved for now, just because I'm curious if anyone has any other ideas.