Important: Please read the Qt Code of Conduct -

[SOLVED]How to disable Scrollbars on QWidget

  • I am using QWebView to display some html content on it I have defined the geometry of my webview that exactly fits wiht html content geometry, but when it renders the html content it draws horizontal and vertical scrollbars on it. I have given the buggy code below.

    QWebView * webView = new QWebView();
    webView->settings()->setAttribute(QWebSettings::PluginsEnabled, true);

     QString str = "<html><body topmargin=\"0\" leftmargin=\"0\"><embed type=\"application/x-shockwave-flash\"     src=\"\"  type=\"application/x-shockwave-flash\"  data=\"/flash/logo.swf\"  height=\"200\"  width=\"190\"  PARAM=\"\"  quality=\"high\"  wmode=\"opaque\"  swfversion=\"\"  expressinstall=\"Scripts/expressInstall.swf\"></body></html>";
     webView->setGeometry(0,0, 190,200);
     QSizePolicy objSize(QSizePolicy::Fixed, QSizePolicy::Fixed);


    I tried to use SizePolicy as fixed also but not luck!!!
    Please help where it is going wrong.

  • @webView->page()->mainFrame()->setScrollBarPolicy(Qt::Vertical, Qt::ScrollBarAlwaysOff);
    webView->page()->mainFrame()->setScrollBarPolicy(Qt::Horizontal, Qt::ScrollBarAlwaysOff);@


  • Thanks Jake it worked for me...

Log in to reply