There is a simple example available in the docs. I can't give you an example on how to login to a website because every website is different.

For facebook I think you should start reading here: https://developers.facebook.com/docs/concepts/login/

You will need either QNetworkAccessManager or WebKit.