Keep the setAttribute call only. Then you will be able to call the Inspector from the context menu.
The below code is not optimal but it shows how the pieces work together.
To add this to a non-modal dialog:
QDialog dlg;
...
QWebInspector *i = new QWebInspector(this);
dlg.setLayout(new QVBoxLayout());
dlg.layout()->addWidget(i);
dlg.setModal(false);
dlg.show();
dlg.raise();
dlg.activateWindow();
Your QDialog should be a member of the class.