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 navigation of more Pages than TabButtons. The TabBar TabButton temporarily unresponsive.
QtWS25 Last Chance

SwipeView navigation of more Pages than TabButtons. The TabBar TabButton temporarily unresponsive.

Scheduled Pinned Locked Moved Solved QML and Qt Quick
7 Posts 2 Posters 580 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.
  • J Offline
    J Offline
    Jake 0
    wrote on last edited by Jake 0
    #1

    I have an issue where it looks like the TabBar (or TabButton) becomes unresponsive or dead when navigating to another page.

    I put the complete code example here:
    [https://github.com/JakeKirk/TabBarBroken.git](link url)

    Platform: Windows, 64 bit, Qt 5.13.1

    This demonstrates a 'dead' Qt TabButton TabBar (inactive? disabled?) upon SwipeView.setCurrentIndex()

    If you are on Page 1 (or Page 2) and one presses 'Navigate to Page 4'
    Then one cannot get back to Page 1 (or Page 2), via the TabButton-TabBar, 'PAGE 1' (or PAGE 2).

    So the TabBar/TabButton is temporarily 'dead'? For some reason unresponsive?!
    But other TabButtons all work and if one swipes over and back (to/from) another page, this fixes things and "PAGE 1" will now respond.

    Is something getting messed up with focus? Why does it appear that the TabBar becomes unresponsive?

    Thanks in advance for taking a look or any advice you may have.
    Jake

    833bc942-7ba8-406a-8789-b3241afd8d1b-image.png

    1 Reply Last reply
    0
    • J Offline
      J Offline
      Jake 0
      wrote on last edited by
      #2

      bumping since posting example code.

      1 Reply Last reply
      0
      • mrjjM Offline
        mrjjM Offline
        mrjj
        Lifetime Qt Champion
        wrote on last edited by
        #3

        Hi
        Good example.
        Just tried it and i agree it seems a bit odd.
        I wonder if the index somehow is invalid and hence it wont react but
        its odd that Tab 3 makes it happy again.

        • Why does it appear that the TabBar becomes unresponsive?

        Well for me, its not unresponsive as it has hover effect but its not
        switching page.

        I wonder if it has Tab 4 (to match page 4) if it then will still have this issue ?

        1 Reply Last reply
        0
        • J Offline
          J Offline
          Jake 0
          wrote on last edited by
          #4

          @mrjj Thanks for looking at and confirming my example!

          Yes, the TabButton "Ripples" and as you mentioned, "Hover" & "Highlight" appear to work.
          But the TabButton press/click event goes nowhere? Or the TabBar is ignoring/disabled the event and fails to respond (temporarily until scrolling off/on to another tab).

          In my design (which I think is reasonable), I have (many) more Pages than TabButtons.

          mrjjM 1 Reply Last reply
          0
          • J Jake 0

            @mrjj Thanks for looking at and confirming my example!

            Yes, the TabButton "Ripples" and as you mentioned, "Hover" & "Highlight" appear to work.
            But the TabButton press/click event goes nowhere? Or the TabBar is ignoring/disabled the event and fails to respond (temporarily until scrolling off/on to another tab).

            In my design (which I think is reasonable), I have (many) more Pages than TabButtons.

            mrjjM Offline
            mrjjM Offline
            mrjj
            Lifetime Qt Champion
            wrote on last edited by
            #5

            @Jake-0
            Hi
            First, i thought the binding
            currentIndex: swipeView.currentIndex
            might make it "overflow" but it seems to stay at 3
            I do wonder why it would not be
            2/3 or 3/4 since there is one more page then tabs.

            I think its due to the binding but i dont know if its a bug or
            or what.

            1 Reply Last reply
            0
            • J Offline
              J Offline
              Jake 0
              wrote on last edited by Jake 0
              #6

              Hello @mrjj (thanks again!),

              The demo uses SwipeView setCurrentIndex() in the prescribed way along with the standard practice of binding the tab-to-view and the view-to-tab.

              So it "manages the binding" per:
              [https://doc.qt.io/qt-5/qml-qtquick-controls2-container.html#managing-the-current-index] via the SwipeView index, (not the TabBar index), so I believe it is Ok.

              the code has been updated with addition event logging:
              [https://github.com/JakeKirk/TabBarBroken.git]

              1 Reply Last reply
              0
              • J Offline
                J Offline
                Jake 0
                wrote on last edited by
                #7

                I have a workaround.

                SwipeView setCurrentIndex() can change a TabBar's currentIndex to something out-of-range when more Pages than Tabs exist. Also the default TabButton/TabBar onClicked() behavior that occurs normally appears to break when one programatically navigates to an index out of range.

                Anyway, my workaround is to add an onClicked() handler to each TabButton that checks the TabBar index to make sure it's "in range", and if not, then give the SwipeView a little helpful push in right direction.

                GitHub code has been updated with a working example:
                https://github.com/JakeKirk/TabBarBroken.git

                1 Reply Last reply
                1

                • Login

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