3.the Qt WebKitQgraphicswebviewThis section describes how to use Qt'sQgraphicswebview implements the Shard backing store (Tiled backing store).
As shown in the static class diagram above, only the implementation of theThe interface of the Shard Underlay store client (tiledbackingstoreclient) Webcore::frame only hasShard backing Store Instances。 Other classes can only be accessed byWebcore::frame sent a message toShard backing Store。
Qgraphicswebview is a subclass of Qgraphicswidget. It is used to display visible content on the screen.
3.1 Reset the size of the Qgraphicswebview (Resize to content) by contentsThe Resizestocontents (boolean variable) is the Qgraphicswebview property. When using a shard policy, Qgraphicswebview is used to act as our content, and it should follow the main frame contentReset your size now。
As the Qt4.7 document says, if you set this property, Qgraphicswebview will automatically set its size according to the size of the main frame. As a result, the top-level frame never has a scroll bar. This makes the fixed-point positioning of the CSS (fixed positioning) look like absolute positioning (absolute positioning)-element relative to the document instead of the view portpositioning.
If Resizestocontents is set to True, Webcore::frameview will notify Qgraphicswebview to update its size once the content of the frame changes.
3.2 Drawing Process
Here are the steps required to draw Qgraphicswebview:
- According toQgraphicswebview coordinatesCalculates the visible area rectangle. Because Qgraphicswebview resets its size according to the size of the frame content, whenQgraphicswebview the visible area rectangle changes when scrolling or zooming。Shard backing store creating tiles requires such a visible area。
- Make sure the entire visible area is covered by tiles. For visible areas that are not covered by tiles, it will repeatedly create tiles that are the center of the view port, until all visible areas are overwritten. The distance is calculated based onManhattan distance algorithm (Manhattan distance).
In order to not block drawing operations as much as possible, tile creation takes the form of asynchronous execution, reflected inThe Shard Underlay store, asynchronously, is a shard backing store implemented by starting the Shard Underlay store timer:Starttilecreationtimer.
- The content of the frame is drawn to the back buffer of each tile, and the tile is updated in such a way that the update is also asynchronous.
- The drawpixmap function of the QT brush draws the back buffer
Original: http://xbfp2b2n.blog.sohu.com/196617339.html
Tiled backing Store (iii)