+1  A: 

This is a little tricky. I found a good way to get accurate DPI measurements is from QApplication, example:

QWidget* window = QApplication::desktop()->screen();
int horizontalDpi = window->logicalDpiX(); 

As far as font goes, you can use QWidget::fontMetrics() to get a good font metrics information.

I think a combination of both will give you some consistency between your web view and text edit.

Good luck.

Karol Wilk