Qt6 topics merged with General

Resize all images in a QWebElement to a fixed size

  • I am trying to load content of a HTML page with QWebView and I search for the content with using QWebElement.
    It is working perfectly, but when QWebView tries to display large images, it looks really weird, because the text automatically fits into the QWebView window, but whenn the image is too big for the window it adds a scrollbar just for the image.
    My question is: Is there a way to resize the width of all images in a QWebView to fit the size of the window?

    My code looks like this:

    QUrl url("some url");
    QEventLoop loop;
    connect(ui->webView, SIGNAL(loadFinished(bool)), &loop, SLOT(quit()));
    QWebElement webFrame= ui->webView->page()->mainFrame()->findFirstElement("some element images");
    QString string = webFrame.toInnerXml();

Log in to reply