[SOLVED] Apply a QGraphicsEffect on a scrollbar



  • Hi everyone,
    I would like to apply a blur-effect on a QScrollBar, is that possible?


  • Moderators

    Did you fail using it? Or was this just a question instead of trying it within 30 secs?



  • Hi raven, thanks for replying.
    I'm asking because I really don't know if it is possible. I tried a code but only managed to get the all QScrollErea blured and not just the QscrollBar. The single way I know to custumize a scrollbar is by using the stylesheet. However I do not know how to apply the effect through it. An idea?


  • Moderators

    what did you try?
    @
    scrollAreaAbstract->verticalScrollBar()->setGraphicsEffect( new QGraphicsBlurEffect(...) );
    @



  • I tried this:
    @
    QScrollArea *scrolls = new QScrollArea;
    QGraphicsBlurEffect *blureffect = new QGraphicsBlurEffect;
    scrolls->setGraphicsEffect(blureffect);
    @
    As I said, this code gives me the whole widget blured, not just the scrollbar.

    Concerning your code I tried it and got an error on "scrollAreaAbstract".



  • Thanks a lot Raven, finally it works.
    I used your code this way:
    @
    QScrollArea *scrolls = new QScrollArea;
    QGraphicsBlurEffect *blureffect = new QGraphicsBlurEffect;
    scrolls->horizontalScrollBar()->setGraphicsEffect(blureffect);
    @


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.