Unsolved Removing duplicates from QWebEngineHistory
-
I noticed that when I click the same link for, say, 7 times and then try to go back, I need to click the back button 7 times before I get to the previous unique page. It would be preferable for the browser to ignore consecutive duplicate urls in the history.
How do I remove entries like this from history?I can use backItem() and currentItem() to compare if the the current page and the previous page are the same. But that's as far as I can get.
backitem = self.tabs.currentWidget().history().backItem().url() back = backitem.toString() currentitem = self.tabs.currentWidget().history().currentItem().url() current = currentitem.toString() if back == current: print("Yeah they're the same.")
-
@Harborman
I don't know whether you can modify theQWebEngineHistory
. I don't know whether theQWebEngineHistoryModel
is a modifyableQAbstractListModel
. You might look at an abandoned Add and remove items from QWebEngineHistory -
@JonB said in Removing duplicates from QWebEngineHistory:
@Harborman
I don't know whether you can modify theQWebEngineHistory
. I don't know whether theQWebEngineHistoryModel
is a modifyableQAbstractListModel
. You might look at an abandoned Add and remove items from QWebEngineHistoryI should've specified that I'm working with Python. Should I just keep a list [] of all the loaded urls and remove the last item [-1] if it's a duplicate? I thought of that but it would be kind of silly given that QWebEngineHistory exists.
-
@Harborman
You may keep a list, but I think the issue is how do you remove from the web engine history (e.g. so don't have to press Back multiple times), because I don't think it's obviously editable? My understanding is that is where the problem lies. You removing from your own Python list is obviously not a problem. I have not done any of this so there may be confusion, you will know better than I whether what I'm saying applies.