Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QtWebEngine
  4. Removing duplicates from QWebEngineHistory
Forum Updated to NodeBB v4.3 + New Features

Removing duplicates from QWebEngineHistory

Scheduled Pinned Locked Moved Unsolved QtWebEngine
4 Posts 2 Posters 499 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.
  • H Offline
    H Offline
    Harborman
    wrote on last edited by
    #1

    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.")
    
    
    JonBJ 1 Reply Last reply
    0
    • H Harborman

      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.")
      
      
      JonBJ Offline
      JonBJ Offline
      JonB
      wrote on last edited by
      #2

      @Harborman
      I don't know whether you can modify the QWebEngineHistory. I don't know whether the QWebEngineHistoryModel is a modifyable QAbstractListModel. You might look at an abandoned Add and remove items from QWebEngineHistory

      H 1 Reply Last reply
      0
      • JonBJ JonB

        @Harborman
        I don't know whether you can modify the QWebEngineHistory. I don't know whether the QWebEngineHistoryModel is a modifyable QAbstractListModel. You might look at an abandoned Add and remove items from QWebEngineHistory

        H Offline
        H Offline
        Harborman
        wrote on last edited by
        #3

        @JonB said in Removing duplicates from QWebEngineHistory:

        @Harborman
        I don't know whether you can modify the QWebEngineHistory. I don't know whether the QWebEngineHistoryModel is a modifyable QAbstractListModel. You might look at an abandoned Add and remove items from QWebEngineHistory

        I 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.

        JonBJ 1 Reply Last reply
        0
        • H Harborman

          @JonB said in Removing duplicates from QWebEngineHistory:

          @Harborman
          I don't know whether you can modify the QWebEngineHistory. I don't know whether the QWebEngineHistoryModel is a modifyable QAbstractListModel. You might look at an abandoned Add and remove items from QWebEngineHistory

          I 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.

          JonBJ Offline
          JonBJ Offline
          JonB
          wrote on last edited by JonB
          #4

          @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.

          1 Reply Last reply
          0

          • Login

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