title: Qt: Getting QWebview to return a complete URL
body: <p>I have a class in my application that displays HTML-based documentation that is stored as a set of HTML files on the user's hard drive. </p>
  
  <p>My documentation module has a feature that allows it to remember the most recently-viewed page. I'm currently using QWebView::url() to get the URL of the current page so I can store it in the config. The next time the documentation viewer is activated, the URL is pulled from the config, processed appropriately, and is then sent back to the QWebView. That way, the user can pick up where he/she left off.</p>
  
  <p>QWebView::url is a good way to get the current URL, except it isn't as precise as I need it to be. It only captures the base URL without any of the extras. For instance, every heading in my documentation has an id attribute attached to it, and I used this to make a browsable table of contents. For instance, the user can click any item in the TOC to jump to the appropriate heading. </p>
  
  <p>However, QWebKit::url only returns something like this: <em>file:///Z:/doc/foo.html</em> when I need <em>file:///Z:/doc/foo.html#heading</em>, where #heading is the last item clicked in the TOC. How can I get it to include those internal links (not quite sure what the proper name for them is) in the URL string?</p>
  
  <p>In a perfect world, QWebView would automatically know when the user scrolls past each heading in the current document and would update the URL string automatically. This would allow for nearly seamless reading between sessions. I don't expect it to work that way, but is this even possible? </p>