SwipeView navigation of more Pages than TabButtons. The TabBar TabButton temporarily unresponsive.
-
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 -
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 ?
-
@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.
-
@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. -
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] -
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