Results 1 to 6 of 6

Thread: Override QScrollbar using QStyle

  1. #1
    Join Date
    May 2013
    Posts
    321
    Thanks
    9
    Thanked 8 Times in 8 Posts
    Qt products
    Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Exclamation Override QScrollbar using QStyle

    Hi all,
    Since Qt has problem with QScrollbar and stylesheet (My bug report : https://bugreports.qt-project.org/browse/QTBUG-39513), the only way who stays is to use QStyle.
    I want to have a scrollbar like that : http://www.qtcentre.org/threads/2790...-of-QScrollBar.
    As you can see it's a line and the handle on it, but stylesheet doesn't allow background-image so it's impossible.
    What is the good way to use QStyle to have a scrollbar like that ?
    Maybe it's just not possible using Qt ?
    Thanks for the help

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Override QScrollbar using QStyle

    All widgets are painted using QPainter, so can be drawn using QPainter, it can be the visualization of a widget.

    Cheers,
    _

  3. #3
    Join Date
    May 2013
    Posts
    321
    Thanks
    9
    Thanked 8 Times in 8 Posts
    Qt products
    Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Override QScrollbar using QStyle

    Ok I see but Qt has a way to set this custom scrollbar widget to be the default scrollbar for all ?

  4. #4
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Override QScrollbar using QStyle

    A QStyle set with QApplication::setStyle() affects all instances of a given widget class unless it is specifically making exceptions.

    Cheers,
    _

  5. #5
    Join Date
    May 2013
    Posts
    321
    Thanks
    9
    Thanked 8 Times in 8 Posts
    Qt products
    Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Override QScrollbar using QStyle

    Sounds good ! So a QStyle can be used to have default scrollbar until one is set in stylesheet if I understand correctly.

  6. #6
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Override QScrollbar using QStyle

    A style and stylesheets are two entirely different things, but similar to a stylesheet a style can be set on a specific widget or application wide and it can decide to handle each instance of a widget individually.

    Cheers,
    _

Similar Threads

  1. Replies: 0
    Last Post: 11th October 2013, 03:53
  2. Replies: 2
    Last Post: 14th July 2011, 13:28
  3. Shortcut override ?
    By fenerista in forum Qt Programming
    Replies: 6
    Last Post: 23rd May 2010, 13:02
  4. Override a signal
    By daviddoria in forum Newbie
    Replies: 4
    Last Post: 9th February 2010, 19:18
  5. override wheelEvent for QScrollBar
    By ChasW in forum Qt Programming
    Replies: 6
    Last Post: 25th January 2007, 10:50

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.