Coming to this three years later, I don't know about hantomjs or casperjs, but I found that [Kantu][2], which probably didn't exist when this question was posted, [does does this task pretty well][3], albeit not flawlessly.
[1]: https://stackoverflow.com/questions/54019747/how-to-automate-saving-webpages
[2]: https://a9t9.com/kantu
[3]: https://stackoverflow.com/questions/54019747/how-to-automate-saving-webpages/54051264#54051264
Coming to this eight years later, I don't know anything about Qt WebKit, but found that [Kantu][2], which didn't exist when this question was posted, [does this task pretty well][3], albeit not flawlessly.
[1]: https://stackoverflow.com/questions/54019747/how-to-automate-saving-webpages
[2]: https://a9t9.com/kantu
[3]: https://stackoverflow.com/questions/54019747/how-to-automate-saving-webpages/54051264#54051264