But if are using a latest i.e Qt WebEngine then you will need to update to Qt 5.6 where they have added new API's to do so. As per this doc.

We’ve also added a new Qt WebEngineCore module for new low-level APIs. This includes features such as support for custom URL schemes, intercepting and blocking network requests and for tracking and blocking cookies.