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. Insert a SwipeView with dynamic number of pages into a TabBar with 2 Tabs

Insert a SwipeView with dynamic number of pages into a TabBar with 2 Tabs

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
4 Posts 2 Posters 548 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.
  • M Offline
    M Offline
    marco_88
    wrote on last edited by
    #1

    Hello everybody

    I have a page with a swipeView which has a variable number of pages.

    This page loads an hourly schedule of a thermostat from a Rest API and this part after a few days I managed to make it work. It also works swipe, in the sense that by turning the pages it loads the corresponding programming.

    Now another part is missing, which is to change the season.

    The 2 tabs represent the season, therefore summer and winter. When I open the page it must show the Summer season, and when I click on Winter it must load the Winter season.

    In practice, in the Rest API I spend the current season, so at the call of the API I already foresee this parameter, and what I am missing is just inserting this already working swipe into a tabbar, and pass the season as a parameter directly from the tab.

    I also want to avoid conflicts between the swipeview and the tabbar, because in the swipe I use the swipe index to pass it to the API to load the correct page programming. But in addition to the swipe index, I also have to pass the tab index separately.

    I hope I was clear. If there are doubts, let me know that I try to clarify them better.

    Regards,
    Marco

    1 Reply Last reply
    0
    • 6thC6 Offline
      6thC6 Offline
      6thC
      wrote on last edited by
      #2

      Have you seen the vanilla project template for a "Qt Quick Application - Swipe"? Cause that has a simple swipe/tab index relationship working. It has 2 tabs to control the swipe index. While hardcoded in the template, the swipe model needn't be.

      I use a SwipeView connected to a TabView, with the SwipeView model a ListModel, the delegate a Repeater.

      All the rest of your details frankly are yours to deal with / irrelevant to these 2 controls. I'd recommend: change the data / behaviour by using and changing models and for changing selections by changing the Swipe&Tab indexes. The details of what does what when is your job.

      1 Reply Last reply
      0
      • M Offline
        M Offline
        marco_88
        wrote on last edited by
        #3

        I resolve problem but now I have conflict between currentIndex of TabBar and SwipeView.

        If I change TabBar change also index of Swipe, and I don't want this.

        How can resolve this issue?

        Thank you.

        1 Reply Last reply
        0
        • M Offline
          M Offline
          marco_88
          wrote on last edited by
          #4

          In fact, I just realized that it is not a question of conflict, but of synchronization.

          Basically I said 2 tabs: Summer and Winter, and each of these 2 tabs assumes that 3 pages.

          I am in the summer season and on page 1, and if I go to winter I am always on page 1.

          But if from the summer page I go to page 3, in a certain way the index moved only in the summer season, and in the winter one I stayed on page 1.

          How can I synchronize the swipeView index between the 2 tabs? In practice, if from summer I go to page 3, and then I go to the winter tab, winter must also go to page 3 as soon as I click on the winter tab. So in addition to switching and loading the winter programming, it must take me to the same page I had before going to winter.

          Thank you

          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