Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QWebView ignores user style sheet
QtWS25 Last Chance

QWebView ignores user style sheet

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 711 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.
  • J Offline
    J Offline
    Justin Sayne
    wrote on last edited by
    #1

    I'm trying to customize QWebView's scroll bars and can't get it done whatsoever. I've browsed the internet to come up with the following minimal example:

    #include <QApplication>
    #include <QWebView>
    
    int main(int argc, char** argv)
    {
      QApplication app( argc, argv );
    
      QWebSettings *settings = QWebSettings::globalSettings( );
      settings->setUserStyleSheetUrl( QUrl::fromLocalFile( "C:\style.css" ) );
    
      QWebView web_view;
      web_view.setUrl( QUrl( "http://www.google.de" ) );
      web_view.show( );
    
      app.exec( );
    
      return 0;
    }
    

    style.css contains:

    ::-webkit-scrollbar {
        width: 5px;
    }
    

    but the scroll bars don't change at all. I'm running Qt 5.5 (also tested 5.3.1) on Win10 but the scroll bars don't change at all. What am I doing wrong?

    1 Reply Last reply
    0
    • ? Offline
      ? Offline
      A Former User
      wrote on last edited by
      #2

      Hi! You got a typo here: QUrl::fromLocalFile( "C:\style.css" ).

      1 Reply Last reply
      1

      • Login

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