eric6/WebBrowser/Navigation/NavigationBar.py

changeset 7578
13b2c2167c93
parent 7533
88261c96484b
child 7759
51aa6c6b66f7
--- a/eric6/WebBrowser/Navigation/NavigationBar.py	Tue May 05 18:17:20 2020 +0200
+++ b/eric6/WebBrowser/Navigation/NavigationBar.py	Tue May 05 18:18:27 2020 +0200
@@ -233,7 +233,7 @@
         for index in range(len(backItems) - 1, -1, -1):
             item = backItems[index]
             act = QAction(self)
-            act.setData(-1 * (index + 1))
+            act.setData(item)
             icon = WebBrowserWindow.icon(item.url())
             act.setIcon(icon)
             act.setText(item.title())
@@ -260,7 +260,7 @@
         for index in range(len(forwardItems)):
             item = forwardItems[index]
             act = QAction(self)
-            act.setData(index + 1)
+            act.setData(item)
             icon = WebBrowserWindow.icon(item.url())
             act.setIcon(icon)
             act.setText(item.title())
@@ -281,18 +281,10 @@
         @param act reference to the action selected in the navigation menu
             (QAction)
         """
-        offset = act.data()
-        if offset is not None:
+        historyItem = act.data()
+        if historyItem is not None:
             history = self.__mw.currentBrowser().history()
-            historyCount = history.count()
-            if offset < 0:
-                # go back
-                history.goToItem(
-                    history.backItems(historyCount)[-1 * offset - 1])
-            else:
-                # go forward
-                history.goToItem(
-                    history.forwardItems(historyCount)[offset - 1])
+            history.goToItem(historyItem)
     
     def __goBack(self):
         """

eric ide

mercurial