ekke / drawer_nav_x

Sample APP - Qt 5.7+ - Android iOS
The Unlicense
43 stars 10 forks source link

Suggestion for lastCurrentIndex in SwipeView #1

Open lukegluke opened 8 years ago

lukegluke commented 8 years ago

Hi, Ekkehard

Just a little suggestion-improvement for your QTBUG-54260 workaround.

For now you store properties string name: "namePage" for every single page and then set or restore SwipeView index looking by name "colorSchemaNavPage" that as you know contains SwipeView: if(rootPane.currentItem.name == "colorSchemaNavPage")

Despite this is just a workaround, I think, you could improve it a little just by checking lastCurrentIndex property existence: rootPane.currentItem.lastCurrentIndex != undefined

That's it. No need to store names properties for any page (at least to use workaround). No need to add new names of pages with SwipeView to checking condition if somebody decides to add some of them (and will have to rack his brains why SwipeView currentIndex lost only on his new pages).

p.s. Taking this opportunity I want to thank you for your blog and applications' code sharing!

lukegluke commented 8 years ago

Just in case, of course both (yours and my) workarounds not work for "WHILE_CURRENT":3 pages, cause it's deactivated-removed and there is no way to store var (lastCurrentIndex) in it.

ekke commented 8 years ago

Hi, thanks for your suggestion. will take a look at it later. just too much work on other projects this was a quick and dirty workaround and I'm sure it can be improved. ekke