Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

How to set at the end of verticalScrollBar in QWebView



  • Hello all, the problem is : scrollbar can't set at the end of QWebView. Look at screenshot;
    http://i.stack.imgur.com/A3fva.png

    void MainWindow::WriteToWebView(QString szSrc) { QWebElement elDoc = ui->webView->page()->mainFrame()->documentElement();
    
           if(!elDoc.isNull())
           {
               QWebElement elBody = elDoc.findFirst("body");
    
               if(!elBody.isNull())
               {
                    elBody.appendInside(szSrc + "<br /> ");
               }
    
           }
           //didn't work
           ui->webView->page()->mainFrame()->setScrollBarValue(Qt::Vertical, ui->webView->page()->mainFrame()->scrollBarMaximum(Qt::Vertical));
    }
    

    How i can fix it?



  • so, the root of that problem - QWebElement. Fix it? - use setHtml or setContent. Thanks all. Question closed.


Log in to reply