QWebEngineView - HTML Font Size
-
Hello,
Can someone clarify If I can increase the font size of a html content (text) inside QWebEngineView. I've tried updating the QWebEngineSettings *defaultSetting's font sizes but in vain.
Thanks & Regards,
Nara -
hi,
You can set a minimum size with QWebEngineSettings
or apply a zoom factor to your webview.There is a very similar question here:
https://forum.qt.io/topic/76319/how-to-control-the-font-size-in-qwebengineview -
Thanks for the reply. I've already followed that link and tried the following. I'm not seeing any changes for both zoom factor or font size. Is there anything I could miss ?
From the debug messages, I'm able to observe that the values are updated, but I'm not able to observe any changes in the view.
QWebEngineSettings *defaultSettings = QWebEngineSettings::globalSettings(); qDebug() << "default fontsssssssssssss" << defaultSettings->fontSize(QWebEngineSettings::MinimumFontSize) << defaultSettings->fontSize((QWebEngineSettings::MinimumLogicalFontSize)) << defaultSettings->fontSize(QWebEngineSettings::DefaultFontSize) << defaultSettings->fontSize(QWebEngineSettings::DefaultFixedFontSize) << m_adSlipsWebView->zoomFactor(); m_adSlipsWebView->setZoomFactor(5); defaultSettings->setFontSize(QWebEngineSettings::MinimumFontSize,50); defaultSettings->setFontSize(QWebEngineSettings::MinimumLogicalFontSize,50); defaultSettings->setFontSize(QWebEngineSettings::DefaultFontSize,50); defaultSettings->setFontSize(QWebEngineSettings::DefaultFixedFontSize,50); QFontDatabase fontDataBase; QFont standardFont=fontDataBase.font("Arial","",24); defaultSettings->setFontFamily(QWebEngineSettings::StandardFont, standardFont.family());
I've tried above options before calliing
m_adSlipsWebView->setHtml(m_config.clientConfig->adSlipsContent());
Thanks & Regards,
Nara