Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. in QWebEngineView, QWebEnginePage , how can I restore scroll positions?
Qt 6.11 is out! See what's new in the release blog

in QWebEngineView, QWebEnginePage , how can I restore scroll positions?

Scheduled Pinned Locked Moved Solved General and Desktop
5 Posts 3 Posters 3.0k 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.
  • CKurduC Offline
    CKurduC Offline
    CKurdu
    wrote on last edited by
    #1

    Hi Everybody,
    I can save scroll position with QWebEnginePage::scrollPosition . How can I reload the positions when the program restarted. I am using QWebEngineView.

    You reap what you sow it

    1 Reply Last reply
    0
    • Pradeep KumarP Offline
      Pradeep KumarP Offline
      Pradeep Kumar
      wrote on last edited by
      #2

      Hi ,

      @CKurdu

      do u want to get the value saved , to read again when the program is launched once again.
      in that case use QSettings.

      Thanks,

      Pradeep Kumar
      Qt,QML Developer

      1 Reply Last reply
      0
      • CKurduC Offline
        CKurduC Offline
        CKurdu
        wrote on last edited by
        #3

        No, I don't. I mean that I am searching a method to reload the position data back, for example, QWebEnginePage::setScrollPosition. But I didn't find any method like that. There is a bug report here. Is there a way to set scroll positions back?

        You reap what you sow it

        thamT 1 Reply Last reply
        0
        • CKurduC CKurdu

          No, I don't. I mean that I am searching a method to reload the position data back, for example, QWebEnginePage::setScrollPosition. But I didn't find any method like that. There is a bug report here. Is there a way to set scroll positions back?

          thamT Offline
          thamT Offline
          tham
          wrote on last edited by
          #4

          @CKurdu By now I guess only javascript is useable

          QWebEngineView()->page()->runJavaScript(QString("window.scrollTo(%1, %2);").arg(scrollX).arg(scrollY));
          
          1 Reply Last reply
          1
          • CKurduC Offline
            CKurduC Offline
            CKurdu
            wrote on last edited by
            #5

            Thanks,
            The code solved my problem.

            You reap what you sow it

            1 Reply Last reply
            1

            • Login

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