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. SwipeView gets confused when opening a new Window
Forum Update on Monday, May 27th 2025

SwipeView gets confused when opening a new Window

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
swipeview
2 Posts 1 Posters 448 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
    GregVR
    wrote on last edited by
    #1

    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!

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

      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: false in 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: true and 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.

      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