Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QtWebEngine
  4. QWebEngineView - HTML Font Size

QWebEngineView - HTML Font Size

Scheduled Pinned Locked Moved Unsolved QtWebEngine
3 Posts 2 Posters 1.0k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    N Offline
    narayanan.krish
    wrote on last edited by
    #1

    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

    1 Reply Last reply
    0
    • M Offline
      M Offline
      mpergand
      wrote on last edited by mpergand
      #2

      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

      N 1 Reply Last reply
      0
      • M mpergand

        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

        N Offline
        N Offline
        narayanan.krish
        wrote on last edited by
        #3

        @mpergand

        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

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved